Learning from scratch

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

Learning from scratch

Xavier Elizalde
I'm just starting to learn Haskell from scratch and I've just hit a  
snag. The book "Haskell: The Craft of Functional Programming, Second  
Edition" uses some examples that call functions from Prelude.hs. But  
for some reason, two installations of Haskell that I have on my  
computer don't have the functions available. I have the OS X version  
of Hugs (http://www.haskell.org/soe/software.htm) for the book "The  
Haskell School of Expression" installed, as well as the latest  
version of the Glasgow Haskell Compiler. Both of them get errors with  
the functions such as "ord" and "chr" mentioned at the beginning of  
the first book mentioned. Where can I get Prelude.hs and the other  
files it needs, and what do I do with them? I'm going to move on to  
the School of Expression book after the Craft of Functional  
Programming book, which is why I have the SOE version of hugs installed.
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Learning from scratch

Jared Updike
For GHC try adding the line

import Data.Char

or

import Char

at the top of your Haskell program. Or in ghci, try Char.chr instead
of chr, etc. Or try
  ghci filename.hs
where filename.hs is a text file with the line "import Char" at the
top. Now 'chr' should appear in scope.

The hierarchical libraries are listed here:
   http://haskell.org/ghc/docs/latest/html/libraries/ (scroll down to
see all the modules listed)
You can search for functions here, e.g.:
    http://haskell.org/hoogle/?q=chr

Good luck,
  Jared.

On 3/15/06, Xavier Elizalde <[hidden email]> wrote:

> I'm just starting to learn Haskell from scratch and I've just hit a
> snag. The book "Haskell: The Craft of Functional Programming, Second
> Edition" uses some examples that call functions from Prelude.hs. But
> for some reason, two installations of Haskell that I have on my
> computer don't have the functions available. I have the OS X version
> of Hugs (http://www.haskell.org/soe/software.htm) for the book "The
> Haskell School of Expression" installed, as well as the latest
> version of the Glasgow Haskell Compiler. Both of them get errors with
> the functions such as "ord" and "chr" mentioned at the beginning of
> the first book mentioned. Where can I get Prelude.hs and the other
> files it needs, and what do I do with them? I'm going to move on to
> the School of Expression book after the Craft of Functional
> Programming book, which is why I have the SOE version of hugs installed.
> _______________________________________________
> Haskell-Cafe mailing list
> [hidden email]
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>

--
http://www.updike.org/~jared/
reverse ")-:"
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe