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 class.

http://www.haskell.org/haskellwiki/Converting_numbers
http://www.haskell.org/haskellwiki/Generic_number_type


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to