neural-0.1.1.0: Neural Networks in native Haskell

Copyright(c) Lars Brünjes, 2016
LicenseMIT
Maintainerbrunjlar@gmail.com
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010
ExtensionsGeneralizedNewtypeDeriving

Data.Utils.Stack

Description

This module defines the StackT monad transformer, which is simply a wrapped state monad whose state is a list.

Synopsis

Documentation

data StackT s m a Source

A computation of type StackT s m a has access to a stack of elements of type s.

pop :: Monad m => StackT s m (Maybe s) Source

Pops the top element from the stack. Returns Nothing if the stack is empty.

peek :: Monad m => StackT s m (Maybe s) Source

Peeks at the top element of the stack. Returns Nothing if the stack is empty.

push :: Monad m => s -> StackT s m () Source

Pushes a new element onto the stack.

runStackT :: Monad m => StackT s m a -> [s] -> m (a, [s]) Source

Runs a computation in the StackT s m monad.

evalStackT :: Monad m => StackT s m a -> [s] -> m a Source

Evaluates a computation in the StackT s m monad.

execStackT :: Monad m => StackT s m a -> [s] -> m [s] Source

Executes a computation in the StackT s m monad.

type Stack s = StackT s Identity Source

A pure stack monad.

runStack :: Stack s a -> [s] -> (a, [s]) Source

Runs a computation in the Stack s monad.

evalStack :: Stack s a -> [s] -> a Source

Evaluates a computation in the Stack s monad.

execStack :: Stack s a -> [s] -> [s] Source

Executes a computation in the Stack s monad.