Hoogle Search

Within LTS Haskell 24.3 (ghc-9.10.2)

Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.

  1. conduitPutList :: forall (m :: Type -> Type) . Monad m => ConduitT Put [ByteString] m ()

    binary-conduit Data.Conduit.Serialization.Binary

    Vectorized variant of conduitPut returning list contains all chunks from one element representation

  2. conduitPutMany :: forall (m :: Type -> Type) . Monad m => ConduitT Put (Vector ByteString) m ()

    binary-conduit Data.Conduit.Serialization.Binary

    Vectorized variant of conduitPut.

  3. conduitGet :: forall (m :: Type -> Type) o . MonadThrow m => Get o -> ConduitT ByteString o m ()

    cereal-conduit Data.Conduit.Cereal

    Deprecated: Please switch to conduitGet2, see comment on that function

  4. conduitGet2 :: forall (m :: Type -> Type) o . MonadThrow m => Get o -> ConduitT ByteString o m ()

    cereal-conduit Data.Conduit.Cereal

    Reapply Get o to a stream of bytes as long as more data is available, and yielding each new value downstream. This has a few differences from conduitGet:

    • If there is a parse failure, the bytes consumed so far by this will not be returned as leftovers. The reason for this is that the only way to guarantee the leftovers will be returned correctly is to hold onto all consumed ByteStrings, which leads to non-constant memory usage.
    • This function will properly terminate a Get function at end of stream, see https://github.com/snoyberg/conduit/issues/246.
    • conduitGet will pass empty ByteStrings from the stream directly to cereal, which will trigger cereal to think that the stream has been closed. This breaks the normal abstraction in conduit of ignoring how data is chunked. In conduitGet2, all empty ByteStrings are filtered out and not passed to cereal.
    • After conduitGet2 successfully returns, we are guaranteed that there is no data left to be consumed in the stream.

  5. conduitPut :: forall (m :: Type -> Type) a . Monad m => Putter a -> ConduitT a ByteString m ()

    cereal-conduit Data.Conduit.Cereal

    Run a Putter repeatedly on the input stream, producing a concatenated ByteString stream.

  6. conduitArray :: forall v (m :: Type -> Type) . (FromJSON v, MonadThrow m) => ConduitM ByteString v m ()

    conduit-aeson Data.Conduit.Aeson

    Parse a top level array into a stream of json values. Throws a ParserError on invalid input, see conduitArrayEither for more graceful error handling.

    Examples

    >>> :set -XTypeApplications
    
    >>> :set -XOverloadedStrings
    
    >>> import Conduit
    
    >>> import Data.Conduit.Aeson
    
    >>> runConduit $ yield ("[1,2,3,4]") .| conduitArray @Int .| printC
    1
    2
    3
    4
    

  7. conduitArrayEither :: forall v (m :: Type -> Type) . (FromJSON v, Monad m) => ConduitM ByteString (Either ParserError v) m ()

    conduit-aeson Data.Conduit.Aeson

    Same as conduitArray, parse a top level array into a stream of values, but produce Left ParserError instead of failing immediately with an exception.

  8. conduitArrayParserEither :: forall (m :: Type -> Type) . Monad m => ConduitM ByteString (Either ParseError (PositionRange, Maybe Value)) m ()

    conduit-aeson Data.Conduit.Aeson

    Parse a top level array as a stream of JSON values. Expects opening and closing braket '[' and ']' at the beginning and the end of the stream respectfully. Nothing indicates terminating closing square braket has been reached, but it does not mean there are no left over bytes in the input stream.

  9. conduitArrayParserNoStartEither :: forall (m :: Type -> Type) a . Monad m => Parser a -> ConduitM ByteString (Either ParseError (PositionRange, Value)) m ()

    conduit-aeson Data.Conduit.Aeson

    Parse a stream of JSON values. Expects that there are no opening or closing top level array braces [ and ]. Could be very useful for consuming infinite streams of log entries, where each entry is formatted as a JSON value.

    Examples

    Parse a new line delimited JSON values.
    >>> import Conduit
    
    >>> import Data.Conduit.Aeson
    
    >>> import Data.ByteString.Char8 (ByteString, pack)
    
    >>> import Data.Attoparsec.ByteString.Char8 (char8)
    
    >>> let input = pack "{\"foo\":1}\n{\"bar\":2}\n" :: ByteString
    
    >>> let parser = conduitArrayParserNoStartEither (char8 '\n')
    
    >>> runConduit (yield input .| parser .| printC)
    Right (1:1 (0)-2:1 (10),Object (fromList [("foo",Number 1.0)]))
    Right (2:1 (10)-3:1 (20),Object (fromList [("bar",Number 2.0)]))
    
    Or a simple comma delimited list:
    >>> runConduit $ yield (pack "1,2,3,\"Haskell\",") .| conduitArrayParserNoStartEither (char8 ',') .| printC
    Right (1:1 (0)-1:3 (2),Number 1.0)
    Right (1:3 (2)-1:5 (4),Number 2.0)
    Right (1:5 (4)-1:7 (6),Number 3.0)
    Right (1:7 (6)-1:17 (16),String "Haskell")
    

  10. conduitObject :: forall k v (m :: Type -> Type) . (FromJSONKey k, FromJSON v, MonadThrow m) => ConduitM ByteString (k, v) m ()

    conduit-aeson Data.Conduit.Aeson

    Parse a top level object into a stream of key/value pairs. Throws a ParserError on invalid input, see conduitObjectEither for more graceful error handling.

    Examples

    >>> :set -XOverloadedStrings
    
    >>> :set -XTypeApplications
    
    >>> import Conduit
    
    >>> import Data.Conduit.Aeson
    
    >>> let input = "{ \"foo\": 1, \"bar\": 2, \"baz\": 3 }"
    
    >>> runConduit $ yield input .| conduitObject @String @Int .| printC
    ("foo",1)
    ("bar",2)
    ("baz",3)
    

Page 4 of many | Previous | Next