smarties-1.2.1: Haskell Behavior Tree Library

Copyright(c) Peter Lu 2018
LicenseGPL-3
Maintainerchippermonky@gmail.com
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Smarties.Base

Description

 
Synopsis

Documentation

class SelfActionable p o where Source #

Methods

apply :: o -> p -> p Source #

Instances
SelfActionable a (a -> a) Source # 
Instance details

Defined in Smarties.Base

Methods

apply :: (a -> a) -> a -> a Source #

reduce :: SelfActionable p o => [o] -> p -> p Source #

reduce a list of actions and apply it the perception

data Status Source #

Constructors

SUCCESS 
FAIL 
Instances
Eq Status Source # 
Instance details

Defined in Smarties.Base

Methods

(==) :: Status -> Status -> Bool #

(/=) :: Status -> Status -> Bool #

Show Status Source # 
Instance details

Defined in Smarties.Base

newtype NodeSequenceT g p o m a Source #

Constructors

NodeSequenceT 

Fields

Instances
MonadTrans (NodeSequenceT g p o) Source # 
Instance details

Defined in Smarties.Base

Methods

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

Instance details

Defined in Smarties.Base

Methods

(>>=) :: 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

Instance details

Defined in Smarties.Base

Methods

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

Instance details

Defined in Smarties.Base

Methods

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 # 
Instance details

Defined in Smarties.Base

Methods

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 # 
Instance details

Defined in Smarties.Base

Methods

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 #

 

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