dice-0.1.1: Simplistic D&D style dice-rolling system.
Safe HaskellNone
LanguageHaskell2010

Data.Random.Dice

Documentation

data Expr a Source #

Constructors

Const String a 
Plus (Expr a) (Expr a) 
Minus (Expr a) (Expr a) 
Times (Expr a) (Expr a) 
Divide (Expr a) (Expr a) 

Instances

Instances details
Functor Expr Source # 
Instance details

Defined in Data.Random.Dice

Methods

fmap :: (a -> b) -> Expr a -> Expr b

(<$) :: a -> Expr b -> Expr a

Show a => Show (Expr a) Source # 
Instance details

Defined in Data.Random.Dice

Methods

showsPrec :: Int -> Expr a -> ShowS

show :: Expr a -> String

showList :: [Expr a] -> ShowS

foldExpr :: (String -> t1 -> t2) -> (t2 -> t2 -> t2) -> (t2 -> t2 -> t2) -> (t2 -> t2 -> t2) -> (t2 -> t2 -> t2) -> Expr t1 -> t2 Source #

evalExprWithDiv :: (Num a, Monad m) => (a -> a -> m a) -> Expr a -> m a Source #

evalFractionalExpr :: (Eq a, Fractional a, MonadError String m) => Expr a -> m a Source #

evalIntegralExpr :: (Integral a, MonadError String m) => Expr a -> m a Source #

commute :: Monad m => (Expr a1 -> Expr a2 -> b) -> Expr (m a1) -> Expr (m a2) -> m b Source #

runExpr :: Monad m => Expr (m a) -> m (Expr a) Source #

fmtIntegralExpr :: (Show a, Integral a) => Expr a -> String Source #

fmtIntegralListExpr :: (Show a, Integral a) => Expr [a] -> String Source #

fmtSimple :: (Integral a, Show a) => Expr [a] -> String Source #

fmtSimpleRational :: Expr [Integer] -> String Source #

showScalarConst :: Show a => String -> a -> p -> String -> String Source #

showListConst :: Show a => String -> a -> p -> String -> String Source #

showSimpleConst :: (Ord a1, Num a1) => (a1 -> a2 -> ShowS) -> p -> [a2] -> a1 -> ShowS Source #

showSimpleListConst :: Show a => String -> [a] -> Int -> ShowS Source #

showSimpleRationalConst :: p -> [Ratio Integer] -> Integer -> ShowS Source #

showError :: Show a => ExceptT String Identity a -> ShowS Source #

showErrorWith :: (t -> ShowS) -> ExceptT String Identity t -> ShowS Source #

showDouble :: Double -> ShowS Source #

showRational :: (Show a1, Ord a2, Num a1, Num a2, Eq a1) => a2 -> Ratio a1 -> ShowS Source #

showRationalWithDouble :: Ratio Integer -> ShowS Source #

fmtExprPrec :: (String -> a -> Int -> ShowS) -> Expr a -> Int -> ShowS Source #

rollEm :: String -> IO (Either ParseError String) Source #

summarizeRollsOver :: Num a => Int -> [a] -> [a] Source #

roll :: (Integral a, UniformRange a) => a -> a -> RVar [a] Source #

parseExpr :: (Integral a, UniformRange a) => String -> String -> Either ParseError (Expr (RVar [a])) Source #

diceLang :: TokenParser st Source #

expr :: (Integral a, UniformRange a) => CharParser Bool (Expr (RVar [a])) Source #

term :: (Integral a, UniformRange a) => CharParser Bool (Expr (RVar [a])) Source #

primExp :: (Integral a, UniformRange a) => CharParser Bool (Expr (RVar [a])) Source #

dieExp :: (Integral a, UniformRange a) => CharParser Bool (Expr (RVar [a])) Source #

numExp :: Num a => CharParser st (Expr (RVar [a])) Source #

number :: CharParser st (String, Integer) Source #

positiveNumber :: CharParser st (String, Integer) Source #