I have an effectful asynchronous action with a type, let's say,
effectful :: Aff e r
I would like to build an action that takes some asynchronous action and sends the result to a Channel
from purescript-signal. The send
function has the signature:
send :: forall a e. Channel a -> a -> Eff (channel :: CHANNEL | e) Unit
Here is the implementation I came up with:
runAffToChannel :: forall a e. Channel a
-> Aff e a
-> Eff (channel :: CHANNEL | e) Unit
runAffToChannel chan = runAff_ $ either ignore $ send chan
where
ignore = const (pure unit)
The types do not unify here between e
and channel :: CHANNEL | e
.
How do I convert the value of type Aff e a
to Aff (channel :: CHANNEL | e) a
, or at least Eff e a
to Eff (channel :: CHANNEL | e) a
?