Num instance for functions
From HaskellWiki
(Difference between revisions)
(→See also: applicativenumbers link) 
(BASIC blog post) 

(One intermediate revision by one user not shown)  
Line 30:  Line 30:  
* http://www.haskell.org/pipermail/haskellcafe/2006October/019105.html 
* http://www.haskell.org/pipermail/haskellcafe/2006October/019105.html 

* http://www.haskell.org/pipermail/haskellcafe/2001February/001531.html 
* http://www.haskell.org/pipermail/haskellcafe/2001February/001531.html 

−  +  * http://augustss.blogspot.com/2009/02/regressiontheysaythatasyouget.html 

[[Category:Humor]] 
[[Category:Humor]] 

[[Category:Proposals]] 
[[Category:Proposals]] 

[[Category:FAQ]] 
[[Category:FAQ]] 

+  [[Category:Style]] 
Latest revision as of 11:53, 4 May 2011
Some people have argued, thatNum
(>)
to add functions nicely, say for
f, g :: Num a => b > a
you would define
(f+g) x = f x + g x
fromInteger
fromInteger = const
numeric literals would also denote constant functions. This allows
f+2 == \x > f x + 2
Even nicer, the mathematically established notation of omitting the multiplication dot
2(x+y) :: Integer
will now be parsed by a Haskell compiler to the most obvious meaning
2 :: Integer
! :)
[edit] 1 Note
This article is in category Proposals in order to show people that this idea was already proposed, but that one should think twice implementing it. There should be a category Counterproposals.
[edit] 2 See also
 The applicativenumbers package, which generates numeric class instances for arbitrary applicative functors (including functions).
 http://www.haskell.org/pipermail/haskellcafe/2006November/019374.html
 http://www.haskell.org/pipermail/haskellcafe/2006October/019105.html
 http://www.haskell.org/pipermail/haskellcafe/2001February/001531.html
 http://augustss.blogspot.com/2009/02/regressiontheysaythatasyouget.html