-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to return a conduit from an effect? #108
Comments
Hmm. This should work: runFtpIO ::
( IOE :> es,
Reader Handle :> es,
Resource :> es
) =>
Eff (Ftp ': es) a ->
Eff es a
runFtpIO = interpret $ \env -> \case
Retr s -> do
h <- ask
localLiftUnlift env SeqUnlift $ \lift _unlift -> do
pure . transPipe lift $ Ftp.retr h s It looks like this use case warrants addition of EDIT: with #109: runFtpIO ::
( IOE :> es,
Reader Handle :> es,
Resource :> es
) =>
Eff (Ftp ': es) a ->
Eff es a
runFtpIO = interpret $ \env -> \case
Retr s -> do
h <- ask
localSeqLift env $ \lift -> do
pure . transPipe lift $ Ftp.retr h s |
Thanks for the quick response, I'd been beating my head against this all day because I somehow missed runFtpIO ::
forall es a.
(IOE :> es, Resource :> es) =>
String ->
Int ->
Eff (Ftp ': es) a ->
Eff es a
runFtpIO host port m = Ftp.withFTP host port $ \h _ -> interpret (handler h) m
where
handler :: Ftp.Handle -> EffectHandler Ftp es
handler h env ftp = localLiftUnlift env SeqUnlift $ \lift _ -> case ftp of
List ss -> pure . transPipe lift $ Ftp.list h ss
Retr s -> pure . transPipe lift $ Ftp.retr h s I'm going to close this now, since the thing I want is possible with current |
FYI 2.2.1.0 is released 🙂 |
I have been trying to write an effect for the functions in
ftp-client-conduit
:This fails with the following error:
It looks to me like we cannot know what's going inside the monad that the
ConduitT
is applied to, and since @isovector has hit the same problem I think it looks pretty fundamental to the way these effect libraries work.In
effectful
's case, it seems like I can get it to compile by being specific about the monad inside the conduit:Do you have any alternate suggestions?
The text was updated successfully, but these errors were encountered: