File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed
Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -86,11 +86,11 @@ main = do
8686
8787clean ::
8888 ( DT. AssertPresent " Ticket" cols
89- , DT. Lookup " Ticket" cols ~ Maybe T. Text
89+ , DT. SafeLookup " Ticket" cols ~ Maybe T. Text
9090 , DT. AssertPresent " Name" cols
91- , DT. Lookup " Name" cols ~ Maybe T. Text
91+ , DT. SafeLookup " Name" cols ~ Maybe T. Text
9292 , DT. AssertPresent " Cabin" cols
93- , DT. Lookup " Cabin" cols ~ Maybe T. Text
93+ , DT. SafeLookup " Cabin" cols ~ Maybe T. Text
9494 ) =>
9595 DT. TypedDataFrame cols ->
9696 DT. TypedDataFrame
Original file line number Diff line number Diff line change @@ -77,9 +77,10 @@ type family Lookup (name :: Symbol) (cols :: [Type]) :: Type where
7777 TypeError
7878 ('Text " Column '" ':<>: 'Text name ':<>: 'Text " ' not found in schema" )
7979
80- -- | Like 'Lookup', but returns a harmless fallback ('Int') instead of
81- -- 'TypeError' when the column is not found. Use together with
82- -- 'AssertPresent' so the error fires exactly once.
80+ {- | Like 'Lookup', but returns a harmless fallback ('Int') instead of
81+ 'TypeError' when the column is not found. Use together with
82+ 'AssertPresent' so the error fires exactly once.
83+ -}
8384type family SafeLookup (name :: Symbol ) (cols :: [Type ]) :: Type where
8485 SafeLookup name (Column name a ': _ ) = a
8586 SafeLookup name (Column _ _ ': rest ) = SafeLookup name rest
You can’t perform that action at this time.
0 commit comments