[GHC] #15253: Add support for type-level integers

#15253: Add support for type-level integers -------------------------------------+------------------------------------- Reporter: chessai | Owner: (none) Type: feature | Status: new request | Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.4.3 Keywords: compiler, | Operating System: Unknown/Multiple base | Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Similar to GHC.TypeNats, it would be nice to see something like the following: {{{#!hs 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 }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15253 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15253: Add support for type-level integers -------------------------------------+------------------------------------- Reporter: chessai | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.4.3 Resolution: | Keywords: compiler, | base Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by AntC): We already have type-level `Nat`. Then you can emulate `Integer` by pairing a `Nat` with type-level `Bool` to hold the sign. Do you have a stronger use case than "it would be nice to see"? Ryan's comment to your previous request ticket:14922#comment:3 applies here as well. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15253#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC