|
![](/i/fill.gif) |
Orchid XP v8 wrote:
> Ah, but wait! The exact way you decompose the expression and apply the
> unification process dictate what result you get. In the process of
> crawling through this stuff, I discovered things I never even realised
> about Haskell's type system. For example...
>
> (foo 1, foo 'x')
>
> If "foo" is a top-level variable, this expression might be well-typed.
> ("Might" depending on what type signature foo has, obviously.) However,
> if "foo" is a local variable, then the above expression is *guaranteed*
> to be ill-typed.
>
> Stop and think about that for a moment: Where a variable is bound
> determins whether this expression is well-typed or not. That should tell
> you that something pretty subtle is going on here!
>
> I never realised this, but look:
Awesome. On further investigation, it turns out my understanding of
Haskell's type system is actually incorrect. And, unsurprisingly, my
program is incorrect too; it rejects expressions that it should actually
accept.
Nice to know I understand my own favourit programming language, eh? :-}
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
![](/i/fill.gif) |