would like Promise.flatMap to exist
-
-
[Promise<[T]>] -> Promise<[T]>
3 replies 0 retweets 0 likesShow this thread -
this isn't really flatMap it's more like internal concat
2 replies 0 retweets 0 likesShow this thread -
-
Replying to @sgrif
does this generalise for any monad m? i.e. [m [a]] -> m [a] or even n (m (n a)) -> m (n a), if m and n are monads like, you're flattening one monad that's got another one sandwiched in between
1 reply 0 retweets 0 likes -
Replying to @mountain_ghosts
Yeah, `sequenceA . (fmap join)` should (not 100% sure I have syntax correct there, but use sequenceA to get `m (n (n a))`, and then fmap join gives you `m (n a)`
1 reply 0 retweets 0 likes
Replying to @sgrif @mountain_ghosts
Sorry, I missed part of that. This does not generalize to all monads, it's from `Traversable` which includes most but not all monads
2:51 PM - 14 Jun 2019
0 replies
0 retweets
0 likes
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.