
#14362: Allow: Coercing (a:~:b) to (b:~:a) -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 Resolution: | Keywords: roles 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): A user defined type with "no represented value arguments" could generate an `Underlying` type instance {{{#!hs type Cat obj = obj -> obj -> Type data LessThanEq :: Cat Nat where LessThanEq :: a <= b => LessThanEq a b data GreaterThanEq :: Cat Nat where GreaterThanEq :: a >= b => GreaterThanEq a b type instance Underlying (LessThanEq a b) = a <= b type instance Underlying (GreaterThanEq a b) = a => b }}} So depending how smart our constraint solver is, we can coerce {{{#!hs coerce :: LessThanEq a b -> LessThanEq a (10 + b) coerce :: LessThanEq a b -> GreaterThanEq b a }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14362#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler