[Haskell-cafe] What's the story of this weird type?

Chris Wong lambda.fairy at gmail.com
Sat Mar 21 08:00:31 UTC 2015


On Sat, Mar 21, 2015 at 1:05 PM, David Feuer <david.feuer at gmail.com> wrote:
>
> On Mar 20, 2015 6:39 PM, "Chris Wong" <lambda.fairy at gmail.com> wrote:
>
>> In this form we can see why your code works that way. This inner
>> function only needs the Functor instances when it is *called*, not
>> when it's constructed. So GHC defers resolving the constraints until
>> the function is used.
>
> Isn't this the same sort of situation that makes DatatypeContexts bad? In
> the GADT version with the constraints pulled outward, we can pattern match
> to get access to the dictionaries. Here, we pattern match to get something
> that demands, but does not use, a constraint. When is this useful?

Yeah on pondering the code, I agree with you that the constraints
aren't very useful there.

-- 
https://lambda.xyz


More information about the Haskell-Cafe mailing list