streamly-core-0.2.2: Streaming, parsers, arrays, serialization and more
Copyright(c) 2022 Composewell Technologies
LicenseBSD3
Maintainerstreamly@composewell.com
Stabilityexperimental
PortabilityGHC
Safe HaskellSafe-Inferred
LanguageHaskell2010

Streamly.Internal.Data.Builder

Contents

Description

 
Synopsis

Imports

Types

newtype Builder s m a Source #

A simple stateful function composing monad that chains state passing functions. This can be considered as a simplified version of the State monad or even a Fold. Unlike fold the step function is one-shot and not called in a loop.

Constructors

Builder (s -> m (a, s)) 

Instances

Instances details
Monad m => Applicative (Builder a m) Source # 
Instance details

Defined in Streamly.Internal.Data.Builder

Methods

pure :: a0 -> Builder a m a0 Source #

(<*>) :: Builder a m (a0 -> b) -> Builder a m a0 -> Builder a m b Source #

liftA2 :: (a0 -> b -> c) -> Builder a m a0 -> Builder a m b -> Builder a m c Source #

(*>) :: Builder a m a0 -> Builder a m b -> Builder a m b Source #

(<*) :: Builder a m a0 -> Builder a m b -> Builder a m a0 Source #

Functor m => Functor (Builder s m) Source #

Maps a function on the output of the fold (the type b).

Instance details

Defined in Streamly.Internal.Data.Builder

Methods

fmap :: (a -> b) -> Builder s m a -> Builder s m b Source #

(<$) :: a -> Builder s m b -> Builder s m a Source #

Monad m => Monad (Builder a m) Source # 
Instance details

Defined in Streamly.Internal.Data.Builder

Methods

(>>=) :: Builder a m a0 -> (a0 -> Builder a m b) -> Builder a m b Source #

(>>) :: Builder a m a0 -> Builder a m b -> Builder a m b Source #

return :: a0 -> Builder a m a0 Source #