[clean-list] Type Expression Grammar question

Pieter Koopman pieter at cs.ru.nl
Mon Nov 5 08:36:49 MET 2007


Dear Jigang,

At 11:32 PM 11/2/2007, Jigang Sun wrote:
>I cannot see a function type
>
>myFunc :: Int -> Int -> Int // there are more than one "->"
>
>is accepted. Because in TypeExpr, "->"  must be placed between a 
>pair of parenthesises like (Int -> Int).

There is no problem with a function of type Int -> Int -> Int. This 
has to be understood as Int -> (Int -> Int), a function that accepts 
an integer and yields a function that accepts an integer and yields 
an integer. A simple example:

increment :: Int -> Int -> Int
increment n = (+) n

Start = increment 2 3

This program yields 5.

Have fun,

Pieter Koopman 



More information about the clean-list mailing list