
On 12 June 2015 at 17:04, Michael Baikov
Hi Cafe!
Now that we have OverloadedList and OverloadedStrings extensions it might make sense to add something similar for numerals - right now if you want to be able to specify some items as numbers you have to implement Num instance, unfortunately not everything that can be represented as number can have sensible operations required by Num: negation makes no sense for set of natural numbers for example, multiplication for some applications of currency values which results in Num instance full of (*) = error "No multipication for Foos", (+) = error "No addition for Foos".
I don't have any statistics from hackage or github, but in codebase I'm working with there are 3 such instances.
Proposal: add OverloadedNumerals language pragma, IsNumeric typeclass and some methods to make that class useful with behavior similar to Lists and Strings.
Is this strictly to replace/augment fromInteger or are you proposing one for fromRational as well? -- Ivan Lazar Miljenovic Ivan.Miljenovic@gmail.com http://IvanMiljenovic.wordpress.com