[GHC] #11715: Constraint vs *

GHC ghc-devs at haskell.org
Mon Aug 22 13:24:30 UTC 2016


#11715: Constraint vs *
-------------------------------------+-------------------------------------
        Reporter:  bgamari           |                Owner:
            Type:  bug               |               Status:  new
        Priority:  high              |            Milestone:  8.2.1
       Component:  Compiler (Type    |              Version:  8.0.1-rc1
  checker)                           |
      Resolution:                    |             Keywords:  Typeable
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by int-index):

 I find pretending that `Int` is a constraint to be quite appealing,
 actually: it elevates the intuition that `=>` is like `->`, only implicit.

 The current design of `ImplicitParameters` will be easily expressible on
 top of this new feature with `(?param :: T) => t` desugaring into `Tagged
 "param" T =>` at type level and `?cmp` desugaring into `unTagged @"param"
 reflect` at term level.

 To sum it up, making `Type ~ Constraint` unifies/simplifies:

 * The `Dict` wrapper
 * `Typeable` & type-indexed `TypeRep`
 * `Given`-style and `Reifies`-style reflection
 * `-XImplicitParameters`

 To me, this kind of simplification is far from "distasteful". Meanwhile, I
 agree with issue (1) from comment:31 and we should certainly document to
 what problems `incoherentWith` leads, and actively discourage its
 incorrect use. I wouldn't be happy if people started using it to model
 implicits from Scala (which are basically incoherent type classes). It's
 still a useful function to have, though.

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


More information about the ghc-tickets mailing list