[GHC] #13741: Newtype unwrapping causes GHC panic

GHC ghc-devs at haskell.org
Mon May 22 08:38:31 UTC 2017


#13741: Newtype unwrapping causes GHC panic
-------------------------------------+-------------------------------------
        Reporter:  vaibhavsagar      |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.2
      Resolution:                    |             Keywords:  newtype ghci
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Description changed by vaibhavsagar:

@@ -6,1 +6,1 @@
- 2. Define `Cont`: `newtype Cont a r = Cont {(>>-) :: (a -> r) -> r}`
+ 2. Define `Cont`: `newtype Cont r a = Cont {(>>-) :: (a -> r) -> r}`

New description:

 Some combination of newtypes and infix operators is causing GHCi to panic.

 Steps to reproduce:

 1. Open a fresh GHCi session.
 2. Define `Cont`: `newtype Cont r a = Cont {(>>-) :: (a -> r) -> r}`
 3. Define a `Functor` instance for `Cont`: `instance Functor (Cont r)
 where fmap f c = Cont $ \k -> c >>>- f . k`
 4. Observe the following:

 {{{
 ghc: panic! (the 'impossible' happened)
   (GHC version 8.0.2 for x86_64-unknown-linux):
         get_op >>>-

 Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

 }}}

 Discovered
 [https://www.reddit.com/r/haskell/comments/6clkgs/discovering_continuations_with_typed_holes/dhvluoq/
 here].

--

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


More information about the ghc-tickets mailing list