[Haskell-cafe] Are there arithmetic composition of functions?
Chris Smith
cdsmith at gmail.com
Mon Mar 19 18:37:11 CET 2012
If you are willing to depend on a recent version of base where Num is no
longer a subclass of Eq and Show, it is also fine to do this:
instance Num a => Num (r -> a) where
(f + g) x = f x + g x
fromInteger = const . fromInteger
and so on.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120319/29ba2266/attachment.htm>
More information about the Haskell-Cafe
mailing list