|
|
|
|
|
by jason-johnson
3029 days ago
|
|
Actually the issue you're complaining about is not a Haskell problem, it's entirely a library problem. It so happens that the standard library has a really poorly defined numeric hierarchy at the moment. If you want to fix it right now, you can avoid importing the prelude and import a different numeric library which has more sensible definitions for everything. The issue is that for most things you'd want (+) to be defined like:
(+) :: a -> a -> a But actually, to be more flexible it could be defined as:
(+) :: a -> b -> a So then all the normal stuff would supported, as now, but you could also support things like: instance BetterNum DateTime where
(+) :: DateTime -> Duration -> DateTime
And so on. |
|