reinforce-0.0.0.1: Reinforcement learning in Haskell

Copyright(c) Sentenai 2017
LicenseBSD3
Maintainersam@sentenai.com
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Data.Logger

Description

In lieu of a history monad embedded in models maintain a logger monad for easily debugging environments.

Synopsis

Documentation

data Event r o a Source #

Our primary datatype for an event in a trace. Contains the episode number, reward, state, and action taken (in that order). TODO: change the ordering to Event Integer s a r

Constructors

Event Integer r o a 

Instances

MonadWriter (DList Event) Environment # 
Monad t => MonadWriter (DList (Event Reward s a)) (GymEnvironmentT s a t) # 

Methods

writer :: (a, DList (Event Reward s a)) -> GymEnvironmentT s a t a #

tell :: DList (Event Reward s a) -> GymEnvironmentT s a t () #

listen :: GymEnvironmentT s a t a -> GymEnvironmentT s a t (a, DList (Event Reward s a)) #

pass :: GymEnvironmentT s a t (a, DList (Event Reward s a) -> DList (Event Reward s a)) -> GymEnvironmentT s a t a #

(Show a, Show o, Show r) => Show (Event r o a) Source # 

Methods

showsPrec :: Int -> Event r o a -> ShowS #

show :: Event r o a -> String #

showList :: [Event r o a] -> ShowS #

class Monad m => Logger m where Source #

A logging monad, this is seperate from a History monad in that this is intended to be used for debugging and for toggling log information.

FIXME: In reality, this is halfway between commenting/uncommenting print statements, and passing CPP flags. Something should be done about this or a real logging Monad should be brought in.

Minimal complete definition

info, info_, debug, debug_

Methods

info :: Text -> m () Source #

log at the info level.

info_ :: Text -> Text -> m () Source #

log at the info level, appending information on the left.

debug :: Text -> m () Source #

log at the debug level.

debug_ :: Text -> Text -> m () Source #

log at the debug level, appending information on the left.

Instances

Logger IO Source # 

Methods

info :: Text -> IO () Source #

info_ :: Text -> Text -> IO () Source #

debug :: Text -> IO () Source #

debug_ :: Text -> Text -> IO () Source #

Logger ClientM Source # 

Methods

info :: Text -> ClientM () Source #

info_ :: Text -> Text -> ClientM () Source #

debug :: Text -> ClientM () Source #

debug_ :: Text -> Text -> ClientM () Source #

Logger m => Logger (MWCRandT m) Source # 

Methods

info :: Text -> MWCRandT m () Source #

info_ :: Text -> Text -> MWCRandT m () Source #

debug :: Text -> MWCRandT m () Source #

debug_ :: Text -> Text -> MWCRandT m () Source #

Monad m => Logger (DebugLogger m) Source # 
Monad m => Logger (NoopLogger m) Source # 

Methods

info :: Text -> NoopLogger m () Source #

info_ :: Text -> Text -> NoopLogger m () Source #

debug :: Text -> NoopLogger m () Source #

debug_ :: Text -> Text -> NoopLogger m () Source #

Logger m => Logger (StateT s m) Source # 

Methods

info :: Text -> StateT s m () Source #

info_ :: Text -> Text -> StateT s m () Source #

debug :: Text -> StateT s m () Source #

debug_ :: Text -> Text -> StateT s m () Source #

(Logger m, Monoid w) => Logger (RWST r w s m) Source # 

Methods

info :: Text -> RWST r w s m () Source #

info_ :: Text -> Text -> RWST r w s m () Source #

debug :: Text -> RWST r w s m () Source #

debug_ :: Text -> Text -> RWST r w s m () Source #

newtype NoopLogger m x Source #

A prebuilt type which doesn't actually log anything.

Constructors

NoopLogger 

Fields

Instances

Monad m => Monad (NoopLogger m) Source # 

Methods

(>>=) :: NoopLogger m a -> (a -> NoopLogger m b) -> NoopLogger m b #

(>>) :: NoopLogger m a -> NoopLogger m b -> NoopLogger m b #

return :: a -> NoopLogger m a #

fail :: String -> NoopLogger m a #

Functor m => Functor (NoopLogger m) Source # 

Methods

fmap :: (a -> b) -> NoopLogger m a -> NoopLogger m b #

(<$) :: a -> NoopLogger m b -> NoopLogger m a #

Applicative m => Applicative (NoopLogger m) Source # 

Methods

pure :: a -> NoopLogger m a #

(<*>) :: NoopLogger m (a -> b) -> NoopLogger m a -> NoopLogger m b #

(*>) :: NoopLogger m a -> NoopLogger m b -> NoopLogger m b #

(<*) :: NoopLogger m a -> NoopLogger m b -> NoopLogger m a #

MonadIO m => MonadIO (NoopLogger m) Source # 

Methods

liftIO :: IO a -> NoopLogger m a #

MonadThrow m => MonadThrow (NoopLogger m) Source # 

Methods

throwM :: Exception e => e -> NoopLogger m a #

Monad m => Logger (NoopLogger m) Source # 

Methods

info :: Text -> NoopLogger m () Source #

info_ :: Text -> Text -> NoopLogger m () Source #

debug :: Text -> NoopLogger m () Source #

debug_ :: Text -> Text -> NoopLogger m () Source #

MonadEnv m s a r => MonadEnv (NoopLogger m) s a r Source # 

Methods

reset :: NoopLogger m (Initial s) Source #

step :: a -> NoopLogger m (Obs r s) Source #

newtype DebugLogger m x Source #

A prebuilt type that does all levels of logging

Constructors

DebugLogger 

Fields

Instances

Monad m => Monad (DebugLogger m) Source # 

Methods

(>>=) :: DebugLogger m a -> (a -> DebugLogger m b) -> DebugLogger m b #

(>>) :: DebugLogger m a -> DebugLogger m b -> DebugLogger m b #

return :: a -> DebugLogger m a #

fail :: String -> DebugLogger m a #

Functor m => Functor (DebugLogger m) Source # 

Methods

fmap :: (a -> b) -> DebugLogger m a -> DebugLogger m b #

(<$) :: a -> DebugLogger m b -> DebugLogger m a #

Applicative m => Applicative (DebugLogger m) Source # 

Methods

pure :: a -> DebugLogger m a #

(<*>) :: DebugLogger m (a -> b) -> DebugLogger m a -> DebugLogger m b #

(*>) :: DebugLogger m a -> DebugLogger m b -> DebugLogger m b #

(<*) :: DebugLogger m a -> DebugLogger m b -> DebugLogger m a #

MonadIO m => MonadIO (DebugLogger m) Source # 

Methods

liftIO :: IO a -> DebugLogger m a #

MonadThrow m => MonadThrow (DebugLogger m) Source # 

Methods

throwM :: Exception e => e -> DebugLogger m a #

Monad m => Logger (DebugLogger m) Source # 
MonadEnv m s a r => MonadEnv (DebugLogger m) s a r Source # 

Methods

reset :: DebugLogger m (Initial s) Source #

step :: a -> DebugLogger m (Obs r s) Source #