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

GHC ghc-devs at haskell.org
Thu Apr 6 07:06:00 UTC 2017


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

 And giving `\c -> m (c . d)` a name (without a type signature, I'm don't
 have enough bravery to attempt that so early in the morning) doesn't work,
 I don't know if intended behaviour or not

 {{{#!hs
 fmap' :: (f ~> f') -> (CodTy f -> CodTy f')
 fmap' f (CodTy m) = CodTy a where
   a c = m (c . f)

 fmap' f (CodTy m) = let
   a c = m (f . g)
   in CodTy a

 fmap' f (CodTy m) = do
   let a c = m (f . g)
   CodTy a
 }}}

 Okay never mind I worked it out, this works

 {{{#!hs
 fmap' :: forall f f'. (f ~> f') -> (CodTy f -> CodTy f')
 fmap' f (CodTy (m :: forall r'. (f ty -> r') -> r')) = CodTy a where

   a :: forall r. (f' ty -> r) -> r
   a c = m (c . f)
 }}}

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


More information about the ghc-tickets mailing list