
Monoid doesn't have fromInteger -like function. For example, we don't have FromString b => FromString (a -> b) instance. Unfortunately fromInteger is part of Num, so comparison with Monoid is unjust. Sent from my iPhone
On 11 Nov 2018, at 23.44, Daniel Cartwright
wrote: ANum seems to be just Data.Monoid.Ap. Also, I can see not wanting to worsen the error messages, though it is worth pointing out that we already have a Monoid instance with the same semantics, and a similar potential for confusing error messages.
On Sun, Nov 11, 2018, 1:36 AM Dan Burton
If this behavior is desired, you can use a newtype wrapper. As it happens, this fits the pattern of ANum. (Any Applicative can be made an instance of Num in this way.)
-- Dan Burton
On Sun, Nov 11, 2018 at 12:28 AM Tom Murphy
wrote: On 11/11/18, Henning Thielemann wrote: On Sun, 11 Nov 2018, Henning Thielemann wrote:
On Sat, 10 Nov 2018, Daniel Cartwright wrote:
relevant reddit comment thread:https://www.reddit.com/r/haskell/comments/9vtis5/the_universe_of_discourse_i... urce=reddit-android
https://wiki.haskell.org/index.php?title=Num_instance_for_functions&oldid=36632
In short: It would make 2(x+y) no longer a type error but equivalent to 2. We would lose a lot of type safety for little syntactic gain.
Btw. before adding more Wat instances please implement the GHC warning about such instances: https://ghc.haskell.org/trac/ghc/ticket/11796
This is my feeling as well.
Tom _______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries