[GHC] #2893: Implement "Quantified contexts" proposal
GHC
ghc-devs at haskell.org
Sat Aug 20 21:03:51 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):
Moved from #5927.
Use case from [http://ozark.hendrix.edu/~yorgey/pub/twisted.pdf How to
Twist Pointers without Breaking Them]:
> {{{#!hs
> class Monoid m => Action m a where
> act :: m -> a -> a
> }}}
> ''[...]''
>
> We first formalise the action of monoids on functors. Intuitively, for a
monoid `m` to act on the functor `f`, it should act in a uniform way on
all the types `f a`. Therefore, we would like to assert a constraint
something like `forall a. Action m (f a)`. Unfortunately, Haskell does not
allow the use of universally quantified constraints and hence we need a
new type class.
>
> {{{#!hs
> class (Monoid m, Functor f) => ActionF m f where
> act' :: m -> f a -> f a
> }}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/2893#comment:17>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list