How to fix DatatypeContexts?

Brandon Allbery allbery.b at gmail.com
Thu Jul 18 16:11:58 CEST 2013


On Thu, Jul 18, 2013 at 9:58 AM, harry <voldermort at hotmail.com> wrote:

> Which brings me back to my original question - is there any way that the
> type system could be enhanced, so that the compiler "understands" that Bar
> f
> => Foo f without being told so explicitly every time?
>

No. The point is, it's not simply a type annotation; it's a *value* (a
dictionary) that must be carried along with the rest of the value somehow.
The compiler can't always work out statically which instances need to be
used with the affected value, so it has to be available at run time; the
context is effectively declaring that the run-time dictionary is a required
extra parameter. And it wouldn't really be workable for some types to
secretly imply that extra parameter and others not.

-- 
brandon s allbery kf8nh                               sine nomine associates
allbery.b at gmail.com                                  ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20130718/27a2ae68/attachment.htm>


More information about the Glasgow-haskell-users mailing list