On Sun, Apr 29, 2007 at 07:03:32PM -0500, Antoine Latter wrote: > This looks like a good place to ask a question that's been bugging me for a > bit: > > I've had cases in my own code where I can't seem to create a type annotation > for an "inner" declaration that the type-checker likes. Here's a toy > example: > > In the following code: > > >applyfunc :: (a -> b -> c) -> a -> b -> c > >applyfunc f x y = doit y where > > doit = f x > > What type annotation can I successfully apply to the function "doit"?
There isn't one, plain and simple. However, if you allow GHC extensions, you can: {-# Language ScopedTypeVariables #-} applyfunc :: forall a b c . (a -> b -> c) -> a -> b -> c applyfunc f x y = doit y where doit :: b -> c doit = f x The 'forall' serves no other purpose than to deliberately break haskell 98 compatibility. Stefan _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe