[GHC] #5927: A type-level "implies" constraint on Constraints

GHC ghc-devs at haskell.org
Sat Aug 20 21:38:44 UTC 2016


#5927: A type-level "implies" constraint on Constraints
-------------------------------------+-------------------------------------
        Reporter:  illissius         |                Owner:
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler (Type    |              Version:  7.4.1
  checker)                           |
      Resolution:                    |             Keywords:
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 Iceland_jack):

 Would this `Show` instance for
 [https://www.reddit.com/r/haskell/comments/2ag8h2/recovering_preconditions_from_dataconstraint/civ9tm2
 Fmt] work with `ImplicationConstraints` (`(=>) :: Constraints ->
 Constraints -> Constraints`):

 {{{#!hs
 data Fmt :: (* -> Constraint) -> (* -> *) -> * -> * where
   Int  :: p Int               => Fmt p r Int
   (:&) :: (p a, p b, p (a,b)) => Fmt p r a -> Fmt p r b -> Fmt p r (a,b)
   Lift :: p (r a)             => r a       -> Fmt p r a

 instance (p => Show) => (Show (Fmt ctx r a) where
   show t = case t of
              Int    -> "Int"
              l :& r -> show l ++ "&" ++ show r
              Lift r -> show r
 }}}

 A question on `QuantifiedConstraints` on this same example in
 ticket:2893#comment18.

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


More information about the ghc-tickets mailing list