[GHC] #9183: GHC shouldn't expand constraint synonyms

GHC ghc-devs at haskell.org
Wed Jun 11 13:18:07 UTC 2014


#9183: GHC shouldn't expand constraint synonyms
-------------------------------------+------------------------------------
        Reporter:  Feuerbach         |            Owner:
            Type:  feature request   |           Status:  new
        Priority:  normal            |        Milestone:
       Component:  Compiler          |          Version:  7.8.2
      Resolution:                    |         Keywords:
Operating System:  Unknown/Multiple  |     Architecture:  Unknown/Multiple
 Type of failure:  None/Unknown      |       Difficulty:  Unknown
       Test Case:                    |       Blocked By:
        Blocking:                    |  Related Tickets:
-------------------------------------+------------------------------------

Comment (by Feuerbach):

 I just assumed this can be similar to how ghc doesn't expand ordinary type
 synonyms unless necessary, but from what you're saying it sounds like it's
 different for constraints?

 An even more important feature would be to preserve the synonym names in
 type errors. That'd allow to make such errors more domain-specific and
 informative, while an expanded version is very complex and essentially
 reveals a lot of internal details of the library.

 Would it make sense to have something like

 {{{
 newtype MyConstraint (a :: *) = MyConstraint (Show a, Eq a, Num a) ::
 Constraint
 }}}

 or

 {{{
 data MyConstraint (a :: *) = MyConstraint (Show a) (Eq a) (Num a) ::
 Constraint
 }}}

 that wouldn't expand automatically? Just like we can improve the quality
 of error messages in ordinary Haskell by replacing type synonyms with
 newtypes or data types?

 (I don't have a clear vision of how this should work; this is just an
 idea.)

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


More information about the ghc-tickets mailing list