[Haskell] Type-Level arithmetic library
Robert Dockins
robdockins at fastmail.fm
Mon Jan 30 21:12:57 EST 2006
While cleaning up my home directory, I discovered some code I worked
on a while ago which implements type level arithmetic. I have
cleaned it up and decided to release.
This library includes the following operations on type level naturals:
addition
subtraction
multiplication
division
remainder
GCD
and also contains the following predicates
test for zero
test for equality
<
>
<=
>=
This library uses a binary representation and can handle numbers at
the order of 10^15 (at least). It also contains a test suite to help
validate the somewhat unintuitive algorithms.
You can retrieve this library with the following command
darcs get --partial --tag '0.1' http://www.eecs.tufts.edu/~rdocki01/
typenats/
Enjoy,
Rob Dockins
PS Please let me know if you come up with useful ways to use this
library! (I'm mostly just curious)
Speak softly and drive a Sherman tank.
Laugh hard; it's a long way to the bank.
-- TMBG
More information about the Haskell
mailing list