[Haskell-cafe] Re: type level functions (type of decreasing list)

2006-10-18 Thread Greg Buchholz
Stefan Holdermans <[EMAIL PROTECTED]> wrote: > What about the following (tested with GHC 6.6)? and [EMAIL PROTECTED] wrote: > > One way is to use existentials: > Perhaps a better -- and a more general alternative -- is to use > type-level programming to its fullest. Thanks everyone, those a

[Haskell-cafe] Re: type level functions (type of decreasing list)

2006-10-17 Thread oleg
Greg Buchholz wrote: > I'm wondering about creating a data structure that has the type of > decreasing numbers. > I can try... > > class Pre a b | a -> b > instance Pre (Succ a) a > instance Pre Zero Zero > > data (Pre a b) => Seq a = Cons a (Seq b) | Nil > > decreasing = Cons three (Cons two