3 ms·
> Well, maybe it's a good example of how to handle numbers—although I find the lack of a positive-integer type a pain— In another subthread I mentioned the abs
by catnaroek 13y ago
> Well, maybe it's a good example of how to handle numbers—although I find the lack of a positive-integer type a pain—
In another subthread I mentioned the absence of a Semiring type class, which should be a superclass of Ring (Haskell's Num) and provide addition, multiplication and fromNatural. So, yeah, I am not entirely happy with Haskell's standard library either, but the situation in other (general-purpose) programming languages is even worse.
> but it's certainly not a good example of how to handle general algebraic structures, which is what it seems to pretend to be.
How so? The standard library may be flawed, but the core language is perfectly capable of handling general algebraic structures. The only legitimate point of pain I can see is that a type or tuple of types can only be an instance of a type class in at most one way, for which the solution (admittedly, rather ugly) is to use newtype. A non-ugly solution would be to use something like Standard ML's module system, but in no way it would improve the situation to move closer to Common Lisp.
- JadeNB 13y ago> How so? The standard library may be flawed, but the core language is perfectly capable of handling general algebraic structures. I mean algebraic structures in the mathematical sense you mentioned (rings, groups, &c.), not in the computer-science sense of algebraic data types.
- catnaroek 13y ago> I mean algebraic structures in the mathematical sense you mentioned (rings, groups, &c.) I know you meant those. And I meant those as well.