[Haskell-cafe] Actually loading a Cabal package in GHCi
Felipe Lessa
felipe.lessa at gmail.com
Sun Jul 11 13:31:05 EDT 2010
On Sun, Jul 11, 2010 at 2:05 PM, <dlb at patriot.net> wrote:
> OK, I know this is a newbie kind of thing (I guess I am a newbie to GHCi).
> I've been over and over and over the wiki and I just can't find the
> answer to this very, very elementary question. How can I load a package
> that I've downloaded using Cabal into GHCi? When I do the :l, it just
> doesn't see the thing. On one level, this is clear: the downloaded Cabal
> packages (yes, more than one) are under .cabal in $HOME and not in the
> lib/ghc area. OK, fine. But there's no package data base to point to so
> that the packages can be loaded.
>
> This just *has* to be a simple thing, but I just can't find it, no matter
> how flat my head gets beating against the wall. I apologize for the
> density of my skull, but can someone point me in the right direction here?
GHCi automatically loads the package, you just need to put the modules
into scope. This is analogous to using an "import" declaration. For
example:
GHCi, version 6.10.4: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer ... linking ... done.
Loading package base ... linking ... done.
Prelude> :m Data.ByteString.Char8
Prelude Data.ByteString.Char8> pack "hello"
Loading package bytestring-0.9.1.4 ... linking ... done.
"hello"
Prelude Data.ByteString.Char8> pack "hello"
"hello"
So, just put the modules you want into scope with
:m Module1 Module2 ...
or
:m Module1
:m +Module2 Module3
:m +Module4 Module5
That should get you started =).
Cheers,
--
Felipe.
More information about the Haskell-Cafe
mailing list