Re:Learn Physics by Programming in Haskell
by thepratt on Saturday February 24, 2018 @10:14AM
(#16453543)
There isn't operator overloading as other languages have it, but you can write instances for your types. It seems you're just complaining about using vector addition operator (^+^) instead of a different addition operator (+); if it bothered you that much an instance would create a link defining + as ^+^.
[ Parent
| on HN ]
Re:Learn Physics by Programming in Haskell
by marcosdumay on Saturday February 24, 2018 @10:53AM
(#16453750)
> but you can write instances for your types
Yes, as long as they have the structure your classes demand. It's not exactly Haskell's type system that is bad, it's the numeric classes that are a bit of a mess.
Math has a much cleaner structure that, for example, does not demand that you can convert any integral value into an instance of your numbers. Haskell tried to simplify it, but wasn't successful.