Skip to content

asConduit doesn't stream. #5

Description

@HuwCampbell

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) ().

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions