module Math.RandomTree.Types where
import Control.Monad.Reader
import Control.Monad.State
import Control.Applicative
import Control.Monad.Trans.Maybe
--Cabal
import Control.Monad.Random
data TreeState a = TreeState { size :: Int }
data TreeConfig = TreeConfig { maxSize :: Int
, minSize :: Int
, minChildren :: Int
, maxChildren :: Int }
newtype ReaderStateRandom a = ReaderStateRandom
{ runReaderStateRandom :: ReaderT TreeConfig (StateT (TreeState Int) (MaybeT (Rand StdGen))) a }
deriving ( Functor
, Applicative
, Monad
, MonadPlus
, MonadRandom
, MonadState (TreeState Int)
, MonadReader TreeConfig )
instance Alternative ReaderStateRandom where
(<|>) = mplus
empty = mzero