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 # |
Methods fmap :: (a -> b) -> Expr a -> Expr b # (<$) :: a -> Expr b -> Expr a #
Show a => Show (Expr a) Source # |
Methods showsPrec :: Int -> Expr a -> ShowS # show :: Expr a -> String # showList :: [Expr a] -> ShowS #

foldExpr :: (String -> t1 -> t) -> (t -> t -> t) -> (t -> t -> t) -> (t -> t -> t) -> (t -> t -> t) -> Expr t1 -> t 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 a1 -> Expr a -> b) -> Expr (m a1) -> Expr (m a) -> 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 :: (Eq a, Num a1, Num a, Ord a1, Show a) => a1 -> Ratio a -> 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 #