[Haskell-cafe] lifting restrictions on defining instances

David Menendez dave at zednenem.com
Thu Jul 23 22:14:57 EDT 2009


On Thu, Jul 23, 2009 at 9:01 PM, wren ng thornton<wren at freegeek.org> wrote:
> John Lask wrote:
>>
>> Can anyone explain the theoretical reason for this limitation, ie other
>> than it is a syntactical restriction, what would it take to lift this
>> restriction ?
>
> There are a couple of theoretical concerns, mainly that full type-level
> lambdas can lead down a rocky path (though simple combinators like `flip`
> and `const` are fine, and that's all we'd need for most cases). But by and
> large it's just a syntactic restriction.

I wouldn't say it's "just" a syntactic restriction. I'm pretty sure
unrestricted type lambdas are incompatible with Haskell's class
system. Otherwise, you might end up with Functor instances for /\b.
(a,b) and /\a. (a,b), at which point fmap (+1) (1,2) is ambiguous.

-- 
Dave Menendez <dave at zednenem.com>
<http://www.eyrie.org/~zednenem/>


More information about the Haskell-Cafe mailing list