Am Mittwoch 17 Februar 2010 16:31:16 schrieb Sean Leather: > I find myself often writing this pattern: > > someFun x y z = ... > > > > fun y z = runFun $ someFun someDefault y z > > > or, alternatively: > > fun y = runFun . someFun someDefault y > > > The second option approaches the ideal pointfreeness (or pointlessness > if you prefer), but I'd like to go farther: > > (...) :: (c -> d) -> (a -> b -> c) -> a -> b -> d > > > (...) f g x y = f (g x y)
(...) = (.) . (.) > > infixr 9 ... > > fun = runFun ... someFun someDefault > > > There, that's better. More points for fewer points (which means I should > really change the name from fun to pun). > > Does anybody else care about this? What are some alternative solutions? o = (.) oo = (.) . (.) ooo = (.) . (.) . (.) -- etc. runFun `oo` someFun someDefault I've also seen (.:) = (.) . (.) runFun .: someFun someDefault I don't particularly like (...), it's too much like an ellipsis (and bad to count if you continue on that route), I prefer the 'spectacles' or (∘) = (.) (∘∘) = (.) . (.) > I'd love to have something like this available in the Prelude or a > library. (I have no strong feelings about the particular operator.) > > Regards, > Sean _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe