You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently we have a bunch of in-house type classes that are similar to what's offered by barbies, and we're trying to get rid of them. Our in-house approach works, but it doesn't separate the constraints from the operations. E.g., we have something like
The environment transformer, data EnvT e w a = EnvT e (w a) is another example, and we have a few other internal types that also follow the same pattern.
I've managed a workaround by adding a type parameter to AddT and having taddDicts pass x for that, allowing you to optionally specify c x when you define AddT for your instance:
Thinking out loud (sorry I don't have time to try it out myself at the moment), maybe you could you define your types to be barbies instead, and then use Barbies.Bi.Flip to get the transformers interface you want? Something along the lines of
I have a simple case that I can't seem to define (or derive) a
ConstraintsT
instance for:The problem is the
f a
. The example in the docs (thank you for even having examples!) usingT
at https://hackage.haskell.org/package/barbies-2.0.1.0/docs/Data-Functor-Transformer.html#g:8 doesn't usea
at all. I can't see how you could possibly specify ac a
constraint in theAllT
type.Currently we have a bunch of in-house type classes that are similar to what's offered by barbies, and we're trying to get rid of them. Our in-house approach works, but it doesn't separate the constraints from the operations. E.g., we have something like
The environment transformer,
data EnvT e w a = EnvT e (w a)
is another example, and we have a few other internal types that also follow the same pattern.I've managed a workaround by adding a type parameter to
AddT
and havingtaddDicts
passx
for that, allowing you to optionally specifyc x
when you defineAddT
for your instance:However, that doesn't fully solve things in my case. The next step is a GADT, like
where it can't find an instance for
c a
, and I don't even know where to begin on this one.The text was updated successfully, but these errors were encountered: