Copyright | (c) Peter Lu 2018 |
---|---|
License | GPL-3 |
Maintainer | chippermonky@gmail.com |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- class SelfActionable p o where
- apply :: o -> p -> p
- reduce :: SelfActionable p o => [o] -> p -> p
- data Status
- newtype NodeSequenceT g p o m a = NodeSequenceT {
- runNodeSequenceT :: g -> p -> m (a, g, p, Status, [o])
- execNodeSequenceT :: Monad m => NodeSequenceT g p o m a -> g -> p -> m (g, p, Status, [o])
- execNodeSequenceTimesT :: (SelfActionable p o, Monad m) => Int -> NodeSequenceT g p o m a -> g -> p -> m (g, p, Status, [o])
- execNodeSequenceTimesFinalizeT :: (SelfActionable p o, Monad m) => Int -> NodeSequenceT g p o m a -> g -> p -> m p
- type NodeSequence g p o a = NodeSequenceT g p o Identity a
- runNodeSequence :: NodeSequence g p o a -> g -> p -> (a, g, p, Status, [o])
- execNodeSequence :: NodeSequence g p o a -> g -> p -> (g, p, Status, [o])
- execNodeSequenceTimes :: SelfActionable p o => Int -> NodeSequence g p o a -> g -> p -> (g, p, Status, [o])
- execNodeSequenceTimesFinalize :: SelfActionable p o => Int -> NodeSequence g p o a -> g -> p -> p
- getPerception :: Monad m => NodeSequenceT g p o m p
- setPerception :: Monad m => p -> NodeSequenceT g p o m ()
- tellOutput :: Monad m => o -> NodeSequenceT g p o m ()
- getGenerator :: Monad m => NodeSequenceT g p o m g
- setGenerator :: Monad m => g -> NodeSequenceT g p o m ()
Documentation
class SelfActionable p o where Source #
Instances
SelfActionable a (a -> a) Source # | |
Defined in Smarties.Base |
reduce :: SelfActionable p o => [o] -> p -> p Source #
reduce a list of actions and apply it the perception
newtype NodeSequenceT g p o m a Source #
NodeSequenceT | |
|
Instances
MonadTrans (NodeSequenceT g p o) Source # | |
Defined in Smarties.Base lift :: Monad m => m a -> NodeSequenceT g p o m a # | |
Monad m => Monad (NodeSequenceT g p o m) Source # | note this looks a lot like (StateT (g,p) Writer o) but has special functionality built in on FAIL note, I'm pretty sure this does not satisfy monad laws |
Defined in Smarties.Base (>>=) :: NodeSequenceT g p o m a -> (a -> NodeSequenceT g p o m b) -> NodeSequenceT g p o m b # (>>) :: NodeSequenceT g p o m a -> NodeSequenceT g p o m b -> NodeSequenceT g p o m b # return :: a -> NodeSequenceT g p o m a # fail :: String -> NodeSequenceT g p o m a # | |
(Functor m, Monad m) => Functor (NodeSequenceT g p o m) Source # | it's possible to do this without Monad m restriction, but reusing >>= is better |
Defined in Smarties.Base fmap :: (a -> b) -> NodeSequenceT g p o m a -> NodeSequenceT g p o m b # (<$) :: a -> NodeSequenceT g p o m b -> NodeSequenceT g p o m a # | |
(Applicative m, Monad m) => Applicative (NodeSequenceT g p o m) Source # | it's possible to do this without Monad m restriction, but reusing >>= is better |
Defined in Smarties.Base pure :: a -> NodeSequenceT g p o m a # (<*>) :: NodeSequenceT g p o m (a -> b) -> NodeSequenceT g p o m a -> NodeSequenceT g p o m b # liftA2 :: (a -> b -> c) -> NodeSequenceT g p o m a -> NodeSequenceT g p o m b -> NodeSequenceT g p o m c # (*>) :: NodeSequenceT g p o m a -> NodeSequenceT g p o m b -> NodeSequenceT g p o m b # (<*) :: NodeSequenceT g p o m a -> NodeSequenceT g p o m b -> NodeSequenceT g p o m a # | |
(RandomGen g, Monad m) => MonadRandom (NodeSequenceT g p o m) Source # | |
Defined in Smarties.Base getRandomR :: Random a => (a, a) -> NodeSequenceT g p o m a # getRandom :: Random a => NodeSequenceT g p o m a # getRandomRs :: Random a => (a, a) -> NodeSequenceT g p o m [a] # getRandoms :: Random a => NodeSequenceT g p o m [a] # | |
(Applicative m, Monad m) => Alternative (NodeSequenceT g p o m) Source # | |
Defined in Smarties.Base empty :: NodeSequenceT g p o m a # (<|>) :: NodeSequenceT g p o m a -> NodeSequenceT g p o m a -> NodeSequenceT g p o m a # some :: NodeSequenceT g p o m a -> NodeSequenceT g p o m [a] # many :: NodeSequenceT g p o m a -> NodeSequenceT g p o m [a] # |
execNodeSequenceT :: Monad m => NodeSequenceT g p o m a -> g -> p -> m (g, p, Status, [o]) Source #
run a node sequence tossing its monadic output output is ordered from RIGHT to LEFT i.e. foldr when applying
execNodeSequenceTimesT :: (SelfActionable p o, Monad m) => Int -> NodeSequenceT g p o m a -> g -> p -> m (g, p, Status, [o]) Source #
run a node sequence several times using its output to generate the next perception state
execNodeSequenceTimesFinalizeT :: (SelfActionable p o, Monad m) => Int -> NodeSequenceT g p o m a -> g -> p -> m p Source #
same as runNodeSequenceTequenceTimes except reduces the final input with its output and only returns this result
type NodeSequence g p o a = NodeSequenceT g p o Identity a Source #
has the exact same interface as the one in Smarties.Base
runNodeSequence :: NodeSequence g p o a -> g -> p -> (a, g, p, Status, [o]) Source #
execNodeSequence :: NodeSequence g p o a -> g -> p -> (g, p, Status, [o]) Source #
execNodeSequenceTimes :: SelfActionable p o => Int -> NodeSequence g p o a -> g -> p -> (g, p, Status, [o]) Source #
execNodeSequenceTimesFinalize :: SelfActionable p o => Int -> NodeSequence g p o a -> g -> p -> p Source #
getPerception :: Monad m => NodeSequenceT g p o m p Source #
returns the perception state
setPerception :: Monad m => p -> NodeSequenceT g p o m () Source #
sets the perception state
tellOutput :: Monad m => o -> NodeSequenceT g p o m () Source #
add to output
getGenerator :: Monad m => NodeSequenceT g p o m g Source #
returns the generator
setGenerator :: Monad m => g -> NodeSequenceT g p o m () Source #
set the generator in the monad
helpers for building NodeSequence in Monad land