Am Samstag, 14. März 2009 23:33 schrieben Sie:
On Fri, 13 Mar 2009, Wolfgang Jeltsch wrote:
Class instances should satisfy certain laws. (Although these laws are
often not stated explicitely, they are assumed to hold by users of the
class and they should hold to make the instance sensible.)
On Fri, 13 Mar 2009, Mark Spezzano wrote:
1. Don’t bother. Just use Integer.
2. Use the type
data Natural = Zero | Succ !Natural
3. Use the following definition taken from the Gentle Introduction to Haskell
98
newtype Natural = MakeNatural Integer
This option looks like non-negative
On Fri, 13 Mar 2009, Wolfgang Jeltsch wrote:
Am Freitag, 13. März 2009 09:21 schrieb Roman Cheplyaka:
* Alexander Dunlap alexander.dun...@gmail.com [2009-03-12 20:01:57-0700]
Also, a lot of functions just take
Integers so it would be more of a pain to use.
AFAIK there are very few
Hi Mark,
On Mar 13, 2009, at 3:54 AM, Mark Spezzano wrote:
I was wondering what the best way to implement Natural number would
be. Is there a package which already does this?
there are two packages on Hackage that implement natural numbers using
algebraic datatypes: 'numbers' has a module
* Alexander Dunlap alexander.dun...@gmail.com [2009-03-12 20:01:57-0700]
Also, a lot of functions just take
Integers so it would be more of a pain to use.
AFAIK there are very few fuctions that take Integers. Many functions
take instances of Integral, but it's not a problem to make your own
Am Freitag, 13. März 2009 04:01 schrieb Alexander Dunlap:
2. Use the type
data Natural = Zero | Succ !Natural
[…]
In terms of speed, I think that [3] would be reasonably fast (unless
you do a ton of subtraction with bounds-checking) and [2] would
probably be quite slow, because you
Am Freitag, 13. März 2009 04:53 schrieb Brandon S. Allbery KF8NH:
On 2009 Mar 12, at 22:54, Mark Spezzano wrote:
I was wondering what the best way to implement Natural number would
be. Is there a package which already does this?
type-level on Hackage.
I think, the original poster wanted
Am Freitag, 13. März 2009 09:21 schrieb Roman Cheplyaka:
* Alexander Dunlap alexander.dun...@gmail.com [2009-03-12 20:01:57-0700]
Also, a lot of functions just take
Integers so it would be more of a pain to use.
AFAIK there are very few fuctions that take Integers. Many functions
take
On 2009 Mar 13, at 4:25, Wolfgang Jeltsch wrote:
Am Freitag, 13. März 2009 04:53 schrieb Brandon S. Allbery KF8NH:
On 2009 Mar 12, at 22:54, Mark Spezzano wrote:
I was wondering what the best way to implement Natural number would
be. Is there a package which already does this?
type-level on
Hi,
I was wondering what the best way to implement Natural number would be. Is
there a package which already does this?
Here are some options:
1. Don’t bother. Just use Integer.
2. Use the type
data Natural = Zero | Succ !Natural
3. Use the following definition taken from the
2009/3/12 Mark Spezzano mark.spezz...@chariot.net.au:
Hi,
I was wondering what the best way to implement Natural number would be. Is
there a package which already does this?
Here are some options:
1. Don’t bother. Just use Integer.
2. Use the type
data Natural = Zero | Succ
On 2009 Mar 12, at 22:54, Mark Spezzano wrote:
I was wondering what the best way to implement Natural number would
be. Is there a package which already does this?
type-level on Hackage.
2. Use the type
data Natural = Zero | Succ !Natural
One of the reasons people use type-level naturals
12 matches
Mail list logo