File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -215,7 +215,7 @@ derive ::
215215 , Columnable a
216216 , AssertAbsent name cols
217217 ) =>
218- TExpr cols a -> TypedDataFrame cols -> TypedDataFrame (T. Column name a ' : cols )
218+ TExpr cols a -> TypedDataFrame cols -> TypedDataFrame (Snoc cols ( T. Column name a ) )
219219derive (TExpr expr) (TDF df) = unsafeFreeze (D. derive colName expr df)
220220 where
221221 colName = T. pack (symbolVal (Proxy @ name ))
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ module DataFrame.Typed.Schema (
2323 RenameInSchema ,
2424 RenameManyInSchema ,
2525 Append ,
26+ Snoc ,
2627 Reverse ,
2728 ColumnNames ,
2829 AssertAbsent ,
@@ -76,6 +77,11 @@ type family Lookup (name :: Symbol) (cols :: [Type]) :: Type where
7677 TypeError
7778 ('Text " Column '" ':<>: 'Text name ':<>: 'Text " ' not found in schema" )
7879
80+ -- | Add type to the end of a list.
81+ type family Snoc (xs :: [k ]) (x :: k ) :: [k ] where
82+ Snoc '[] x = '[x ]
83+ Snoc (y ': ys ) x = y ': Snoc ys x
84+
7985-- | Check whether a column name exists in a schema (type-level Bool).
8086type family HasName (name :: Symbol ) (cols :: [Type ]) :: Bool where
8187 HasName name (Column name _ ': _ ) = 'True
You can’t perform that action at this time.
0 commit comments