[GHC] #14292: Coercing between constraints of newtypes
GHC
ghc-devs at haskell.org
Thu Sep 28 00:46:28 UTC 2017
#14292: Coercing between constraints of newtypes
-------------------------------------+-------------------------------------
Reporter: Iceland_jack | Owner: (none)
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.2.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 RyanGlScott):
Replying to [comment:3 AntC]:
> `IncoherentInstances` is a module-wide setting; and nowadays deprecated
in favour of the more surgical `{-# INCOHERENT #-}` pragma on the
instance.
>
> Does that also apply for the role mungling?
As far as I know, you do need to enable the `IncoherentInstances`
extension proper in order to assign non-nominal roles to class parameters,
as the `{-# INCOHERENT #-}` pragma only works for instance declarations,
not class declarations. (This might be partly why you don't get a
deprecation warning when enabling `IncoherentInstances`, but you do with
`OverlappingInstances`, which doesn't have a dual purpose like
`IncoherentInstances` does.)
> How does the `{-# INCOHERENT #-}` pragma go for `StandaloneDeriving` or
`GeneralizedNewtypeDeriving`? It seems to be accepted by GHC OK, does it
have the right effect? (It's hard to put together a test case.)
I'm not sure I understand the question. Derived instances never use `{-#
INCOHERENT #-}` (or even `{-# OVERLAPS #-}`/`{-# OVERLAPPING #-}`/`{-#
OVERLAPPABLE #-}`, for that matter) in their emitted code, if that's what
you're wondering.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14292#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list