awalterschulze / goderive

Derives and generates mundane golang functions that you do not want to maintain yourself
Apache License 2.0
1.23k stars 44 forks source link

Feature request: deriveFmap for functor compositions #43

Open guoshimin opened 6 years ago

guoshimin commented 6 years ago

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)

awalterschulze commented 6 years ago

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 commented 6 years ago

Hello?

awalterschulze commented 6 years ago

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 commented 6 years ago

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