[GHC] #9819: Create typesafe method of obtaining dictionary types from class definitions, and constraint objects from dictionary types

GHC ghc-devs at haskell.org
Fri Nov 21 08:02:36 UTC 2014


#9819: Create typesafe method of obtaining dictionary types from class
definitions, and constraint objects from dictionary types
-------------------------------------+-------------------------------------
       Reporter:  spacekitteh        |                   Owner:
           Type:  feature request    |                  Status:  new
       Priority:  normal             |               Milestone:
      Component:  Compiler           |                 Version:
       Keywords:                     |        Operating System:
   Architecture:  Unknown/Multiple   |  Unknown/Multiple
     Difficulty:  Moderate (less     |         Type of failure:
  than a day)                        |  None/Unknown
     Blocked By:                     |               Test Case:
Related Tickets:                     |                Blocking:
                                     |  Differential Revisions:
-------------------------------------+-------------------------------------
 Say I have a class like the following:
 {{{#!hs
 class IntLike a where
     fromInt :: Int -> a
     toInt :: a -> Int
 }}}

 There should be a typesafe, principled way to get the dictionary type
 created from buildClass in compiler/iface/BuildTyCl.lhs like such (in this
 hypothetical, using a type family:

 {{{#!hs
 plusN :: (IntLike a) => Int -> Dictionary (IntLike a)
 }}}

 It would be nice if the type family was injective, if it was implemented
 in such a way.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9819>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list