neural-0.3.0.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.

Instances

MonadTrans (StackT s) Source # 

Methods

lift :: Monad m => m a -> StackT s m a #

Monad m => Monad (StackT s m) Source # 

Methods

(>>=) :: StackT s m a -> (a -> StackT s m b) -> StackT s m b #

(>>) :: StackT s m a -> StackT s m b -> StackT s m b #

return :: a -> StackT s m a #

fail :: String -> StackT s m a #

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

Methods

fmap :: (a -> b) -> StackT s m a -> StackT s m b #

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

Monad m => Applicative (StackT s m) Source # 

Methods

pure :: a -> StackT s m a #

(<*>) :: StackT s m (a -> b) -> StackT s m a -> StackT s m b #

(*>) :: StackT s m a -> StackT s m b -> StackT s m b #

(<*) :: StackT s m a -> StackT s m b -> StackT s m a #

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 :: 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.