[GHC] #9580: Possible excessive leniency in interaction between coerce and data families?

GHC ghc-devs at haskell.org
Thu Sep 11 22:56:46 UTC 2014


#9580: Possible excessive leniency in interaction between coerce and data
families?
-------------------------------------+-------------------------------------
              Reporter:  dmcclean    |            Owner:
                  Type:  bug         |           Status:  new
              Priority:  low         |        Milestone:
             Component:  Compiler    |          Version:  7.8.3
  (Type checker)                     |         Keywords:
            Resolution:              |     Architecture:  Unknown/Multiple
      Operating System:              |       Difficulty:  Unknown
  Unknown/Multiple                   |       Blocked By:
       Type of failure:              |  Related Tickets:
  None/Unknown                       |
             Test Case:              |
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------

Comment (by dmcclean):

 I tried a bunch of variations to see if I could get this to not compile to
 see what might be causing it. It still works if you move the type synonym
 definitions of `Mass` and `Quantity` out of `Test` and into `Main` (as
 long as you move the language extensions too).

 It still works even if the last type parameter is held polymorphic, as

 {{{
 f :: Num v => v -> Mass v
 f x = coerce $ 3 * x
 }}}

 even when `f` is defined in `Main`.

 It even still works if the last two parameters are held polymorphic, as

 {{{
 g :: Num v => v -> Quantity d v
 g x = coerce $ 3 * x
 }}}

 even when `g` is defined in `Main`.

 It also works if you do the same thing but expand the type synonyms
 manually.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9580#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list