[Haskell-cafe] multi type addition
lemming at henning-thielemann.de
Wed Dec 29 13:17:08 CET 2010
On Tue, 28 Dec 2010, aditya siram wrote:
> The problem here is that unfortunately the Haskell type system cannot
> do coercion.
I'd omit the "unfortunately". For me it is a good thing that Haskell does
not silently apply lossy number conversions, as e.g. MatLab does.
'realToFrac' allows conversion to Float. It requires 'Real' constraint.
Your 'Num' constraint is too weak, since 'Complex' is also in 'Num' type
More information about the Haskell-Cafe