[Haskell-beginners] Invoking ghci with hackage modules

Simon Jakobi simon.jakobi at googlemail.com
Thu Jun 16 15:17:50 UTC 2022


With cabal repl, you can specify dependencies on Hackage with
--build-depends or -b for short, e.g.

    cabal repl --build-depends random

Am Do., 16. Juni 2022 um 05:19 Uhr schrieb Lists0 <lists0 at freea2a.de>:
>
>
> Hi all,
>
> a very basic question, that I cannot solve alone:
> How do I load modules from hackage into ghci ?
> Say, I have a module arrows.hs :
>
> {-# LANGUAGE Arrows #-}
>
> module Main where
> import Control.Arrow
> import Control.Monad
> import qualified Control.Category as Cat
> import Data.List
> import Data.Maybe
> import System.Random
>
>
> I get the error in ghci:
>
> % ghci arrows.hs
> GHCi, version 8.10.6: https://www.haskell.org/ghc/  :? for help
> [1 of 1] Compiling Main             ( arrows.hs, interpreted )
>
> arrows.hs:9:1: error:
>     Could not find module ‘System.Random’
>     Use -v (or `:set -v` in ghci) to see a list of the files searched
> for. |
> 9 | import System.Random
>   | ^^^^^^^^^^^^^^^^^^^^
> Failed, no modules loaded.
> Prelude>
>
>
> System.Random is in the package "random" from hackage, where the other
> modules are in the package base.
>
> I cannot find a solution in the doku that works :-(
>
> Thanks for help!
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners


More information about the Beginners mailing list