Page 1 of 1

Haskell code question data MyRational = Frac Integer Integer -- Given integers n and d, create a new rational with n as

Posted: Tue Jul 12, 2022 8:19 am
by answerhappygod
Haskell code question
data MyRational = Frac Integer Integer
-- Given integers n and d, create a new rational with n as thenumerator and d
-- as the denominator. Trying to create a rational withdenominator 0 is an
-- error. Call the error function to crash the function, e.g.error
-- "makeRational: denominator can't be 0"
makeRational :: Integer -> Integer -> MyRational
--code here