goderive icon indicating copy to clipboard operation
goderive copied to clipboard

Feature request: deriveFmap for functor compositions

Open guoshimin opened this issue 7 years ago • 4 comments

Just a thought: seems it would be feasible to derive fmap for functors that are the composition of two or more functors, such as deriveFmap(func(A) B, func() ([A], error)) ([B], error)

guoshimin avatar Oct 06 '17 17:10 guoshimin

Interesting. I can see this example working. Maybe you can provide a few more which include some joins, to see how we would handle stacked monads as well. Just to make sure our theory is sound, before we start implementing. What do you think?

awalterschulze avatar Oct 06 '17 18:10 awalterschulze

Hello?

awalterschulze avatar Dec 02 '17 11:12 awalterschulze

I think what we want here is traverse:

traverse :: Applicative f => (a -> f b) -> t a -> f (t b)

where f is (b, error) and t is a slice

awalterschulze avatar Dec 09 '17 14:12 awalterschulze

Oh no thats not what you were referring to, my bad.

awalterschulze avatar Dec 09 '17 14:12 awalterschulze