linear-base-0.5.0: Standard library for linear types.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Foreign.List

Synopsis

Documentation

data List a Source #

Constructors

Nil 
Cons !a !(Box (List a)) 

Instances

Instances details
Representable a => Representable (List a) Source # 
Instance details

Defined in Foreign.List

Associated Types

type AsKnown (List a) #

Methods

toKnown :: List a %1 -> AsKnown (List a) #

ofKnown :: AsKnown (List a) %1 -> List a #

Representable a => MkRepresentable (List a) (Maybe (a, Box (List a))) Source # 
Instance details

Defined in Foreign.List

Methods

toRepr :: List a %1 -> Maybe (a, Box (List a)) #

ofRepr :: Maybe (a, Box (List a)) %1 -> List a #

(Representable k, Representable a) => MkRepresentable (NEHeap k a) (k, a, Box (List (NEHeap k a))) Source # 
Instance details

Defined in Foreign.Heap

Methods

toRepr :: NEHeap k a %1 -> (k, a, Box (List (NEHeap k a))) #

ofRepr :: (k, a, Box (List (NEHeap k a))) %1 -> NEHeap k a #

type AsKnown (List a) Source # 
Instance details

Defined in Foreign.List

type AsKnown (List a) = AsKnown (Maybe (a, Box (List a)))

map :: forall a b. (Representable a, Representable b) => (a %1 -> b) -> List a %1 -> Pool %1 -> List b Source #

foldr :: forall a b. Representable a => (a %1 -> b %1 -> b) -> b %1 -> List a %1 -> b Source #

foldl :: forall a b. Representable a => (b %1 -> a %1 -> b) -> b %1 -> List a %1 -> b Source #

unfold :: forall a s. Representable a => (s -> Maybe (a, s)) -> s -> Pool %1 -> List a Source #

Make a List from a stream. List is a type of strict lists, therefore the stream must terminate otherwise unfold will loop. Not tail-recursive.

unfoldL :: forall a s. Representable a => (s %1 -> Maybe (a, s)) -> s %1 -> Pool %1 -> List a Source #

Linear variant of unfold. Note how they are implemented exactly identically. They could be merged if multiplicity polymorphism was supported.

ofList :: Representable a => [a] -> Pool %1 -> List a Source #

toList :: Representable a => List a %1 -> [a] Source #

runfold :: forall a s. Representable a => (s -> Maybe (a, s)) -> s -> Pool %1 -> List a Source #

Like unfold but builds the list in reverse, and tail recursive

ofRList :: Representable a => [a] -> Pool %1 -> List a Source #