HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulelinear-base-0.4.0Haskell2010

Streaming.Linear.Internal.Type

  • 2 types

The Stream and Of types

2 declarations

The Stream data type is equivalent to FreeT and can represent any effectful succession of steps, where the form of the steps or commands is specified by the first (functor) parameter. The effects are performed exactly once since the monad is a Control.Monad from linear-base.

data Stream f m r = Step !(f (Stream f m r)) | Effect (m (Stream f m r)) | Return r

The producer concept uses the simple functor (a,_) - or the stricter Of a _ . Then the news at each step or layer is just: an individual item of type a. Since Stream (Of a) m r is equivalent to Pipe.Producer a m r, much of the pipes Prelude can easily be mirrored in a streaming Prelude. Similarly, a simple Consumer a m r or Parser a m r concept arises when the base functor is (a -> _) . Stream ((->) input) m result consumes input until it returns a result.

To avoid breaking reasoning principles, the constructors should not be used directly. A pattern-match should go by way of inspect - or, in the producer case, Streaming.Prelude.next

datadata Stream (f :: Type -> Type) (m :: Type -> Type) r where
#

Constructors

  • Step :: !f (Stream f m r) -> Stream f m r
  • Effect :: m (Stream f m r) -> Stream f m r
  • Return :: r -> Stream f m r
Instances6MonadTrans, Monad, Functor, Applicative
  • Functor f => MonadTrans (Stream f)Defined in linear-base-0.4.0 · Streaming.Linear.Internal.Type
  • (Functor m, Functor f) => Applicative (Stream f m)Defined in linear-base-0.4.0 · Streaming.Linear.Internal.Type
  • (Functor m, Functor f) => Functor (Stream f m)Defined in linear-base-0.4.0 · Streaming.Linear.Internal.Type
  • (Functor m, Functor f) => Monad (Stream f m)Defined in linear-base-0.4.0 · Streaming.Linear.Internal.Type
  • (Functor m, Functor f) => Functor (Stream f m)Defined in linear-base-0.4.0 · Streaming.Linear.Internal.Type
  • (Functor m, Functor f) => Applicative (Stream f m)Defined in linear-base-0.4.0 · Streaming.Linear.Internal.Type
datadata Of a b where
#

A left-strict pair; the base functor for streams of individual elements.

Constructors

  • (:>) :: !a -> b -> Of a binfixr 5
Instances2Functor
  • Functor (Of a)Defined in linear-base-0.4.0 · Streaming.Linear.Internal.Type
  • Functor (Of a)Defined in linear-base-0.4.0 · Streaming.Linear.Internal.Type