[Haskell-beginners] Type error in sub-function
Kim-Ee Yeoh
ky3 at atamo.com
Wed Jul 23 12:33:56 UTC 2014
On Wed, Jul 23, 2014 at 7:08 PM, 양철웅 <cwyang at aranetworks.com> wrote:
> Since the return type of foo Func is IO String and
> first case statement has "return timedVal",
> I think that ghc expects the type of timedVal as String.
> However, the error message shows that
> ghc expects timedVal should have type IO b0.
>
It's not really about timedVal nor the case 'statement'. (The scare quotes
are because there are only expressions, not statements, in haskell.)
Consider the difference between
do { putStrLn "hello"; True; }
and
do { putStrLn "hello"; return True; }
Which one throws an error and why?
-- Kim-Ee
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20140723/41ab3c89/attachment.html>
More information about the Beginners
mailing list