Closed echatav closed 1 month ago
I'm not sure this will work. When I did generic symbolic data before in a PoC, I took advantage of the fact that the datatypes were not just parametrized by their BaseField
but that it was literally the last parameter of the datatype so I could use GHC.Generic.Rep1
instead of GHC.Generic.Rep
. But it feels like it should work.
We need this, yeah!
Was going to call it Layout
though, but SymbolicRep
is also ok, I guess
Is there a problem with removing the TypeSize
parameter altogether and migrating to Type -> Type
immediately right now?
I'm not sure this will work. When I did generic symbolic data before in a PoC, I took advantage of the fact that the datatypes were not just parametrized by their
BaseField
but that it was literally the last parameter of the datatype so I could useGHC.Generic.Rep1
instead ofGHC.Generic.Rep
. But it feels like it should work.
Just Rep
from Generics
, I'm afraid, is not going to work, because it wouldn't propagate the type parameters to built-in types correctly. But our default type family over Rep
should work just fine.
Is there a problem with removing the TypeSize parameter altogether and migrating to Type -> Type immediately right now?
Not in theory, but, it's potentially an optimization for any call to typeSize
to make use of a compile time calculation like TypeSize
instead of having to use something like Foldable.length (pureRep ())
and it's convenient to have. As long as the compile time computations are not slowing us down as devs too much! I'd say keep it and have sensible laws when you have (KnownNat TypeSize, Representable Layout, Foldable Layout)
.
I feel like Support
is like InputSpace
and Layout
is like OutputSpace
.
Not in theory, but, it's potentially an optimization for any call to
typeSize
to make use of a compile time calculation likeTypeSize
After this migration, I doubt that we'd need typeSize
at all! Other than that, I see your point
(Although we could still compute TypeSize
from Layout
with a type family)
I feel like
Support
is likeInputSpace
andLayout
is likeOutputSpace
.
Yeah, they're related, it's only that Support
is Type
while InputSpace
was Type -> Type
.
(And I'd prefer the support argument to keep being Type
to keep the logic of adding input constraints separate from restore
)
Add an associated
SymbolicRep
type toSymbolicData
in preparation forGeneric
deriving, see #221 .