Skip to content

Add support for type-level integers

Similar to GHC.TypeNats, it would be nice to see something like the following:

newtype TypeInt (n :: Nat) = TypeInt Integer

class KnownInt (n :: k) where
  intSing :: TypeInt n

intVal :: forall n proxy. KnownInt n => proxy n -> Integer
intVal _ = case intSing :: TypeInt n of
  TypeInt x -> x

intVal' :: forall n. KnownInt n => Proxy# n -> Integer
intVal' _ = case intSing :: TypeInt n of
  TypeInt x -> x
Trac metadata
Trac field Value
Version 8.4.3
Type FeatureRequest
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