3 ms·
Haskell does. Roughly the author's example using monads: [[10..20], [50..100]] >>= id >>= classify The only thing you can't directly do with monads is the
by yummyfajitas 17y ago
Haskell does. Roughly the author's example using monads:
[[10..20], [50..100]] >>= id >>= classify
The only thing you can't directly do with monads is the fold, since the fold breaks you out of the monad. Also, you could use arrows:
myCounter = ( concat >>> (map classify) >>> (foldr getCounts (0,0,0)) )
Then myCounter [ [10..20], [50..60]] is the function you want.
- yummyfajitas 17y agoActually, just realized you can do everything with monads. (return [[10..20], [50..100]] >>= concat >>= classify >>= foldr getCount (0,0,0)) Just use the identity monad rather than the list monad.