on master help sign in
Optimise typed lens
8b4b619Csongor Kiss
src/Data/Generics/Product/Typed.hs+1−1
@@ -83,7 +83,7 @@ instance
83 , GHasType (Rep s) a
83 , GHasType (Rep s) a
84 ) => HasType a s where
84 ) => HasType a s where
85
85
86− typed = repIso . gtyped
86+ typed = ravel (repIso . gtyped)
87
87
88type family ErrorUnlessOne (a :: Type) (s :: Type) (count :: Count) :: Constraint where
88type family ErrorUnlessOne (a :: Type) (s :: Type) (count :: Count) :: Constraint where
89 ErrorUnlessOne a s 'None
89 ErrorUnlessOne a s 'None
test/Spec.hs+3
@@ -50,6 +50,9 @@ subtypeLensManual f record
50fieldP :: Proof
50fieldP :: Proof
51fieldP = L fieldALensManual === L (field @"fieldA")
51fieldP = L fieldALensManual === L (field @"fieldA")
52
52
53+typedP :: Proof
54+typedP = L fieldALensManual === L (typed @Int)
55+
53posP :: Proof
56posP :: Proof
54posP = L fieldALensManual === L (position @1)
57posP = L fieldALensManual === L (position @1)
55
58