this isn't really flatMap it's more like internal concat
-
Show this thread
-
-
Replying to @sgrif @mountain_ghosts
sequenceA :: Applicative f => t (f a) -> f (t a)
1 reply 0 retweets 1 like -
Replying to @sgrif
I'm not sure that's what I want here, that looks like it's swapping two monads, which is what Promise.all does; it's [Promise a] -> Promise [a]
1 reply 0 retweets 0 likes -
-
Replying to @mountain_ghosts
If you can go `[Promise a]` to `Promise [a]` you can go `[Promise [a]]` to `Promise [[a]]` which is good enough since you can go from `[[a]]` to `[a]`
1 reply 0 retweets 1 like -
Replying to @sgrif @mountain_ghosts
Which... Isn't helpful at all to your original tweet now that I've read it again, since `Promise.all(promises).then(Array.prototype.flat)` is a thing, and having those be more generic isn't remotely helpful for what you asked for
2 replies 0 retweets 0 likes -
Replying to @sgrif @mountain_ghosts
I guess with the generic versions you can write a more generic version of exactly what you asked for
1 reply 0 retweets 0 likes -
Replying to @sgrif
I'm just curious about how much these monad container switches generalise -- I'm not sure why they need to be traversable compared to just supporting the notion of flatten/concat that one needs for >>=
1 reply 0 retweets 0 likes -
Replying to @mountain_ghosts
It's actually the other way around (sorry, I know I implied otherwise earlier -- I'm not a Haskell expert). Traversable is adjacent to Monad. e.g. you can go `HashMap<K, Future<V>>` to `Future<HashMap<K, V>>`, but not the other way around.
1 reply 0 retweets 1 like
I'm not sure of an example of a Monad that isn't also Traversable
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.