[clean-list] where are function type restrictions discussed?

Pieter Koopman pieter at cs.ru.nl
Tue Aug 26 17:39:33 MEST 2008


Hi Terrence,

you guess is quite good. There must be instances of the classes + and 
one for type t where t is the type of the list elements if sumlength is 
applied to a list with some type [t]. This implies that it works fine 
for t = Int, but not for t = Int -> Int (unless you define appropriate 
instances).
Look at page 59-60 of the reference manual, or at page 91 of the Clean 
book (see http://www.st.cs.ru.nl/papers/cleanbook/CleanBookI.pdf).

Best, Pieter Koopman

terrence.brannon wrote:
>
> terrence.brannon wrote:
>   
>>
>> I am confused by the pipe syntax. Where is it fully discussed with
>> examples?
>>
>>
>>     
>
> Here's another example:
>
>     sumlength :: [t] t t -> (t,t) | +, one t
>
> I'm guessing this is saying that both + and one must be applicable to the
> argument of type t
>
> So in some cases it seems to be saying that a certain function must be
> applicable and in other cases it is saying that the datum has to be of a
> certain type.
>
> But I dont know where to find this fully described with examples, so I'm
> sort of hitting in the dark :)
>
>
>
>   


More information about the clean-list mailing list