[Haskell-cafe] Type level functions (type of decreasing list)
Stefan Holdermans
stefan at cs.uu.nl
Wed Oct 18 02:10:04 EDT 2006
Greg,
What about the following (tested with GHC 6.6)?
{-# OPTIONS -fglasgow-exts #-}
data Zero = Zero
data Succ n = Succ n
zero = Zero
one = Succ zero
two = Succ one
three = Succ two
-- etc
data Seq :: * -> * where
Nil :: Seq Zero
Cons :: Succ n -> Seq n -> Seq (Succ n)
mySeq = Cons three (Cons two (Cons one Nil))
HTH,
Stefan
More information about the Haskell-Cafe
mailing list