Skip to content

No levity-polymorphic arguments

As discussed in our draft paper on levity polymorphism, you cannot have a levity-polymorphic argument. Here is an example:

{-# LANGUAGE RebindableSyntax, TypeInType, ExplicitForAll #-}

module Bug where

import qualified Prelude as P
import GHC.Exts

class Num (a :: TYPE r) where
  (+) :: a -> a -> a
  fromInteger :: P.Integer -> a

foo :: forall (a :: TYPE r). Num a => a
foo = 3 + 4

HEAD panics in kindPrimRep, but the code should be rejected.

Trac metadata
Trac field Value
Version 8.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