Reputation: 338
g a
is a concrete type, I am thinking of doing [g (m a)] -> [m (g a)] -> m [g a]
, and I know the last step can be done with sequence :: Monad m => t (m a) -> m (t a)
. How would I achieve the first step?
Upvotes: 1
Views: 77
Reputation: 153162
It's pretty straightforward:
sequenceLEdge :: Functor f => LEdge (f a) -> f (LEdge a)
sequenceLEdge (l, r, act) = fmap (\v -> (l, r, v)) act
Probably there should be Foldable
and Traversable
instances for triples and larger tuples so you don't need to write this by hand, but there aren't for now, so...
Upvotes: 4