[clean-list] type specification of local functions

erik.zuurbier at tiscali.nl erik.zuurbier at tiscali.nl
Wed Nov 17 10:07:50 MET 2004


>I have a question on adding type specifications to local function
>definitions.
>
[...]>
>Defining the function as:
>
>f  :: [t]  -> Int 
>f xs 
>   = size as 
>where
>   // as :: {t} 
>   as = toArray xs 
>	
>   toArray :: [t] -> {t}
>   toArray xs = { c \\ c <- xs }
>
>works.
>
>Questions:
>- can this situation be solved without introducing an addition function
>toArray?

The following works also. Remarkably it does not without the nested type-specification
f :: [t] -> Int 
f xs
    = size (as xs) 
where
    as :: [t] -> {t}
    as xs = { c \\ c <- xs } 

>- are there plans to remove the restriction one referring to a type
>variable in the type specification of the surrounding function?  Due to
>this restriction it is also not possible to include additional
>strictness or uniqueness information (besides the derived information)
>for such local definitions.

It is when you make all parameters explicit, as xs in as above. But it is
ugly
and I back your request.

Regards Erik Zuurbier

_____________________________________________________________________

Je eigen persoonlijk e-mailadres bij Tiscali? Registreer nu 
een domeinnaam bij Tiscali. Ga naar http://www.tiscali.nl






More information about the clean-list mailing list