So it appears that uninstalling and then reinstalling GHC from the Haskell Platform for Mac OSX got it working properly.
Importing Haskell Libraries like System.Random
質問
So I've been searching and searching on how to fix this issue and I've had no luck finding out how.
First of all I want to import System.Random into my Haskell program.
import System.Random
Unfortunately it isn't that easy... When I execute the program in ghci this is what it returns:
Could not find module `System.Random'
Use -v to see a list of the files searched for.
So obviously I do what it says... Same issue except I see what package database it is using:
Using binary package database: /usr/local/Cellar/ghc/7.6.3/lib/ghc-7.6.3/package.conf.d/package.cache
I go to that directory and surprise surprise... My random packages isn't there. I go to my .cabal/packages and copy my random-1.0.1.1 file to the
/usr/local/Cellar/ghc/7.6.3/lib/ghc-7.6.3/
directory where the other packages are. I run the program again and still get the same error. I realize when I look in the ghc-7.6.3/package.conf.d, that there is no file pointing towards the random file within the the lib.
What do I do??
I am desperate. How do I install packages!!!
Also I've tried cabal install but I get a huge error:
Failed to install random-1.0.1.1
Last 10 lines of the build log ( /Users/mikeecb/.cabal/logs/random-1.0.1.1.log ):
cabal: Error: some packages failed to install:
random-1.0.1.1 failed during the configure step. The exception was:
user error (In file included from
/usr/local/Cellar/ghc/7.6.3/lib/ghc-7.6.3/include/Rts.h:30,
from
/var/folders/lw/mwgzrbns2j10_p75xtydr9_r0000gn/T/ghc3806_0/ghc3806_0.c:1:0:
/usr/local/Cellar/ghc/7.6.3/lib/ghc-7.6.3/include/Stg.h:65:18:
error: math.h: No such file or directory
In file included from
/usr/local/Cellar/ghc/7.6.3/lib/ghc-7.6.3/include/Rts.h:32,
from
/var/folders/lw/mwgzrbns2j10_p75xtydr9_r0000gn/T/ghc3806_0/ghc3806_0.c:1:0:
/usr/local/Cellar/ghc/7.6.3/lib/ghc-7.6.3/include/HsFFI.h:30:20:
error: stdint.h: No such file or directory
In file included from
/var/folders/lw/mwgzrbns2j10_p75xtydr9_r0000gn/T/ghc3806_0/ghc3806_0.c:1:0:
/usr/local/Cellar/ghc/7.6.3/lib/ghc-7.6.3/include/Rts.h:190:20:
error: stdlib.h: No such file or directory
In file included from
/usr/local/Cellar/ghc/7.6.3/lib/ghc-7.6.3/include/Rts.h:227,
from
/var/folders/lw/mwgzrbns2j10_p75xtydr9_r0000gn/T/ghc3806_0/ghc3806_0.c:1:0:
/usr/local/Cellar/ghc/7.6.3/lib/ghc-7.6.3/include/rts/Flags.h:17:19:
error: stdio.h: No such file or directory
In file included from
/usr/local/Cellar/ghc/7.6.3/lib/ghc-7.6.3/include/Rts.h:227,
from
/var/folders/lw/mwgzrbns2j10_p75xtydr9_r0000gn/T/ghc3806_0/ghc3806_0.c:1:0:
/usr/local/Cellar/ghc/7.6.3/lib/ghc-7.6.3/include/rts/Flags.h:22:0:
error: expected specifier-qualifier-list before ‘FILE’
/usr/local/Cellar/ghc/7.6.3/lib/ghc-7.6.3/include/rts/Flags.h:188:0:
error: expected specifier-qualifier-list before ‘FILE’
In file included from
/usr/local/Cellar/ghc/7.6.3/lib/ghc-7.6.3/include/Rts.h:234,
from
/var/folders/lw/mwgzrbns2j10_p75xtydr9_r0000gn/T/ghc3806_0/ghc3806_0.c:1:0:
/usr/local/Cellar/ghc/7.6.3/lib/ghc-7.6.3/include/rts/Threads.h:19:23:
error: sys/types.h: No such file or directory
In file included from
/usr/local/Cellar/ghc/7.6.3/lib/ghc-7.6.3/include/Rts.h:234,
from
/var/folders/lw/mwgzrbns2j10_p75xtydr9_r0000gn/T/ghc3806_0/ghc3806_0.c:1:0:
/usr/local/Cellar/ghc/7.6.3/lib/ghc-7.6.3/include/rts/Threads.h:49:0:
error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘forkProcess’
)
解決