
Thiago Negri
@Ertugrul, you don't need to be rude.
Sorry if this sounded rude, but it really wasn't supposed to be. As said, I liked Costello's attempt. I just found that the solution is already in the base library in a way that doesn't require wrapping things up in a constructor.
@Costello,
I like your idea. But I don't see an advantage to using "Function 4" over simply "4":
What's the advantage of using this: (value . square . sucessor . lift) 4 data Lift a = Function a lift = Function sucesor (Function a) = lift (a + 1) square (Function a) = lift (a * a) value (Function a) = a
Over this: (square . sucessor) 4 sucessor = (+1) square a = a * a
I think that Costello is really referring to something called function-level programming where you don't have values, but only so-called functionals and composition. A value is then represented by a constant function, which is exactly what 'const' and 'pure' are. This is the essence of SKI calculus. It gets rid of all lambda abstractions. The remainder is then an (unintelligible) expression of S and K applications, but Haskell also has the power of Category, so this can actually become readable code. Greets, Ertugrul -- Not to be or to be and (not to be or to be and (not to be or to be and (not to be or to be and ... that is the list monad.