[GHC] #13537: Adding underscore (m :: _) to pattern variable makes it fail

GHC ghc-devs at haskell.org
Fri Apr 7 12:44:05 UTC 2017


#13537: Adding underscore (m :: _) to pattern variable makes it fail
-------------------------------------+-------------------------------------
        Reporter:  Iceland_jack      |                Owner:  (none)
            Type:  bug               |               Status:  closed
        Priority:  normal            |            Milestone:
       Component:  Compiler (Type    |              Version:  8.0.1
  checker)                           |
      Resolution:  invalid           |             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):

 Thank you, consider this answered.

 ----

 I was reifying `(forall ty. STy ty -> r) -> r` from
 [https://github.com/goldfirere/glambda/blob/ex3/src/Language/Glambda/Type.hs#L72
 Richard's Glambda]

 {{{#!hs
 refineTy :: Ty -> (forall ty. STy ty -> r) -> r
 refineTy (ty1 `Arr` ty2) k
   = refineTy ty1 $ \sty1 ->
     refineTy ty2 $ \sty2 ->
     k (sty1 `SArr` sty2)
 refineTy IntTy  k = k SIntTy
 refineTy BoolTy k = k SBoolTy
 }}}

 If this were a regular continuation / codensity monad we could rewrite it
 to

 {{{#!hs
 refineTy = \case
   Arr a b -> liftA2 SArr (refine a) (refine b)
   IntTy   -> pure SIntTy
   BoolTy  -> pure SBoolTy
 }}}


 but it seems to be a functor from a ''functor'' category, so I'm trying to
 figure out where it fits in the hierarchy. Thanks.

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


More information about the ghc-tickets mailing list