Haskell "Could not load interface" after changing directory

After installing ghc, I changed the working directory to

:cd /newDirectory

For this, I get a warning:

Warning: changing directory causes all loaded modules to be unloaded,
because the search path has changed.

Now I can’t use a data type like Char. For this line:

map Char.isLower "abcD"

I get a message:

Failed to load interface for `Char'
It is a member of the hidden package `haskell98-2.0.0.2'.
Use -v to see a list of the files searched for.

Is a directory change causing this error? How can I solve it?

+4
source share
1 answer

You are looking for a module (not a data type) Data.Charthat defines isLower:

Prelude> map Data.Char.isLower "abcD"
[True,True,True,False]

You can also leave it loaded in GHCi, so you do not need to specify a module every time you use its functions:

Prelude> :m +Data.Char
Prelude Data.Char> map isLower "abcD"
[True,True,True,False]
+6
source

All Articles