Don't mix haskell98 and base in Haskell

2011-11-02

One of my Haskell scripts produced this error on GHC 7.2.1:

    Could not find module `Random'
    It is a member of the hidden package `haskell98-2.0.0.0'.
    Use -v to see a list of the files searched for.

Solution

Instead of

import Random

use

import System.Random

Details

Random comes from now hidden haskell98, System.Random comes from base, and they are different!

… as the APIs in base diverge more and more from those in haskell98, the illusion that you can use both at the same time becomes harder to maintain. For example, the Random class from System.Random is now different from the one in haskell98's Random, so mixing the two doesn't work.

(Simon Marlow)

  1. GHC 7.2 and Haskell 98 discussion
  2. Haskell could not find module `System'