6 ms·
Wouldn't it be nice if it was just: toUpperCase . guard (\x -> length x /= 0) . trim I think that is how it would be if it was part of the language.
by farginay 13y ago
Wouldn't it be nice if it was just:
toUpperCase . guard (\x -> length x /= 0) . trim
I think that is how it would be if it was part of the language.
- deleted 13y ago[deleted]
- DanWaterworth 13y agoI like my code to do what it says. You can pretty much do that in Haskell. If you allow me to add a definition first: mfilter' :: MonadPlus m => (a -> Bool) -> a -> m a mfilter' f = mfilter f . return Then it's just: toUpperCase <=< mfilter' (\x -> length x /= 0) . trim Which is pretty close. No need to change the language.