on master help sign in
"Corep" is wrong. "Representable" is what I wanted.
commit4caf38d8f1e3dc23dfb7c2dd450a678182bcdb50 authorShane O'Brien <shane.obrien@circuithub.com> dateSun 13 Jun 2021, 19:21 (5 years ago) parente15f360
3 files changed+40−40
src/Rel8/Generic/Construction.hs+18−18 src/Rel8/Generic/Construction/ADT.hs+14−14 src/Rel8/Generic/Construction/Record.hs+8−8
src/Rel8/Generic/Construction.hs+18−18
@@ -47,13 +47,13 @@ import Rel8.Generic.Construction.ADT
4747 , GConstructableADT
4848 , GBuildADT, gbuildADT, gunbuildADT
4949 , GConstructADT, gconstructADT, gdeconstructADT
50− , CorepConstructors, GConstructors, gcindex, gctabulate
51− , CorepFields, gfindex, gftabulate, gftraverse
50+ , RepresentableConstructors, GConstructors, gcindex, gctabulate
51+ , RepresentableFields, gfindex, gftabulate, gftraverse
5252 )
5353import Rel8.Generic.Construction.Record
5454 ( GConstructor
5555 , GConstructable, GConstruct, gconstruct, gdeconstruct
56− , Corep, gindex, gtabulate, gtraverse
56+ , Representable, gindex, gtabulate, gtraverse
5757 )
5858import Rel8.Generic.Table ( GGColumns )
5959import Rel8.Kind.Algebra
@@ -99,14 +99,14 @@ type family GGBuildable' algebra name rep where
9999 GGBuildable' 'K.Product name rep =
100100 ( name ~ GConstructor (Eval (rep (Reify Expr)))
101101 , name ~ GConstructor (Eval (rep (Reify Insert)))
102− , Corep TUnreify (Eval (rep (Reify Expr)))
103− , Corep TUnreify (Eval (rep (Reify Insert)))
102+ , Representable TUnreify (Eval (rep (Reify Expr)))
103+ , Representable TUnreify (Eval (rep (Reify Insert)))
104104 , GConstructable (TTable (Reify Expr)) TColumns TUnreify (Col (Reify Expr)) (Eval (rep (Reify Expr)))
105105 , GConstructable (TTable (Reify Insert)) TColumns TUnreify (Col (Reify Insert)) (Eval (rep (Reify Insert)))
106106 )
107107 GGBuildable' 'K.Sum name rep =
108− ( Corep TUnreify (GConstructorADT name (Eval (rep (Reify Expr))))
109− , Corep TUnreify (GConstructorADT name (Eval (rep (Reify Insert))))
108+ ( Representable TUnreify (GConstructorADT name (Eval (rep (Reify Expr))))
109+ , Representable TUnreify (GConstructorADT name (Eval (rep (Reify Insert))))
110110 , GMakeableADT (TTable (Reify Expr)) TColumns TUnreify (Col (Reify Expr)) name (Eval (rep (Reify Expr)))
111111 , GMakeableADT (TTable (Reify Insert)) TColumns TUnreify (Col (Reify Insert)) name (Eval (rep (Reify Insert)))
112112 )
@@ -213,23 +213,23 @@ type GGConstructable algebra rep =
213213type GGConstructable' :: K.Algebra -> (K.Context -> Exp (Type -> Type)) -> Constraint
214214type family GGConstructable' algebra rep where
215215 GGConstructable' 'K.Product rep =
216− ( Corep (Compose Aggregate TUnreify) (Eval (rep (Reify Expr)))
217− , Corep TUnreify (Eval (rep (Reify Aggregate)))
218− , Corep TUnreify (Eval (rep (Reify Expr)))
219− , Corep TUnreify (Eval (rep (Reify Insert)))
220− , Corep TUnreify (Eval (rep (Reify Name)))
216+ ( Representable (Compose Aggregate TUnreify) (Eval (rep (Reify Expr)))
217+ , Representable TUnreify (Eval (rep (Reify Aggregate)))
218+ , Representable TUnreify (Eval (rep (Reify Expr)))
219+ , Representable TUnreify (Eval (rep (Reify Insert)))
220+ , Representable TUnreify (Eval (rep (Reify Name)))
221221 , GConstructable (TTable (Reify Aggregate)) TColumns TUnreify (Col (Reify Aggregate)) (Eval (rep (Reify Aggregate)))
222222 , GConstructable (TTable (Reify Expr)) TColumns TUnreify (Col (Reify Expr)) (Eval (rep (Reify Expr)))
223223 , GConstructable (TTable (Reify Insert)) TColumns TUnreify (Col (Reify Insert)) (Eval (rep (Reify Insert)))
224224 , GConstructable (TTable (Reify Name)) TColumns TUnreify (Col (Reify Name)) (Eval (rep (Reify Name)))
225225 )
226226 GGConstructable' 'K.Sum rep =
227− ( CorepConstructors TUnreify (Eval (rep (Reify Expr)))
228− , CorepConstructors TUnreify (Eval (rep (Reify Insert)))
229− , CorepFields (Compose Aggregate TUnreify) (Eval (rep (Reify Expr)))
230− , CorepFields TUnreify (Eval (rep (Reify Aggregate)))
231− , CorepFields TUnreify (Eval (rep (Reify Expr)))
232− , CorepFields TUnreify (Eval (rep (Reify Name)))
227+ ( RepresentableConstructors TUnreify (Eval (rep (Reify Expr)))
228+ , RepresentableConstructors TUnreify (Eval (rep (Reify Insert)))
229+ , RepresentableFields (Compose Aggregate TUnreify) (Eval (rep (Reify Expr)))
230+ , RepresentableFields TUnreify (Eval (rep (Reify Aggregate)))
231+ , RepresentableFields TUnreify (Eval (rep (Reify Expr)))
232+ , RepresentableFields TUnreify (Eval (rep (Reify Name)))
233233 , Functor (GConstructors TUnreify (Eval (rep (Reify Expr))))
234234 , Functor (GConstructors TUnreify (Eval (rep (Reify Insert))))
235235 , GConstructableADT (TTable (Reify Aggregate)) TColumns TUnreify (Col (Reify Aggregate)) (Eval (rep (Reify Aggregate)))
src/Rel8/Generic/Construction/ADT.hs+14−14
@@ -16,8 +16,8 @@ module Rel8.Generic.Construction.ADT
1616 ( GConstructableADT
1717 , GBuildADT, gbuildADT, gunbuildADT
1818 , GConstructADT, gconstructADT, gdeconstructADT
19− , GFields, CorepFields, gftabulate, gfindex, gftraverse
20− , GConstructors, CorepConstructors, gctabulate, gcindex
19+ , GFields, RepresentableFields, gftabulate, gfindex, gftraverse
20+ , GConstructors, RepresentableConstructors, gctabulate, gcindex
2121 , GConstructorADT, GMakeableADT, gmakeADT
2222 )
2323where
@@ -44,7 +44,7 @@ import Prelude hiding ( null )
4444import Rel8.FCF ( Compose, Exp )
4545import Rel8.Generic.Construction.Record
4646 ( GConstruct, GConstructable, gconstruct, gdeconstruct
47− , GFields, Corep, gtabulate, gindex, gtraverse
47+ , GFields, Representable, gtabulate, gindex, gtraverse
4848 , FromColumns, ToColumns
4949 )
5050import Rel8.Generic.Table.ADT ( GColumnsADT, GColumnsADT' )
@@ -126,26 +126,26 @@ type family GConstructors f rep where
126126 GConstructors f (M1 C _ rep) = (->) (GFields f rep)
127127
128128
129−type CorepConstructors :: (Type -> Exp Type) -> (Type -> Type) -> Constraint
130−class CorepConstructors f rep where
129+type RepresentableConstructors :: (Type -> Exp Type) -> (Type -> Type) -> Constraint
130+class RepresentableConstructors f rep where
131131 gctabulate :: (GConstructors f rep r -> a) -> GConstructADT f rep r a
132132 gcindex :: GConstructADT f rep r a -> GConstructors f rep r -> a
133133
134134
135−instance CorepConstructors f rep => CorepConstructors f (M1 D meta rep) where
135+instance RepresentableConstructors f rep => RepresentableConstructors f (M1 D meta rep) where
136136 gctabulate = gctabulate @f @rep
137137 gcindex = gcindex @f @rep
138138
139139
140−instance (CorepConstructors f a, CorepConstructors f b) =>
141− CorepConstructors f (a :+: b)
140+instance (RepresentableConstructors f a, RepresentableConstructors f b) =>
141+ RepresentableConstructors f (a :+: b)
142142 where
143143 gctabulate f =
144144 gctabulate @f @a \a -> gctabulate @f @b \b -> f (a :*: b)
145145 gcindex f (a :*: b) = gcindex @f @b (gcindex @f @a f a) b
146146
147147
148−instance Corep f rep => CorepConstructors f (M1 C meta rep) where
148+instance Representable f rep => RepresentableConstructors f (M1 C meta rep) where
149149 gctabulate f = f . gindex @f @rep
150150 gcindex f = f . gtabulate @f @rep
151151
@@ -164,8 +164,8 @@ type family GFieldsADT f rep where
164164 GFieldsADT f (M1 C _ rep) = GFields f rep
165165
166166
167−type CorepFields :: (Type -> Exp Type) -> (Type -> Type) -> Constraint
168−class CorepFields f rep where
167+type RepresentableFields :: (Type -> Exp Type) -> (Type -> Type) -> Constraint
168+class RepresentableFields f rep where
169169 gftabulate :: (GFieldsADT f rep -> a) -> GBuildADT f rep a
170170 gfindex :: GBuildADT f rep a -> GFieldsADT f rep -> a
171171 gftraverse :: Applicative m
@@ -173,20 +173,20 @@ class CorepFields f rep where
173173 -> GFieldsADT (Compose g f) rep -> m (GFieldsADT f rep)
174174
175175
176−instance CorepFields f rep => CorepFields f (M1 D meta rep) where
176+instance RepresentableFields f rep => RepresentableFields f (M1 D meta rep) where
177177 gftabulate = gftabulate @f @rep
178178 gfindex = gfindex @f @rep
179179 gftraverse = gftraverse @f @rep
180180
181181
182−instance (CorepFields f a, CorepFields f b) => CorepFields f (a :+: b) where
182+instance (RepresentableFields f a, RepresentableFields f b) => RepresentableFields f (a :+: b) where
183183 gftabulate f =
184184 gftabulate @f @a \a -> gftabulate @f @b \b -> f (a, b)
185185 gfindex f (a, b) = gfindex @f @b (gfindex @f @a f a) b
186186 gftraverse f (a, b) = liftA2 (,) (gftraverse @f @a f a) (gftraverse @f @b f b)
187187
188188
189−instance Corep f rep => CorepFields f (M1 C meta rep) where
189+instance Representable f rep => RepresentableFields f (M1 C meta rep) where
190190 gftabulate = gtabulate @f @rep
191191 gfindex = gindex @f @rep
192192 gftraverse = gtraverse @f @rep
src/Rel8/Generic/Construction/Record.hs+8−8
@@ -13,7 +13,7 @@
1313
1414module Rel8.Generic.Construction.Record
1515 ( GConstructor, GConstruct, GConstructable, gconstruct, gdeconstruct
16− , GFields, Corep, gtabulate, gindex, gtraverse
16+ , GFields, Representable, gtabulate, gindex, gtraverse
1717 , FromColumns, ToColumns
1818 )
1919where
@@ -88,8 +88,8 @@ type family GFields f rep where
8888 GFields f (K1 _ a) = Eval (f a)
8989
9090
91−type Corep :: (Type -> Exp Type) -> (Type -> Type) -> Constraint
92−class Corep f rep where
91+type Representable :: (Type -> Exp Type) -> (Type -> Type) -> Constraint
92+class Representable f rep where
9393 gtabulate :: (GFields f rep -> a) -> GConstruct f rep a
9494 gindex :: GConstruct f rep a -> GFields f rep -> a
9595 gtraverse :: Applicative m
@@ -97,27 +97,27 @@ class Corep f rep where
9797 -> GFields (Compose g f) rep -> m (GFields f rep)
9898
9999
100−instance Corep f rep => Corep f (M1 i meta rep) where
100+instance Representable f rep => Representable f (M1 i meta rep) where
101101 gtabulate = gtabulate @f @rep
102102 gindex = gindex @f @rep
103103 gtraverse = gtraverse @f @rep
104104
105105
106−instance (Corep f a, Corep f b) =>
107− Corep f (a :*: b)
106+instance (Representable f a, Representable f b) =>
107+ Representable f (a :*: b)
108108 where
109109 gtabulate f = gtabulate @f @a \a -> gtabulate @f @b \b -> f (a, b)
110110 gindex f (a, b) = gindex @f @b (gindex @f @a f a) b
111111 gtraverse f (a, b) = liftA2 (,) (gtraverse @f @a f a) (gtraverse @f @b f b)
112112
113113
114−instance Corep f U1 where
114+instance Representable f U1 where
115115 gtabulate = ($ ())
116116 gindex = const
117117 gtraverse = const pure
118118
119119
120−instance Corep f (K1 i a) where
120+instance Representable f (K1 i a) where
121121 gtabulate = id
122122 gindex = id
123123 gtraverse = id