[Haskell-cafe] Looking for pointfree version

Aai bradypus at xs4all.nl
Mon Feb 9 09:42:29 EST 2009


Rewriting it to:

concatMap ($ p)[downPar , downNew , downTrans ]

gives:

($ p) =<< [downPar, downNew, downTrans]

didn't check though!


=@@i


Edsko de Vries schreef:
> 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
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe




More information about the Haskell-Cafe mailing list