News for hackers. Stuff that matters.
Re:Once you go functional, you can never go back by sriku on Wednesday May 20, 2015 @11:55PM (#9580874)
You're partially right, but function composition features in the type world too. For example, when you say -

    data Tree a = Leaf a | Branch (Tree a) (Tree a)
It looks like you're dealing purely with types, however you've declared two constructors "Leaf" and "Branch" which are, in essence, functions with the following signatures -

    Leaf :: a -> Tree a
    Branch :: Tree a -> Tree a -> Tree a
Additionally, you have `Branch` being an operation that's closed on trees (i.e. maps trees to trees), which composes nicely.

On top of that, type classes are mechanisms to talk about which functions can be called on which data, hence guiding which functions can be composed with which others.

There are no comments on this comment yet.