[Haskell-cafe] Solved but strange error in type inference

Yves Parès limestrael at gmail.com
Wed Jan 4 14:50:20 CET 2012


Yes but as I understood it the type inferer was taking your type annotation
for granted, and apparently in fact it re-specifies it.
What you said was in reality:
> f :: forall. a -> a
> f x = undefined :: forall a1. a1
And it turned it into:
f :: forall. a -> a
f x = undefined :: a
(here, 'a' would be *scoped*)

There's something I don't get...

2012/1/4 Yucheng Zhang <yczhang89 at gmail.com>

> On Wed, Jan 4, 2012 at 9:41 PM, Yves Parès <limestrael at gmail.com> wrote:
> > Would you try:
> >
> > f :: a -> a
> > f x = undefined :: a
> >
> > And tell me if it works? IMO it doesn't.
>
> It works.
>
> As I understand, in this situation we are specializing the 'undefined
> :: forall a. a'
> to a more specific dependent type.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120104/476f278b/attachment.htm>


More information about the Haskell-Cafe mailing list