Since there's talk of removal of the composition operator in Haskell-prime, how about this:

Instead of:
foo = f . g

you write:
foo = .g.f

A leading dot would mean, "apply all unnamed parameters to the function on the right".  A trailing dot would mean, "apply the result of the left to the function on the right".

Prelude> notNull = .null.not
=> [a] -> Bool

notNull [1,2,3]
=> True

[1,2,3].notNull
=> True

[1,2,3].null.not
=> True


I like this because it has the same perks as the composition operator, yet it looks like OO code and the data flows nicely from left to right.  It reads especially well when using the bind operator on the same line.

Thoughts?

Thanks,
Greg






_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to