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
Haskell code question data MyRational = Frac Integer Integer -- Given integers n and d, create a new rational with n as
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am