[GHC] #4385: Type-level natural numbers

GHC cvs-ghc at haskell.org
Thu May 23 17:45:05 CEST 2013


#4385: Type-level natural numbers
----------------------------------------+-----------------------------------
    Reporter:  diatchki                 |       Owner:  diatchki        
        Type:  feature request          |      Status:  new             
    Priority:  normal                   |   Milestone:  7.6.2           
   Component:  Compiler (Type checker)  |     Version:                  
    Keywords:                           |          Os:  Unknown/Multiple
Architecture:  Unknown/Multiple         |     Failure:  None/Unknown    
  Difficulty:                           |    Testcase:                  
   Blockedby:                           |    Blocking:                  
     Related:                           |  
----------------------------------------+-----------------------------------

Comment(by darchon):

 I get a similar error implementing concat for vectors:

 {{{
 data Vec :: Nat -> * -> * where
   Nil  :: Vec 0 a
   (:>) :: a -> Vec n a -> Vec (n + 1) a

 vappend :: Vec n a -> Vec m a -> Vec (n + m) a
 vappend Nil       ys = ys
 vappend (x :> xs) ys = x :> (vappend xs ys)

 vconcat :: Vec n (Vec m a) -> Vec (n * m) a
 vconcat Nil       = Nil
 vconcat (x :> xs) = vappend x (vconcat xs)
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4385#comment:60>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler



More information about the ghc-tickets mailing list