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

GHC ghc-devs at haskell.org
Sun Jun 10 17:05:56 UTC 2018


#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


More information about the ghc-tickets mailing list