[GHC] #15008: Type synonyms with hidden, determined type variables

GHC ghc-devs at haskell.org
Mon Apr 9 01:19:22 UTC 2018


#15008: Type synonyms with hidden, determined type variables
-------------------------------------+-------------------------------------
        Reporter:  nomeata           |                Owner:  (none)
            Type:  feature request   |               Status:  closed
        Priority:  normal            |            Milestone:  Research
                                     |  needed
       Component:  Compiler          |              Version:  8.5
      Resolution:  worksforme        |             Keywords:
                                     |  QuantifiedConstraints, wipT2893
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 AntC):

 Replying to [comment:3 Iceland_jack]:
 > {{{#!hs
 > -- GHC transforms it into
 > type MyMonad m = (forall xx. (MonadReader xx m, Show xx))
 > }}}

 The power of `QuantifiedConstraints` seems to get closer to 'magic', the
 more I see of them! If we didn't have a FunDep on `MonadReader`, could we
 simulate it with an implication constraint thusly?

 {{{#!hs
 -- user writes or GHC transforms it into
 type MyMonad m = (forall xx. (MonadReader xx m, MonadReader xx m => Show
 xx))
 }}}

 Would we then need a superclass constraint `Show xx` on `MonadReader xx
 m`? Or would it be sufficient if the instances were for types in `Show`?

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


More information about the ghc-tickets mailing list