[GHC] #9732: Pattern synonyms and unboxed values

GHC ghc-devs at haskell.org
Thu Oct 30 15:47:38 UTC 2014


#9732: Pattern synonyms and unboxed values
-------------------------------------+-------------------------------------
              Reporter:  monoidal    |            Owner:  cactus
                  Type:  bug         |           Status:  new
              Priority:  normal      |        Milestone:
             Component:  Compiler    |          Version:  7.8.3
            Resolution:              |         Keywords:
      Operating System:              |     Architecture:  Unknown/Multiple
  Unknown/Multiple                   |       Difficulty:  Unknown
       Type of failure:  Compile-    |       Blocked By:
  time crash                         |  Related Tickets:
             Test Case:              |
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------

Comment (by cactus):

 Yes, I've found `voidPrimId`/`voidArgId` meanwhile, and I have a working
 implementation pushed to `wip/T9732` just now.

 However, I had to split the matcher into two, since otherwise I can't
 decide when to have the extra arg, since the result type is completely
 unknown at matcher generation time. So for now, I've went with

 {{{
 Main.$mPAT :: forall r. GHC.Prim.Int# -> r -> r -> r
 Main.$m#PAT :: forall (r :: #). GHC.Prim.Int# -> (GHC.Prim.Void# -> r) ->
 (GHC.Prim.Void# -> r) -> r
 }}}

 so that takes care of using pattern synonyms when the _result_ type is
 unlifted: both of these now compile lint-free, and give the expected
 behaviour:

 {{{
 f PAT = 42#
 g PAT = (42 :: Int)
 }}}

 So the only remaining TODO should be to add this extra `Void#` argument to
 the generated wrappers when there are no other arguments and the pattern
 type is unlifted.

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


More information about the ghc-tickets mailing list