[clean-list] a local function typing question in function composition

Arjen van Weelden A.vanWeelden at cs.ru.nl
Thu Apr 12 13:36:56 MEST 2007


The type you specified would be correct except that, due to the scope of 
type variables, `a -> c' does not match the other `a -> c'.

According to the lexical scope rules of Clean, the type variables 'a' 
and 'c' in the type for `h' are different from the 'a' and 'c' in the 
type for `(oo)'. If you let the type checker derive the type for `h' 
automatically it does the right thing. However, by specifying a 
different `a' and `c', the types no longer match.

kind regards,
	Arjen

Jigang Sun wrote:
> What I want to know the type of composition function h.
> Cheers.
> Jigang
> 
> -----Original Message-----
> From: TK <0000tk at gmail.com>
> To: "Jigang Sun" <Jigang.Sun at student.paisley.ac.uk>
> Date: Fri, 6 Apr 2007 22:05:58 +0300
> Subject: Re: [clean-list] a local function typing question in function composition
> 
> Have you tried to remove the type of function h?
> 
> 
> ( oo ) infixr 9 :: ( b -> c ) ( a -> b ) -> ( a -> c )
> ( oo ) g f = h
> where
> //    h :: a -> c
>     h x = g ( f x )
> 
> 
> 
> 
> 
> Legal disclaimer
> --------------------------
> 
> The information transmitted is the property of the University of Paisley and is intended only for the person or entity 
> to which it is addressed and may contain confidential and/or privileged material.  Statements and opinions expressed in this e-mail may not represent those of the company.  Any review, retransmission, dissemination and other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited.
> If you received this in error, please contact the sender immediately and delete the material from any computer. 
> 
> --------------------------
> 
> 
> _______________________________________________
> clean-list mailing list
> clean-list at science.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/clean-list


More information about the clean-list mailing list