[Haskell-cafe] NumberTheory library

ajb at spamcop.net ajb at spamcop.net
Tue May 10 19:52:02 EDT 2005


G'day all.

Quoting Bo Herlin <bo at gcab.net>:

> Great! I like this a LOT.

Thanks!


> Im working on a framework for ranking and unranking things where primes
> are just a tiny part:
>
>  > data DCountable
>  >   = Countable Integer
>  >   | Uncountable
>  >     deriving (Eq,Show)
>  >
>  > class CRankable a b where
>  >   rank   :: a -> b -> Maybe Integer
>  >   unrank :: a -> Integer -> Maybe b
>  >   count  :: a -> b -> DCountable

That's very nice stuff.  I haven't implemented primes-as-sequences yet
because I couldn't be bothered finding an efficient algorithm.  Looks
like you might have already done the leg work. :-)

> I have also for trees and lists and other things with defined parameters
> like length, or not.
> Using my framework they are made quite simple.

Very nice.

> Its not very pretty yet since ive only been a Haskeller for some weeks
> now, and I dont know about darcs (i run cvs as i have the book), but
> maybe my framework could be included once a Haskell-guru brushes it up a
> bit?

I don't know if I count as a guru or not, but by all means.  Want to
discuss this on-list or off-list?

Cheers,
Andrew Bromage


More information about the Haskell-Cafe mailing list