on master help sign in
Hide equality constraints (hack)
238b01dCsongor Kiss
src/Data/Generics/Product/Fields.hs+9−5
@@ -133,15 +133,19 @@ instance
133 ) => HasField' field s a where
133 ) => HasField' field s a where
134 field' f s = VL.ravel (repLens . glens @(HasTotalFieldPSym field)) f s
134 field' f s = VL.ravel (repLens . glens @(HasTotalFieldPSym field)) f s
135
135
136+class (~~) a b | a -> b, b -> a
137+instance (a ~ b) => (~~) a b
138+
136instance -- see Note [Changing type parameters]
139instance -- see Note [Changing type parameters]
137 ( Generic s
140 ( Generic s
138 , Generic t
141 , Generic t
139 , ErrorUnless field s (CollectField field (Rep s))
142 , ErrorUnless field s (CollectField field (Rep s))
140− , HasTotalFieldP field (Rep s) ~ 'Just a
143+ , HasTotalFieldP field (Rep s) ~~ 'Just a
141− , HasTotalFieldP field (Rep (Indexed s)) ~ 'Just a'
144+ , HasTotalFieldP field (Rep t) ~~ 'Just b
145+ , HasTotalFieldP field (Rep (Indexed s)) ~~ 'Just a'
142− , HasTotalFieldP field (Rep (Indexed t)) ~ 'Just b'
146+ , HasTotalFieldP field (Rep (Indexed t)) ~~ 'Just b'
143− , t ~ Infer s a' b
147+ , t ~~ Infer s a' b
144− , s ~ Infer t b' a
148+ , s ~~ Infer t b' a
145 , GLens (HasTotalFieldPSym field) (Rep s) (Rep t) a b
149 , GLens (HasTotalFieldPSym field) (Rep s) (Rep t) a b
146 ) => HasField field s t a b where
150 ) => HasField field s t a b where
147 field f s = VL.ravel (repLens . glens @(HasTotalFieldPSym field)) f s
151 field f s = VL.ravel (repLens . glens @(HasTotalFieldPSym field)) f s
src/Data/Generics/Product/Positions.hs+11−5
@@ -112,16 +112,22 @@ instance
112 position' f s = VL.ravel (repLens . coerced @cs @cs . glens @(HasTotalPositionPSym i)) f s
112 position' f s = VL.ravel (repLens . coerced @cs @cs . glens @(HasTotalPositionPSym i)) f s
113 {-# INLINE position' #-}
113 {-# INLINE position' #-}
114
114
115+-- this is to 'hide' the equality constraints which interfere with inlining
116+-- pre 8.4.3
117+class (~~) a b | a -> b, b -> a
118+instance (a ~ b) => (~~) a b
119+
115instance -- see Note [Changing type parameters]
120instance -- see Note [Changing type parameters]
116 ( Generic s
121 ( Generic s
117 , Generic t
122 , Generic t
118 , ErrorUnless i s (0 <? i && i <=? Size (Rep s))
123 , ErrorUnless i s (0 <? i && i <=? Size (Rep s))
119 , GLens (HasTotalPositionPSym i) (CRep s) (CRep t) a b
124 , GLens (HasTotalPositionPSym i) (CRep s) (CRep t) a b
120− , HasTotalPositionP i (CRep s) ~ 'Just a
125+ , HasTotalPositionP i (CRep s) ~~ 'Just a
121− , HasTotalPositionP i (CRep (Indexed s)) ~ 'Just a'
126+ , HasTotalPositionP i (CRep t) ~~ 'Just b
127+ , HasTotalPositionP i (CRep (Indexed s)) ~~ 'Just a'
122− , HasTotalPositionP i (CRep (Indexed t)) ~ 'Just b'
128+ , HasTotalPositionP i (CRep (Indexed t)) ~~ 'Just b'
123− , t ~ Infer s a' b
129+ , t ~~ Infer s a' b
124− , s ~ Infer t b' a
130+ , s ~~ Infer t b' a
125 , Coercible (CRep s) (Rep s)
131 , Coercible (CRep s) (Rep s)
126 , Coercible (CRep t) (Rep t)
132 , Coercible (CRep t) (Rep t)
127 ) => HasPosition i s t a b where
133 ) => HasPosition i s t a b where