[GHC] #13592: Newtype type class with compiler generated instances
GHC
ghc-devs at haskell.org
Wed Apr 19 16:33:22 UTC 2017
#13592: Newtype type class with compiler generated instances
-------------------------------------+-------------------------------------
Reporter: Iceland_jack | Owner: (none)
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.1
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):
In a way it's a subset of `Coercible` but I don't know if there is any way
to specify that more forcefully than ''default signatures''.. a
`Coercible` superclass '''might''' work if we use fundeps
{{{#!hs
class (Coercible on n, Coercible n on) => Newtype n on | n -> on where
}}}
or
{{{#!hs
class (Coercible (O n) n, Coercible n (O n)) => Newtype n where
type O n
pack :: O n -> n
pack = coerce
unpack :: n -> O n
unpack = coerce
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13592#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list