Oh, but making numbers, or constants in general, into functions is very much in line with the underlying mathematics of functional programming.
An element of an object in a nice category - say, for instance a data type in an appropriate category of data types and computable functions - is a computable function from the terminal object (to which there is one unique map from every other object) to your object.
So, in Haskell terms, an element is just a 0-ary function 1 :: () -> Int and then the compiler is gracious enough to give us syntax sugar for 0-ary functions.
(no subject)
Date: 2009-07-31 06:19 am (UTC)An element of an object in a nice category - say, for instance a data type in an appropriate category of data types and computable functions - is a computable function from the terminal object (to which there is one unique map from every other object) to your object.
So, in Haskell terms, an element is just a 0-ary function
1 :: () -> Int
and then the compiler is gracious enough to give us syntax sugar for 0-ary functions.