#8917 closed bug (fixed)

:kind! does not work under type constructors

Reported by: goldfire Owned by: goldfire
Priority: normal Milestone: 7.8.1
Component: Compiler Version: 7.8.1-rc2
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case: ghci/scripts/T8917
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


Say I have the following:

{-# LANGUAGE DataKinds, PolyKinds, TypeFamilies #-}

module Scratch where

data Nat = Zero | Succ Nat
type family a + b where
  Zero + a = a
  (Succ n) + m = Succ (n + m)

I load this into ghci. See what happens next:

GHCi, version http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
[1 of 1] Compiling Scratch          ( Scratch.hs, interpreted )
Ok, modules loaded: Scratch.
*Scratch> :kind! Zero + Succ Zero
Zero + Succ Zero :: Nat
= 'Succ 'Zero
*Scratch> :kind! Succ (Zero + Zero)
Succ (Zero + Zero) :: Nat
= 'Succ ('Zero + 'Zero)

Note the last line. It doesn't reduce under the Succ!

I will fix shortly.

Change History (5)

comment:1 Changed 20 months ago by Richard Eisenberg <eir@…>

In 47796026ca35a2438f7a7dc337add2ec3b14f06c/ghc:

Add test case for #8917

comment:2 Changed 20 months ago by Richard Eisenberg <eir@…>

In c99941cfeee033fca2df45e9523b65c83be20d31/ghc:

Fix #8917.

FamInstEnv.normaliseTcApp should normalise arguments even when
the top-level tycon isn't a type family. This was a regression
from 7.6 -- not sure when it happened, but it was probably my
fault. Fixed now, in any case.

comment:3 Changed 20 months ago by thoughtpolice

  • Status changed from new to merge

comment:4 Changed 20 months ago by goldfire

  • Test Case set to ghci/scripts/T8917

Yes, please merge. I conjecture that there are other ways to exhibit the bug fixed in this ticket without using ghci. Thanks!

comment:5 Changed 20 months ago by thoughtpolice

  • Resolution set to fixed
  • Status changed from merge to closed

Merged in 7.8, thanks!

Note: See TracTickets for help on using tickets.