[GHC] #9819: Create typesafe method of obtaining dictionary types from class definitions, and constraint objects from dictionary types
GHC
ghc-devs at haskell.org
Mon Nov 24 20:08:24 UTC 2014
#9819: Create typesafe method of obtaining dictionary types from class
definitions, and constraint objects from dictionary types
-------------------------------------+-------------------------------------
Reporter: | Owner:
spacekitteh | Status: new
Type: feature | Milestone:
request | Version:
Priority: normal | Keywords:
Component: Compiler | Architecture: Unknown/Multiple
Resolution: | Difficulty: Moderate (less
Operating System: | than a day)
Unknown/Multiple | Blocked By:
Type of failure: | Related Tickets:
None/Unknown |
Test Case: |
Blocking: |
Differential Revisions: |
-------------------------------------+-------------------------------------
Comment (by goldfire):
OK -- so it seems you want to be able to fuzz the `*`/`Constraint`
distinction. That is, for example, make explicit dictionaries of `Show`
and pass them as parameters to functions with a declared `Show`
constraint. Another way to think about this is that you want the ability
to define local instances, much like what is done in that blog post. The
problem here is that local instances threaten coherence properties. Local
instances are really useful, but I think a fair amount of design work
needs to be done to integrate local instances with Haskell.
Or, simply to automate building `Def` instances, I would suggest Template
Haskell. Without a general plan toward local instances, it seems too
specific to bake in deriving `Def` instances into GHC, when it can easily
be done with TH.
[https://groups.google.com/forum/#!msg/haskell-
cafe/JR8qd6RBKW4/xDcdtmuE9gsJ This haskell-cafe thread] may be of
interest. It explores some of this design space.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9819#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list