[Haskell-cafe] a beginner question: decorate-op-undecorate
Aran Donohue
aran.donohue at gmail.com
Fri Feb 5 21:23:27 EST 2010
Thanks for the helpful thoughts.
I guess I was just reaching for a Haskell version of a programming pattern
from other languages---dealing with baggage if you will.
Thanks,
Aran
On Fri, Feb 5, 2010 at 7:24 PM, Luke Palmer <lrpalmer at gmail.com> wrote:
> On Fri, Feb 5, 2010 at 10:34 AM, Aran Donohue <aran.donohue at gmail.com>
> wrote:
> > What would be an idiomatic Haskell way to accomplish this? Currently I've
> > got "liftedPartitionEithers :: [a] -> (a -> Either b c) -> ([a],
> [a])" which
> > is my own version of partitionEithers that calls a selector first.
>
> Since you are not using b or c anywhere else, the only thing you care
> about in that Either is whether it is Left or Right. Which makes it
> seem much more like a Bool. After this conversion, I can hoogle for
> your signature.
>
>
> http://haskell.org/hoogle/?hoogle=[a]+-%3E+%28a+-%3E+Bool%29+-%3E+%28[a]%2C[a]%29
>
> Which gives, among other things, Data.List.partition :: (a -> Bool) ->
> [a] -> ([a],[a]).
>
> Without more details about the precise thing you want to accomplish, I
> don't know what else to say. Many idioms are about the details of the
> problem, even down to argument order.
>
> Luke
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100205/54d9c8eb/attachment.html
More information about the Haskell-Cafe
mailing list