Stephen Diehl's protolude library is excellent. I highly recommend it as a default prelude for Haskell.
It's so good and so close to what I want that whenever I do come across something missing it's as obvious as a glitch in good music.
Here's what I'd like:
(<<$>>) :: (Functor f, Functor g) => (a -> b) -> f (g a) -> f (g b)
(<<$>>) = fmap . fmap
I do this enough that I'd like it to hand. Pi Delport suggested the syntax & that it should be in a standard library somewhere.
I want for
to be flip fmap
and forA
to be what's currently for
(protolude/protolude#19).
From the pretty-show library.
A very simple pretty printer, great for debugging data structures. Would have to be adjusted for better string types for protolude.
Like traceShow
, but pretty. Doesn't actually exist yet.
guarded :: Alternative f => (a -> Bool) -> a -> f a
guarded p x = bool empty (pure x) (p x)
Another great idea from Pi Delport.
All of these functions should be added as of 0.1.10. Any issues please report on the issue tracker. Thanks!