When you enter an expression exprin GHCi, the following things happen:
- The expression is checked by type. If there is an error, GHCi informs you of the error and refuses.
- Otherwise, let's say it
exprhas a type t; GHC is trying to match twith IO a. - , -
it <- expr, a Show (), print it. - ,
t Show, GHCi - let it = expr, print it. - .
, GHCi IO , , , . GHCi , : , IO, GHCi , , , (.. ()), . , , , , IO; , <-. , , IO, GHCi , , GHCi ( ), .
return "abc" typechecks IO String, String - Show, GHCi -
it <- return "abc"
print it
,
print "abc"
, .