 | Smart constructor for divide
divide :: AST' Text -> AST' Text -> AST' Text
divide (ULiteral x') (ULiteral y') = ULiteral (go x' y')
  where go :: Literal' -> Literal' -> Literal'
        go (Nat  x) (Nat  y) = Prob (x % y)
        go x        y        = Real (litToRat x / litToRat y)

        litToRat :: Literal' -> Rational
        litToRat (Nat  x) = toRational x
        litToRat (Int  x) = toRational x
        litToRat (Prob x) = toRational x
        litToRat (Real x) = toRational x
d
divide :: AST' Text -> AST' Text -> AST' Text
divide (ULiteral x') (ULiteral y') = ULiteral (go x' y')
  where go :: Literal' -> Literal' -> Literal'
        go (Nat  x) (Nat  y) = Prob (x % y)
        go x        y        = Real (litToRat x / litToRat y)

        litToRat :: Literal' -> Rational
        litToRat (Nat  x) = toRational x
        litToRat (Int  x) = toRational x
        litToRat (Prob x) = toRational x
        litToRat (Real x) = toRational x
divide (ULiteral x') (ULiteral y') = ULiteral (go x' y')
  where go :: Literal' -> Literal' -> Literal'
        go (Nat  x) (Nat  y) = Prob (x % y)
        go x        y        = Real (litToRat x / litToRat y)

        litToRat :: Literal' -> Rational
        litToRat (Nat  x) = toRational x
        litToRat (Int  x) = toRational x
        litToRat (Prob x) = toRational x
        litToRat (Real x) = toRational x