To clarify in Bobs remark : while you're still learning Haskell and the type system , things like lifted Num on functions can lead to some potentially confusing type errors. That said, it's absolutely doable, and can be a very nice / powerful tool when used appropriately. On Sunday, September 1, 2013, Bob Ippolito wrote:
Yes, you can do that, but you probably shouldn't.
See also: http://www.haskell.org/haskellwiki/Num_instance_for_functions http://hackage.haskell.org/package/applicative-numbers
On Sat, Aug 31, 2013 at 10:01 PM, Christopher Howard < christopher.howard@frigidcode.com <javascript:_e({}, 'cvml', 'christopher.howard@frigidcode.com');>> wrote:
Hi. I was just curious about something. In one of my math textbooks I see expressions like this
f + g
or
(f + g)(a)
where f and g are functions. What is meant is
f(a) + g(a)
Is there a way in Haskell you can make use of syntax like that (i.e., expressions like f + g and f * g to create a new function), perhaps by loading a module or something?
______________________________**_________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org <javascript:_e({}, 'cvml', 'Haskell-Cafe@haskell.org');> http://www.haskell.org/**mailman/listinfo/haskell-cafe<http://www.haskell.org/mailman/listinfo/haskell-cafe>