[Haskell-cafe] Re: Positive integers

Aaron Denney wnoise at ofb.net
Thu Mar 23 20:14:11 EST 2006

On 2006-03-24, Daniel McAllansmith <dagda at xtra.co.nz> wrote:
> Unless I've missed it, there is no typeclass for positive integers in GHC.
> Is there any particular reason it doesn't exist?

The number of useable operations is small, and checks for leaving the
domain would have to be done all the time.  It basically doesn't buy

> Also, it seems Word would be a far better type in the likes of (!!), length, 
> etc.  Is it just tradition that resulted in the use of Int?

No.  I'd like to be able to get the differences in length both positive
and negative, for example.  (This could be fixed by making (+) and (-)
instance of an MPTC, though, as additive torsors.)

Aaron Denney

More information about the Haskell-Cafe mailing list