Common.hs 480 B

1234567891011121314151617181920212223
  1. {-# LANGUAGE ExistentialQuantification #-}
  2. module Rolling.Common (Diagram (..), Prob, Result (..), normalize, die) where
  3. import Rolling.Prob
  4. data Diagram = forall a.
  5. Diagram
  6. { title :: String,
  7. filename :: String,
  8. rolls :: a,
  9. render :: String -> String -> a -> IO ()
  10. }
  11. die :: Int -> Prob Int
  12. die n = Prob [(d, P 1 n) | d <- [1 .. n]]
  13. -- the success metric for vaguely PbtA-ish games
  14. data Result
  15. = Success
  16. | Partial
  17. | Failure
  18. deriving (Eq, Show, Ord)