[Haskell-beginners] function defenition. Do I understand it right?
Ozgur Akgun
ozgurakgun at gmail.com
Tue Jul 12 16:05:11 CEST 2011
Hi,
On 12 July 2011 16:15, Brent Yorgey <byorgey at seas.upenn.edu> wrote:
> This message is just because it cannot figure out the type of [] in
> 'putStrLn $ show $ halve []'. You can write
>
> putStrLn $ show $ halve ([] :: [Int])
>
> to give it an explicit type. It's a bit annoying since we happen to
> know that the type of the list makes no difference, but the compiler
> can't figure that out.
>
Actually, the type of the list does make a difference due to different show
instances. Try:
putStrLn $ show $ halve ([] :: [Char])
Cheers,
Ozgur
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20110712/29ef43c8/attachment.htm>
More information about the Beginners
mailing list