FastPush-0.1.0.3: A monad and monad transformer for pushing things onto a stack very fast.

Safe HaskellNone
LanguageHaskell2010

Control.Monad.Push

Synopsis

Documentation

data Res a Source #

The internal return type of a push action. The Int value is the new vector used length.

Constructors

Res !Int !a 

Instances

Functor Res Source # 

Methods

fmap :: (a -> b) -> Res a -> Res b #

(<$) :: a -> Res b -> Res a #

newtype Push v p a Source #

A monad that lets you push things onto a stack.

Constructors

Push (forall s. Int -> STRef s (v s p) -> ST s (Res a)) 

Instances

MVector v p => MonadPush p (Push v p) Source # 

Methods

push :: p -> Push v p () Source #

Monad (Push v p) Source # 

Methods

(>>=) :: Push v p a -> (a -> Push v p b) -> Push v p b #

(>>) :: Push v p a -> Push v p b -> Push v p b #

return :: a -> Push v p a #

fail :: String -> Push v p a #

Functor (Push v p) Source # 

Methods

fmap :: (a -> b) -> Push v p a -> Push v p b #

(<$) :: a -> Push v p b -> Push v p a #

Applicative (Push v p) Source # 

Methods

pure :: a -> Push v p a #

(<*>) :: Push v p (a -> b) -> Push v p a -> Push v p b #

(*>) :: Push v p a -> Push v p b -> Push v p b #

(<*) :: Push v p a -> Push v p b -> Push v p a #

runPush :: Vector v p => Push (Mutable v) p a -> (a, v p) Source #

Run the Push monad. Get the return value and the output stack.

runPushU :: forall p a. Unbox p => Push MVector p a -> (a, Vector p) Source #

Specialized to Unboxed vectors.

runPushB :: forall p a. Push MVector p a -> (a, Vector p) Source #

Specialized to standard Boxed vectors.

runPushS :: forall p a. Storable p => Push MVector p a -> (a, Vector p) Source #

Specialized to Storable vectors.