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

Haskell: GHCi: it: Special variable stores the result of an expression


Whenever an expression is evaluated at Ghci prompt, GHCi implicitly binds the value to the variable 'it'.
Prelude> 1 + 2 * 3
7
Prelude> it
7
Prelude>
Prelude> "Hello" ++ "World"
"HelloWorld"
Prelude> it
"HelloWorld"
Prelude>


If the evaluation of expression fails, then GHCi don't change the value of the variable 'it'.
Prelude> 1+ 2*3
7
Prelude> it
7
Prelude>
Prelude> 10/-0

<interactive>:36:3:
Not in scope: /-
Perhaps you meant one of these:
- (imported from Prelude), / (imported from Prelude),
/= (imported from Prelude)
Prelude>
Prelude> it
7



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: GHCi: it: Special variable stores the result of an expression

×

Subscribe to Java Tutorial : Blog To Learn Java Programming

Get updates delivered right to your inbox!

Thank you for your subscription

×