Skip to content

:kind! does not work under type constructors

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 7.8.0.20140228: 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.

Trac metadata
Trac field Value
Version 7.8.1-rc2
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