<div dir="ltr">have you tried  using rebindable syntax + noImplicitPrelude?  That *should* allow you to model this by just having a distinguished fromInteger function in scope during desugaring/type checking. <div>At the very least, its worth experimenting with.</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jun 15, 2015 at 12:56 AM, Michael Baikov <span dir="ltr"><<a href="mailto:manpacket@gmail.com" target="_blank">manpacket@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I guess we can have something similar for rationals as well, I haven't<br>
considered those.<br>
<div class="HOEnZb"><div class="h5"><br>
On Mon, Jun 15, 2015 at 12:41 PM, Ivan Lazar Miljenovic<br>
<<a href="mailto:ivan.miljenovic@gmail.com">ivan.miljenovic@gmail.com</a>> wrote:<br>
> On 12 June 2015 at 17:04, Michael Baikov <<a href="mailto:manpacket@gmail.com">manpacket@gmail.com</a>> wrote:<br>
>> Hi Cafe!<br>
>><br>
>> Now that we have OverloadedList and OverloadedStrings extensions it<br>
>> might make sense to add something similar for numerals - right now if<br>
>> you want to be able to specify some items as numbers<br>
>> you have to implement Num instance, unfortunately not everything that<br>
>> can be represented as number can have sensible operations required by<br>
>> Num: negation makes no sense for set  of natural numbers for example,<br>
>> multiplication for some applications of currency values which results<br>
>> in Num instance full of (*) = error "No multipication for Foos", (+) =<br>
>> error "No addition for Foos".<br>
>><br>
>> I don't have any statistics from hackage or github, but in codebase<br>
>> I'm working with there are 3 such instances.<br>
>><br>
>> Proposal: add OverloadedNumerals language pragma, IsNumeric typeclass<br>
>> and some methods to make that class useful with behavior similar to<br>
>> Lists and Strings.<br>
><br>
> Is this strictly to replace/augment fromInteger or are you proposing<br>
> one for fromRational as well?<br>
><br>
> --<br>
> Ivan Lazar Miljenovic<br>
> <a href="mailto:Ivan.Miljenovic@gmail.com">Ivan.Miljenovic@gmail.com</a><br>
> <a href="http://IvanMiljenovic.wordpress.com" rel="noreferrer" target="_blank">http://IvanMiljenovic.wordpress.com</a><br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
</div></div></blockquote></div><br></div>