On Fri, 30 Jul 2010 15:20:55 -0700 John Meacham <[email protected]> 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. _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
