Skip to content

Uncurried Parameter to n-ary Function in Type Signature Causes Crash

If you uncomment the arrow, everything's fine; GHC crashes as-is.

f :: (a -> b) {- -> -} a -> c
f = undefined

Apparently GHC incorrectly parses any n-ary function parameter followed by another uncurried parameter in type signatures.

System Info: GHC v8.2.1 GCC v5.4.0 Linux Mint (Linux 4.8.0-53-generic #56 (closed)~16.04.1-Ubuntu SMP x86_64)

ghc -v -dcore-lint:

Glasgow Haskell Compiler, Version 8.2.1, stage 2 booted by GHC version 8.0.2
Using binary package database: /usr/local/haskell/ghc-8.2.1-x86_64/lib/ghc-8.2.1/package.conf.d/package.cache
Using binary package database: /home/nic/.ghc/x86_64-linux-8.2.1/package.conf.d/package.cache
package flags []
loading package database /usr/local/haskell/ghc-8.2.1-x86_64/lib/ghc-8.2.1/package.conf.d
loading package database /home/nic/.ghc/x86_64-linux-8.2.1/package.conf.d
wired-in package ghc-prim mapped to ghc-prim-0.5.1.0
wired-in package integer-gmp mapped to integer-gmp-1.0.1.0
wired-in package base mapped to base-4.10.0.0
wired-in package rts mapped to rts
wired-in package template-haskell mapped to template-haskell-2.12.0.0
wired-in package ghc mapped to ghc-8.2.1
wired-in package dph-seq not found.
wired-in package dph-par not found.
package flags []
loading package database /usr/local/haskell/ghc-8.2.1-x86_64/lib/ghc-8.2.1/package.conf.d
loading package database /home/nic/.ghc/x86_64-linux-8.2.1/package.conf.d
wired-in package ghc-prim mapped to ghc-prim-0.5.1.0
wired-in package integer-gmp mapped to integer-gmp-1.0.1.0
wired-in package base mapped to base-4.10.0.0
wired-in package rts mapped to rts-1.0
wired-in package template-haskell mapped to template-haskell-2.12.0.0
wired-in package ghc mapped to ghc-8.2.1
wired-in package dph-seq not found.
wired-in package dph-par not found.
*** Chasing dependencies:
Chasing modules from: *bug.hs
!!! Chasing dependencies: finished in 1.14 milliseconds, allocated 0.207 megabytes
Stable obj: []
Stable BCO: []
Ready for upsweep
  [NONREC
      ModSummary {
         ms_hs_date = 2017-12-08 23:11:58.321654412 UTC
         ms_mod = Main,
         ms_textual_imps = [(Nothing, Prelude)]
         ms_srcimps = []
      }]
*** Deleting temp files:
Deleting: 
compile: input file bug.hs
*** Checking old interface for Main (use -ddump-hi-diffs for more details):
[1 of 1] Compiling Main             ( bug.hs, bug.o )
*** Parser [Main]:
!!! Parser [Main]: finished in 0.13 milliseconds, allocated 0.090 megabytes
*** Renamer/typechecker [Main]:
*** Deleting temp files:
Deleting: 
*** Deleting temp dirs:
Deleting: 
ghc: panic! (the 'impossible' happened)
  (GHC version 8.2.1 for x86_64-unknown-linux):
	repSplitAppTys
  a_anL[sk:1]
  b_anM[sk:1]
  []
  Call stack:
      CallStack (from HasCallStack):
        prettyCurrentCallStack, called at compiler/utils/Outputable.hs:1133:58 in ghc:Outputable
        callStackDoc, called at compiler/utils/Outputable.hs:1137:37 in ghc:Outputable
        pprPanic, called at compiler/types/Type.hs:808:9 in ghc:Type
Trac metadata
Trac field Value
Version 8.2.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information