[Haskell-cafe] Announce type-level-natural-number-1.0: Simple,
Haskell 2010-compatible type level natural numbers
Alexey Khudyakov
alexey.skladnoy at gmail.com
Sat Jul 31 05:07:33 EDT 2010
On Fri, 30 Jul 2010 15:20:55 -0700
John Meacham <john at repetae.net> wrote:
> > > type family Add n m :: *
> > >
> > > type instance Add Zero Zero = Zero
> > > type instance Add Zero (SuccessorTo n) = SuccessorTo n
> > > type instance Add (SuccessorTo n) m = SuccessorTo (Add n m)
> >
> > Standard package is could be somewhat difficult. Standards are
> > undeniably good but "one size doesn't fit all" rule does apply here.
> > Your package couldn't be used to represent big numbers. Little real
> > work has been done on this so it's reasonable to expect progress or
> > even some breakthough.
>
> I thought there was some elegant way to express type level numbers
> using balanced ternary, but I can't find a reference to it at the
> moment.
>
Balanced ternary is useful for represeting signed integers.
Implementation of next, prev and basic arithmetic operations is not
very elegant
Some time ago I wrote implementation of type level numbers using binary
and balanced ternary encoding. Will upload to hackage soon.
More information about the Haskell-Cafe
mailing list