4 ms·
example: nWords = liftM (train . lowerWords . B.unpack) (B.readFile "big.txt") There was recently a very good article[0] about practically using monads th
by codygman 12y ago
example:
nWords = liftM (train . lowerWords . B.unpack) (B.readFile "big.txt")
There was recently a very good article[0] about practically using monads that mentioned using liftM.
However whenever using a functor instance is possible it's probably better, since functors can't do as much as monads. I'm not quite sure how much this would help/apply to this small example though.
0: http://softwaresimply.blogspot.com/2014/12/ltmt-part-3-monad-cookbook.html?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+SoftwareSimply+%28Software+Simply%29 http://softwaresimply.blogspot.com/2014/12/ltmt-part-3-monad...