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
For example, functions like add have a Columnable constraint.
This makes sense but at the same time every single constructor of Expr has also a Columnable constraint, so even if the Columnable proof is hidden in GADT, Expr a implies Columnable a.
In a ideal world we don't need Columnable a => Expr a unless we remove it from the Expr constructors altogether. That way Expr could live outside of a DataFrame and possibly have a Functor and Applicative instance.
And when Columnable is required it can be added a constraint as it is already the case.
Idk what this would be. So it seems at the very least to keep things dynamic we have to constrain the results of expressions to be Typeable and Showable. The other constraints are overkill (Eq, Ord, Read) - and I'm planning on removing them over time.
If I understand well, you can't write something like
because you don't know what is in the DataFrame therefore all columns needs to be Typeable and Showable.
But that doesn't mean a Column need to Showable and Typeable, only the column in DataFrame needs to.
Anyway, my point what you don't need add :: (Columnable a, Num a ) -> Expr a -> Expra
You only need add :: Num a -> Expr a -> Expr a, because each Col constructor holds it' on Columnable constaint.
Alternatively , you don't need the constraints in the GADT (unless I a missing something of course)
Activity
mchav commentedon Feb 19, 2026
Hmmm...in principle someone could define something like:
You could then do:
Idk what this would be. So it seems at the very least to keep things dynamic we have to constrain the results of expressions to be Typeable and Showable. The other constraints are overkill (Eq, Ord, Read) - and I'm planning on removing them over time.
But short of making dataframes that look like this: https://hengchu.github.io/posts/2018-05-09-type-lists-and-type-classes.lhs.html
I think the dynamic approach requires you to constrain things a little bit. Maybe I'm missing some type level tricks one could do to prevent this.
maxigit commentedon Feb 19, 2026
If I understand well, you can't write something like
because you don't know what is in the DataFrame therefore all columns needs to be Typeable and Showable.
But that doesn't mean a
Columnneed toShowableandTypeable, only the column in DataFrame needs to.Anyway, my point what you don't need
add :: (Columnable a, Num a ) -> Expr a -> ExpraYou only need
add :: Num a -> Expr a -> Expr a, because eachColconstructor holds it' on Columnable constaint.Alternatively , you don't need the constraints in the GADT (unless I a missing something of course)