Open flip111 opened 1 year ago
@flip111 , here is a similar issue that appears in https://github.com/eskimor/purescript-bridge/pull/77
Given this
import Data.Either (Either)
import Data.Generic.Rep (class Generic)
import Data.Maybe (Maybe(..))
import Data.Newtype (class Newtype)
data Bar a b m c
= Bar1 (Maybe a)
| Bar2 (Either a b)
| Bar3 a
| Bar4 { myMonadicResult :: m b }
should purescript-bridge
generate this?
derive instance (Generic a ra, Generic b rb, Generic (m b) rmb) => Generic (Bar a b m c) _
or this?
derive instance Generic (Bar a b m c) _
Thanks
I think we will need some means of telling the code generator what is correct. There are cases where you want the constraint on the type parameters, sometimes you don't. Depends very much on the type class at hand and the type.
@peterbecich i'm not sure. Could you pass flag -ddump-deriv to GHC and paste the haskell code for the Generic implementation?
The generated purescript code looks like this
But instead the instance should be like this