[GHC] #8554: kindFunResult panic when type checking wrongly-kinded function

#8554: kindFunResult panic when type checking wrongly-kinded function -------------------------------------+------------------------------------- Reporter: patrick_thomson | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (Type | Version: 7.6.3 checker) | Operating System: MacOS X Keywords: | Type of failure: Compile-time Architecture: x86_64 (amd64) | crash Difficulty: Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | -------------------------------------+------------------------------------- While working on some writing about recursion schemes and morphisms, I wrote the following well-known catamorphism: {{{ import Control.Arrow newtype Fix f = Fix { unFix :: f (Fix f) } bottomUp f = unFix >>> fmap (bottomUp f) >>> Fix >>> f }}} On a lark, I decided to reverse the direction of the arrows in the above statement and see what the typechecker had to say about it: {{{ nonsense f = unFix <<< fmap (nonsense f) <<< Fix <<< f }}} This function is (I think) not well-kinded, but during type checking (both from ghci and ghc) I get the following error: {{{ ghc: panic! (the 'impossible' happened) (GHC version 7.6.3 for i386-apple-darwin): kindFunResult <<details unavailable>> Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug }}} I am running 32-bit GHC 7.6.3 (from the Haskell Platform) on an x86_64 machine running OS X 10.9. I have attached the output of ghc -v. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8554 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8554: kindFunResult panic when type checking wrongly-kinded function --------------------------------------------+------------------------------ Reporter: patrick_thomson | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler (Type checker) | Version: 7.6.3 Resolution: duplicate | Keywords: Operating System: MacOS X | Architecture: x86_64 Type of failure: Compile-time crash | (amd64) Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: --------------------------------------------+------------------------------ Changes (by monoidal): * status: new => closed * resolution: => duplicate Comment: Thanks for the report. This is already fixed in HEAD (#7368 and search Trac for kindFunResult). {{{ B.hs:3:24: Kind incompatibility when matching types: f :: * -> * f (Fix f) :: * Expected type: f0 a -> Fix f Actual type: f0 a -> f0 (f (Fix f)) }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8554#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC