Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Haskell: Prelude module


Haskell imports Prelude Module by default. Prelude module defines most basic functions on Haskell. You can use the functions defined in Prelude module, without importing them.
$ ghci
GHCi, version 7.10.3: http://www.haskell.org/ghc/ :? for help
Prelude>
Prelude> head "abcd"
'a'
Prelude> length "abcd"
4
Prelude> reverse "abcd"
"dcba"

functions like head, Length, reverse are available in Prelude module.

How to disable this automatic import?
Use the command ‘ghci –XnoImplicitPrelude’ to disable Automatic Prelude Import.
$ ghci -XNoImplicitPrelude
GHCi, version 7.10.3: http://www.haskell.org/ghc/ :? for help
>
> head "abcd"

<interactive>:3:1: Not in scope: head
>
> length "abcd"

<interactive>:5:1: Not in scope: length
>


Since you disabled automatic Prelude Import, you are getting above errors while calling head, length functions.





Previous                                                 Next                                                 Home


This post first appeared on Java Tutorial : Blog To Learn Java Programming, please read the originial post: here

Share the post

Haskell: Prelude module

×

Subscribe to Java Tutorial : Blog To Learn Java Programming

Get updates delivered right to your inbox!

Thank you for your subscription

×