Opened 4 years ago

Closed 4 years ago

#8554 closed bug (duplicate)

kindFunResult panic when type checking wrongly-kinded function

Reported by: patrick_thomson Owned by:
Priority: normal Milestone:
Component: Compiler (Type checker) Version: 7.6.3
Keywords: Cc:
Operating System: MacOS X Architecture: x86_64 (amd64)
Type of failure: Compile-time crash Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


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):
<<details unavailable>>

Please report this as a GHC bug:

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.

Attachments (1)

error.log (2.6 KB) - added by patrick_thomson 4 years ago.

Download all attachments as: .zip

Change History (2)

Changed 4 years ago by patrick_thomson

Attachment: error.log added

comment:1 Changed 4 years ago by monoidal

Resolution: duplicate
Status: newclosed

Thanks for the report. This is already fixed in HEAD (#7368 and search Trac for kindFunResult).

    Kind incompatibility when matching types:
      f :: * -> *
      f (Fix f) :: *
    Expected type: f0 a -> Fix f
      Actual type: f0 a -> f0 (f (Fix f))
Note: See TracTickets for help on using tickets.