I am learning Haskell and trying to use exact Rational numbers. I have the the following simple Haskell code:
import Ratio
x :: Rational
x = 5 % 2
When I load this in WinHugs, everything is fine. However, when I load it in ghci, I get the following error message:
E:\devel\src\haskell\rational.hs:1:8:
Could not find module `Ratio' It is a member of the hidden package `haskell98-2.0.0.1'. Use -v to see a list of the files searched for.
Failed, modules loaded: none.
Why am I getting this error?
Also, all the hits google gives me for rational numbers in Haskell seem to be out of date. What is the current way to do exact arithmetic with rational numbers?
The
haskell98
library is deprecated in the Haskell Platform. You should adapt to thehaskell2010
standard, which defines rational numbers to be inData.Ratio
.