dice-0.1: Simplistic D&D style dice-rolling system.

Safe Haskell | None
Language | Haskell98

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

Functor Expr Source |
Show a => Show (Expr a) Source |

foldExpr :: (String -> t -> t1) -> (t1 -> t1 -> t1) -> (t1 -> t1 -> t1) -> (t1 -> t1 -> t1) -> (t1 -> t1 -> t1) -> Expr t -> t1 Source

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

evalFractionalExpr :: (Eq a, Fractional a, Monad m) => Expr a -> m a Source

evalIntegralExpr :: (Integral a, Monad m) => Expr a -> m a Source

commute :: Monad m => (Expr a -> Expr a1 -> b) -> Expr (m a) -> Expr (m a1) -> 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 -> t -> String -> String Source

showListConst :: Show a => String -> a -> t -> String -> String Source

showSimpleConst :: (Num a, Ord a) => (a -> t1 -> ShowS) -> t -> [t1] -> a -> ShowS Source

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

showSimpleRationalConst :: t -> [Ratio Integer] -> Integer -> ShowS Source

showError :: Show a => ErrorT String Identity a -> ShowS Source

showErrorWith :: (t -> ShowS) -> ErrorT String Identity t -> ShowS Source

showDouble :: Double -> ShowS Source

showRational :: (Integral a1, Num a, Ord a, Show a1) => a -> 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 => a -> a -> RVar [a] Source

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

diceLang :: TokenParser st Source

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

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

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

dieExp :: Integral 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