The Haskell Ratio Library can be imported into a Haskell script by including the statement
import Ratio
at the top of the script. This library supports type Rational
.
A value of type Rational
can be produced by applying the
binary operator %
to two Integer
s.
For example, the expression 4 % 6
will produce the rational
number that is the result of dividing 4
by 6
.
Ratio
Using Haskell, produce an infinite list of all of the rational numbers between zero and one. Each value should occur exactly once in the list. You are free to produce the rational numbers in any order.
You should print the following results:
4%17
In this and other programming assignments, at least half your grade will depend on the clarity, simplicity and organization of your code, including the documentation (usually in the form of comments).