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

David Feuer david.feuer at gmail.com
Sat Mar 21 00:05:50 UTC 2015


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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20150320/c7cb0526/attachment.html>


More information about the Haskell-Cafe mailing list