
#13740: GHC panic with operator constructor of newtype -------------------------------------+------------------------------------- Reporter: codebje | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 (Type checker) | Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Compile-time Unknown/Multiple | crash or panic Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- The following code causes a GHC panic: {{{ newtype Cont r a = Cont { (>>-) :: (a -> r) -> r } x = \a b c -> c >>- a . b }}} This slight modification, however, is fine: {{{ newtype Cont r a = Cont { (>>-) :: (a -> r) -> r } x = \a b c -> c >>- (a . b) }}} The presence or absence of a type signature for `x` makes no difference. Compiling with "-v" suggests the panic occurs during type checking: {{{ Glasgow Haskell Compiler, Version 8.0.2, stage 2 booted by GHC version 7.10.3 Using binary package database: /Users/bje/.stack/programs/x86_64-osx/ghc-8.0.2/lib/ghc-8.0.2/package.conf.d/package.cache Using binary package database: /Users/bje/.stack/snapshots/x86_64-osx/lts-8.8/8.0.2/pkgdb/package.cache Using binary package database: /Users/bje/.stack/global/.stack- work/install/x86_64-osx/lts-8.8/8.0.2/pkgdb/package.cache loading package database /Users/bje/.stack/programs/x86_64-osx/ghc-8.0.2/lib/ghc-8.0.2/package.conf.d loading package database /Users/bje/.stack/snapshots/x86_64-osx/lts-8.8/8.0.2/pkgdb loading package database /Users/bje/.stack/global/.stack- work/install/x86_64-osx/lts-8.8/8.0.2/pkgdb wired-in package ghc-prim mapped to ghc-prim-0.5.0.0 wired-in package integer-gmp mapped to integer-gmp-1.0.0.1 wired-in package base mapped to base-4.9.1.0 wired-in package rts mapped to rts wired-in package template-haskell mapped to template-haskell-2.11.1.0 wired-in package ghc mapped to ghc-8.0.2 wired-in package dph-seq not found. wired-in package dph-par not found. Hsc static flags: loading package database /Users/bje/.stack/programs/x86_64-osx/ghc-8.0.2/lib/ghc-8.0.2/package.conf.d loading package database /Users/bje/.stack/snapshots/x86_64-osx/lts-8.8/8.0.2/pkgdb loading package database /Users/bje/.stack/global/.stack- work/install/x86_64-osx/lts-8.8/8.0.2/pkgdb wired-in package ghc-prim mapped to ghc-prim-0.5.0.0 wired-in package integer-gmp mapped to integer-gmp-1.0.0.1 wired-in package base mapped to base-4.9.1.0 wired-in package rts mapped to rts-1.0 wired-in package template-haskell mapped to template-haskell-2.11.1.0 wired-in package ghc mapped to ghc-8.0.2 wired-in package dph-seq not found. wired-in package dph-par not found. *** Chasing dependencies: Chasing modules from: *panic.hs !!! Chasing dependencies: finished in 0.57 milliseconds, allocated 0.224 megabytes Stable obj: [] Stable BCO: [] Ready for upsweep [NONREC ModSummary { ms_hs_date = 2017-05-22 07:07:41 UTC ms_mod = Main, ms_textual_imps = [(Nothing, Prelude)] ms_srcimps = [] }] *** Deleting temp files: Deleting: compile: input file panic.hs *** Checking old interface for Main: [1 of 1] Compiling Main ( panic.hs, panic.o ) *** Parser [Main]: !!! Parser [Main]: finished in 0.38 milliseconds, allocated 0.209 megabytes *** Renamer/typechecker [Main]: *** Deleting temp files: Deleting: *** Deleting temp dirs: Deleting: ghc: panic! (the 'impossible' happened) (GHC version 8.0.2 for x86_64-apple-darwin): get_op >>- Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13740 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler