[Haskell-cafe] explicit big lambdas

Max Bolingbroke batterseapower at hotmail.com
Thu Mar 18 13:10:37 EDT 2010


Hi Paul,

You should be able to introduce \Lambda at the source level by writing
a type signature with an explicit "forall". Similarly you can then
instantiate these \Lambdas by using a type signature which is an
instance of the foralled type at the use site:

~~~
-- id will get a \Lambda in Core
id :: forall a. a -> a
id x = x

-- this use of id will have Int applied as the first type argument in Core
main = print $ (id :: Int -> Int) 10
~~~

This *should* extend smoothly to RankNTypes and other situations where
GHC can't do good type inference.

The typechecker doesn't know about big lambdas (they are added to Core
by the desugarer from the output of the typechecker) so there is no
better way to do this AFAIK.

Cheers,
Max


On 18 March 2010 15:07, Paul Brauner <paul.brauner at loria.fr> wrote:
> Hi again,
>
> is there a way in some haskell extension to explicit (system F's) big
> lambdas and (term Type) applications in order to help type inference?
>
> If not: is there a way to provide ghc directly with core code before
> the type checking phase?
>
> Paul
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>


More information about the Haskell-Cafe mailing list