[GHC] #11636: Promoting newtype destructor
GHC
ghc-devs at haskell.org
Wed Feb 24 16:48:39 UTC 2016
#11636: Promoting newtype destructor
-------------------------------------+-------------------------------------
Reporter: phadej | Owner:
Type: feature | Status: new
request |
Priority: normal | Milestone:
Component: Compiler | Version:
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: None/Unknown
Unknown/Multiple |
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
given
{{{
newtype LOL a = MkLOL { unLOL :: [[a]] }
}}}
I'd like to write
{{{
type family UnLOL (lol :: LOL a) = (result :: [[a]]) | result -> lol
type instance UnLOL ('MkLOL xss) = xss
}}}
This is currently not accepted, but AFAICS it should be injective, as
`lol` is kind restricted. Especially the example in injective type
families paper do not apply, as `UnLOL Int` is ill-kinded.
With this GHC could infer `lol ~ MkLOL xss` from `UnLOL lol ~ xss`, so
newtypes would be useful for type-level programming, as type (kind)
synonyms cannot be partially applied.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11636>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list