importing Data.Digits

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

importing Data.Digits

Alexander Chen
Hi All,

This is my first 'post' not quite sure if I am doing it right.

I have a question about the importing of modules that are available on the Hackage.Haskell site:

if I write this in my wordpad and then load it to GCI i get the following error:


chapter4.hs:1:1: error:
    Could not find module ‘Data.Digits’
    Perhaps you meant Data.Bits (from base-4.12.0.0)
    Use -v to see a list of the files searched for.
  |
1 | import Data.Digits   | ^^^^^^^^^^^^^^^^^^


However if I load Data.Char than it loads fine.

What am I doing wrong?

best,

_______________________________________________
Beginners mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: importing Data.Digits

David McBride
This particular module comes from a separate package.  By default all modules you use happen to be in the base package, which ships with ghc.  To use other libraries you must make a proper project which tells ghc which libraries you are using.  For example, the digits package uses this cabal file at http://hackage.haskell.org/package/digits-0.3.1/digits.cabal

You can find more information about how to start a package from scratch here https://www.haskell.org/cabal/users-guide/developing-packages.html

On Mon, Nov 18, 2019 at 7:31 AM Alexander Chen <[hidden email]> wrote:
Hi All,

This is my first 'post' not quite sure if I am doing it right.

I have a question about the importing of modules that are available on the Hackage.Haskell site:

if I write this in my wordpad and then load it to GCI i get the following error:


chapter4.hs:1:1: error:
    Could not find module ‘Data.Digits’
    Perhaps you meant Data.Bits (from base-4.12.0.0)
    Use -v to see a list of the files searched for.
  |
1 | import Data.Digits   | ^^^^^^^^^^^^^^^^^^


However if I load Data.Char than it loads fine.

What am I doing wrong?

best,
_______________________________________________
Beginners mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners

_______________________________________________
Beginners mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners