Proposal: Num instance for (a -> b)

Bertram Felgenhauer bertram.felgenhauer at googlemail.com
Mon Nov 12 10:07:20 UTC 2018


Oleg Grenrus wrote:
> Monoid doesn't have fromInteger -like function. For example, we don't have FromString b => FromString (a -> b) instance.

Monoid does have `mempty` though, with the unfortunate property that

  mempty [1,2] /= mempty `mappend` [1,2]

But I'm less worried about this than in the case of Num; I occasionally
copy formulas from a CAS into Haskell code and then add the missing *
operations manually; I estimate that about half of the time I miss one
instance and am rescued by the type checker. So to me, `2 (x + y)` no
longer being a type error would have practical implications.

-1 on the proposal from me.

Cheers,

Bertram


More information about the Libraries mailing list