[Haskell] Re: Type-Level arithmetic library
Aaron Denney
wnoise at ofb.net
Tue Jan 31 00:41:54 EST 2006
On 2006-01-31, Ashley Yakeley <ashley at semantic.org> wrote:
> Robert Dockins wrote:
>> While cleaning up my home directory, I discovered some code I worked on
>> a while ago which implements type level arithmetic.
>
> I know for the usual Peano representation of natural numbers, at least,
> it's possible to represent addition and subtraction with a single class
> with two fundeps (because classes represent relations between types
> rather than functions on them). See
><http://haskell.org/haskellwiki/Peano_numbers>.
That's always seemed like such an ugly hack to me.
If you use a digital representation, you can throw in at
least one negative digit, and things just work.
I really should write up and post my example of that using balanced base
three on the wiki.
--
Aaron Denney
-><-
More information about the Haskell
mailing list