[Haskell-cafe] about Haskell code written to be "too smart"

John Meacham john at repetae.net
Tue Mar 24 21:17:07 EDT 2009


On Tue, Mar 24, 2009 at 10:29:55PM +0300, Miguel Mitrofanov wrote:
> Maybe it's just me, but I think that
>
> takeList ns xs = evalState (mapM (State . splitAt) ns) xs
>
> or even
>
> takeList = evalState . map (State . splitAt)
>
> would be much clearer than both versions.

I love it! It wouldn't occur to me to utilize State like this (too used
to thinking of it as a black box rather than whats inside of it). quite
a lot of useful information to learn can be expressed in a line of
haskell. sort of like a zen koan. :)

        John

-- 
John Meacham - ⑆repetae.net⑆john⑈


More information about the Haskell-Cafe mailing list