[Haskell-beginners] Error message: "Couldn't match expected type"

S. H. Aegis shaegis at gmail.com
Thu Oct 2 16:55:40 UTC 2014


Oh... my...
Thank you so much.
Maybe, I'm confused with C.
Fix main() to main, it works! =)
Thank you again, and have a nice day.

Sincerely, Sok

2014-10-03 1:49 GMT+09:00 Brandon Allbery <allbery.b at gmail.com>:

> On Thu, Oct 2, 2014 at 12:40 PM, S. H. Aegis <shaegis at gmail.com> wrote:
>
>> main() =
>
>
> You have declared (well, described, but by type inference that's the same
> thing) main to take a parameter of type "unit" (empty tuple). main doesn't
> take parameters.
>
> Haskell parameters do not work the way most common languages do; using
> parentheses in function calls the way you would in C/Java/Python etc. will
> generally get you unexpected type errors, because you're telling it you're
> passing tuples around. So, the function call
>
>     f()    (f :: () -> a)
>
> is different from
>
>     f    (f :: a)
>
> and the function call
>
>     f(a, b)    (f :: (a,b) -> c)
>
> is different from
>
>     f a b    (f :: a -> b -> c)
>
> (The inferred type of `f` is shown after each call.)
>
> --
> brandon s allbery kf8nh                               sine nomine
> associates
> allbery.b at gmail.com
> ballbery at sinenomine.net
> unix, openafs, kerberos, infrastructure, xmonad
> http://sinenomine.net
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
>


-- 
Sok Ha, CHANG
Dr. Chang's Clinic. #203. 503-23. AmSa-Dong, GangDong-Gu, Seoul.
Tel: +82-2-442-7585
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20141003/ff3eadfa/attachment.html>


More information about the Beginners mailing list