Skip to content
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

asConduit doesn't stream. #5

Open
HuwCampbell opened this issue Mar 4, 2021 · 0 comments
Open

asConduit doesn't stream. #5

HuwCampbell opened this issue Mar 4, 2021 · 0 comments

Comments

@HuwCampbell
Copy link
Contributor

asConduit appears to create a conduit which consumes the entire sequence; then when done, binds cons steps into it's Done constructor.

After the conduit is completely consumed, the stream function is applied. To demonstrate, I believe this code is effectively equivalent (this also shows that the stream consumed contains precisely 0 Effect constructors).

overList :: (Monad m) => ([i] -> [o]) -> ConduitM i o m ()
overList f = join . fmap (Conduit.sourceList . f) $ go
  where
    go = do mo <- await
            case mo of
              Nothing -> return []
              Just o  -> (o :) <$> go

I'm not convinced that this type signature is able to be implemented satisfactorily. Although one should be able to with a stream Stream (Of i) (ConduitT i o m) ().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant