[GHC] #12540: RFC: Allow not quantifying every top-level quantifiee

GHC ghc-devs at haskell.org
Sun Sep 11 08:16:33 UTC 2016


#12540: RFC: Allow not quantifying every top-level quantifiee
-------------------------------------+-------------------------------------
        Reporter:  Iceland_jack      |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.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 Iceland_jack):

 (Example that tripped me up) I wanted to define a `Proxy`-less version of
 [https://hackage.haskell.org/package/generics-sop-0.2.2.0/docs/Generics-
 SOP-Classes.html#v:hcpure hcpure].

 By muscle memory I quantified over the type variables in the context but
 the rest..

 {{{#!hs
 hcpure_ :: forall h c xs. (HPure h, AllN h c xs) => (forall (a :: k). c a
 => f a) -> h f xs
 hcpure_ = hcpure (Proxy @c)
 }}}

 I read my types in linear order: Do I quantify over `a`? (''no'', it's
 higher rank) Do I quantify over `k`? (''optional'', must appear before
 `h`, `c` and `f` though). Do I quantify over `c`? (''never mind'' already
 did) Do I quantify over `f`? (''yes'') Did I do `h`, `f`, `xs` already?

 This is more analysis than my brain can do quickly :)

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


More information about the ghc-tickets mailing list