[GHC] #2893: Implement "Quantified contexts" proposal

GHC ghc-devs at haskell.org
Tue Nov 22 02:41:42 UTC 2016


#2893: Implement "Quantified contexts" proposal
-------------------------------------+-------------------------------------
        Reporter:  porges            |                Owner:
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:  ⊥
       Component:  Compiler          |              Version:  6.10.1
      Resolution:                    |             Keywords:  proposal
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 Iceland_jack):

 I want to mention an example from 1997: [https://www.microsoft.com/en-
 us/research/wp-content/uploads/1997/01/multi.pdf Type classes: an
 exploration of the design space]

 > What we really want is universal quantification:
 >
 > {{{#!hs
 > class (forall s. Monad (m s))
 >    => StateMonad m where
 >     get :: m s s
 >     set :: s -> m s ()
 > }}}

 which can be defined as

 {{{#!hs
 class ForallF Monad m => StateMonad m where
   get :: m s s
   set :: s -> m s ()
 }}}

 How does it compare to `MonadState`.

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


More information about the ghc-tickets mailing list