[Haskell-cafe] Re: Practise fingerspelling with Haskell! (Code
cleanup request)
Dougal Stanton
ithika at gmail.com
Wed Jul 18 18:37:34 EDT 2007
On 18/07/07, J. Garrett Morris <trevion at gmail.com> wrote:
> You're partway there - concatMap is flip (>>=), so you have the xs >>=
> (\x -> <stuff>) part.
Ah, yes! I read about this equivalence in one of the other threads
today but it didn't make any connection. Doh!
I think I will have to, sooner or later, become more versed in the
subtle ways of non-IO monads. They seem to be capable of some
seriously tricksy shenanigans.
In other news, I worked out a few minutes ago while walking home that
the whole keepOneDiff function (used in my program above) is
incredibly convoluted, to the point of Heath Robinson contortions. To
be clear, I had:
> keepOneDiff = map snd . filter (\x -> (fst x) < 2) . map (difference &&& id)
Where I could have just done this...
> keepOneDiff = filter ((< 2) . difference)
Sometimes I am astounded at my own lack of vision. :-O
Clearly, today has not been a good day.
Cheers for all your help folks,
Dougal.
More information about the Haskell-Cafe
mailing list