import Data.Bifunctor
import Data.Ratio
import Roll
import Roll.Internal

type Dice = Rolls Int

d :: Int -> Int -> Dice
d 1 f = Rolls $!map (\x -> Roll x ((%) 1 (fromIntegral f))) [1 .. f]
d n f
  | even n = simplify $! mixFmap (+) ((n `div` 2) `d` f) ((n `div` 2) `d` f)