[Haskell-beginners] ord

allan a.d.clark at ed.ac.uk
Tue Aug 26 05:53:29 EDT 2008


Hi

These are both defined in the module Data.Char, I guess they were in the Prelude when the book was written.

GHCi, version 6.8.3: http://www.haskell.org/ghc/  :? for help
Loading package base ... linking ... done.
Prelude> :m Data.Char
Prelude Data.Char> ord 'a'
97
Prelude Data.Char> chr 97
'a'
Prelude Data.Char> 

Remember you can use hoogle to look up library functions:
http://haskell.org/hoogle/

regards
allan


Paul Johnston wrote:
> Hi
> Using the book by Hutton and in chapter 5 it talks about 'ord' and 'chr'
> being in the standard prelude.
> 
> paulj at opensolaris4:~$ ghci
> GHCi, version 6.8.3: http://www.haskell.org/ghc/  :? for help
> Loading package base ... linking ... done.
> Prelude> ord 3
> 
> <interactive>:1:0: Not in scope: `ord'
> Prelude> chr 67
> 
> <interactive>:1:0: Not in scope: `chr'
> Prelude>
> 
> They seem to do what you would expect from their perl counterparts
> Any ideas?
> 
> Cheers Paul
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
> 


-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.



More information about the Beginners mailing list