[Haskell-cafe] Looking for pointfree version
Edsko de Vries
devriese at cs.tcd.ie
Mon Feb 9 09:18:18 EST 2009
Hi,
Is there a nice way to write
down :: Focus -> [Focus]
down p = concat [downPar p, downNew p, downTrans p]
in point-free style? (In doesn't make much difference what these
functions do; if it helps, their types are downPar, downNew,
downTrans :: Focus -> [Focus]).
Ideally, I would like to write something like
down = downPar ... downNew ... downTrans
but I'm not sure what should be on the dots. This works:
down = concat . flip map [downPar, downNew, downTrans] . flip ($)
but is extremely ugly and doesn't really explain what's going on :)
(It seems to me I should be able to take advantage of the list monad,
somehow).
Pointers appreciated!
Edsko
More information about the Haskell-Cafe
mailing list