[GHC] #14101: Type synonyms can make roles too conservative
GHC
ghc-devs at haskell.org
Sat Aug 12 02:37:23 UTC 2017
#14101: Type synonyms can make roles too conservative
-------------------------------------+-------------------------------------
Reporter: dfeuer | Owner: (none)
Type: bug | Status: patch
Priority: normal | Milestone: 8.4.1
Component: Compiler (Type | Version: 8.2.1
checker) |
Resolution: | Keywords: roles
Operating System: Unknown/Multiple | Architecture:
Type of failure: GHC rejects | Unknown/Multiple
valid program | Test Case:
Blocked By: | Blocking:
Related Tickets: #8234 | Differential Rev(s): Phab:D3838
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by dfeuer):
My concern is that this might not always do the best job with closed type
families. In particular, we can produce a bound on the role of an
application of a closed type family even if we can't reduce it.
{{{#!hs
type family Foo a where
Foo 'True = Maybe
Foo 'False = Either Int
newtype Bar a b = Bar (Foo a b)
}}}
We know that `Foo a` must be `Maybe`, `Either Int`, or stuck. I believe it
should therefore be safe to give `b` a representational role. My guess is
that the right thing is to give type signatures and closed type families
role annotations with the number of components determined by the number of
arrows in their kinds.
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14101#comment:7>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list