Skip to content

Commit 3aa44b6

Browse files
committed
fix: Formatting and linting errors.
1 parent ff2d676 commit 3aa44b6

3 files changed

Lines changed: 93 additions & 24 deletions

File tree

dataframe-fastcsv/tests/Main.hs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ import Test.HUnit
77
import qualified Operations.ReadCsv
88

99
tests :: Test
10-
tests =
11-
TestList $
12-
Operations.ReadCsv.tests
10+
tests = TestList Operations.ReadCsv.tests
1311

1412
main :: IO ()
1513
main = do

src/DataFrame/Typed/Lazy.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
{-# LANGUAGE GADTs #-}
55
{-# LANGUAGE KindSignatures #-}
66
{-# LANGUAGE ScopedTypeVariables #-}
7-
{-# LANGUAGE TypeOperators #-}
87
{-# LANGUAGE TypeApplications #-}
98

109
{- |

src/DataFrame/Typed/Schema.hs

Lines changed: 92 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,18 @@ type family ExcludeSchema (names :: [Symbol]) (cols :: [Type]) :: [Type] where
122122
ExcludeSchema names (Column n a ': rest) =
123123
ExcludeSchemaHelper (IsElem n names) n a names rest
124124

125-
type family ExcludeSchemaHelper (found :: Bool) (n :: Symbol) (a :: Type) (names :: [Symbol]) (rest :: [Type]) :: [Type] where
126-
ExcludeSchemaHelper 'True n a names rest = ExcludeSchema names rest
127-
ExcludeSchemaHelper 'False n a names rest = Column n a ': ExcludeSchema names rest
125+
type family
126+
ExcludeSchemaHelper
127+
(found :: Bool)
128+
(n :: Symbol)
129+
(a :: Type)
130+
(names :: [Symbol])
131+
(rest :: [Type]) ::
132+
[Type]
133+
where
134+
ExcludeSchemaHelper 'True n a names rest = ExcludeSchema names rest
135+
ExcludeSchemaHelper 'False n a names rest =
136+
Column n a ': ExcludeSchema names rest
128137

129138
-- | Type-level elem for Symbols
130139
type family IsElem (x :: Symbol) (xs :: [Symbol]) :: Bool where
@@ -200,10 +209,18 @@ type family AssertAllPresent (name :: [Symbol]) (cols :: [Type]) :: Constraint w
200209
AssertAllPresentHelper (HasName name cols) name rest cols
201210
AssertAllPresent '[] cols = ()
202211

203-
type family AssertAllPresentHelper (found :: Bool) (name :: Symbol) (rest :: [Symbol]) (cols :: [Type]) :: Constraint where
204-
AssertAllPresentHelper 'True name rest cols = AssertAllPresent rest cols
212+
type family
213+
AssertAllPresentHelper
214+
(found :: Bool)
215+
(name :: Symbol)
216+
(rest :: [Symbol])
217+
(cols :: [Type]) ::
218+
Constraint
219+
where
220+
AssertAllPresentHelper 'True name rest cols = AssertAllPresent rest cols
205221
AssertAllPresentHelper 'False name rest cols =
206-
TypeError ('Text "Column '" ':<>: 'Text name ':<>: 'Text "' not found in schema")
222+
TypeError
223+
('Text "Column '" ':<>: 'Text name ':<>: 'Text "' not found in schema")
207224

208225
{- | Strip 'Maybe' from all columns. Used by 'filterAllJust'.
209226
@@ -234,8 +251,15 @@ type family SharedNames (left :: [Type]) (right :: [Type]) :: [Symbol] where
234251
SharedNames (Column n _ ': rest) right =
235252
SharedNamesHelper (HasName n right) n rest right
236253

237-
type family SharedNamesHelper (found :: Bool) (n :: Symbol) (rest :: [Type]) (right :: [Type]) :: [Symbol] where
238-
SharedNamesHelper 'True n rest right = n ': SharedNames rest right
254+
type family
255+
SharedNamesHelper
256+
(found :: Bool)
257+
(n :: Symbol)
258+
(rest :: [Type])
259+
(right :: [Type]) ::
260+
[Symbol]
261+
where
262+
SharedNamesHelper 'True n rest right = n ': SharedNames rest right
239263
SharedNamesHelper 'False n rest right = SharedNames rest right
240264

241265
-- | Columns from @left@ whose names do NOT appear in @right@.
@@ -244,8 +268,16 @@ type family UniqueLeft (left :: [Type]) (rightNames :: [Symbol]) :: [Type] where
244268
UniqueLeft (Column n a ': rest) rn =
245269
UniqueLeftHelper (IsElem n rn) n a rest rn
246270

247-
type family UniqueLeftHelper (found :: Bool) (n :: Symbol) (a :: Type) (rest :: [Type]) (rn :: [Symbol]) :: [Type] where
248-
UniqueLeftHelper 'True n a rest rn = UniqueLeft rest rn
271+
type family
272+
UniqueLeftHelper
273+
(found :: Bool)
274+
(n :: Symbol)
275+
(a :: Type)
276+
(rest :: [Type])
277+
(rn :: [Symbol]) ::
278+
[Type]
279+
where
280+
UniqueLeftHelper 'True n a rest rn = UniqueLeft rest rn
249281
UniqueLeftHelper 'False n a rest rn = Column n a ': UniqueLeft rest rn
250282

251283
-- | Wrap column types in Maybe.
@@ -259,24 +291,55 @@ type family WrapMaybeColumns (names :: [Symbol]) (cols :: [Type]) :: [Type] wher
259291
WrapMaybeColumns names (Column n a ': rest) =
260292
WrapMaybeColumnsHelper (IsElem n names) n a names rest
261293

262-
type family WrapMaybeColumnsHelper (found :: Bool) (n :: Symbol) (a :: Type) (names :: [Symbol]) (rest :: [Type]) :: [Type] where
263-
WrapMaybeColumnsHelper 'True n a names rest = Column n (Maybe a) ': WrapMaybeColumns names rest
264-
WrapMaybeColumnsHelper 'False n a names rest = Column n a ': WrapMaybeColumns names rest
294+
type family
295+
WrapMaybeColumnsHelper
296+
(found :: Bool)
297+
(n :: Symbol)
298+
(a :: Type)
299+
(names :: [Symbol])
300+
(rest :: [Type]) ::
301+
[Type]
302+
where
303+
WrapMaybeColumnsHelper 'True n a names rest =
304+
Column n (Maybe a) ': WrapMaybeColumns names rest
305+
WrapMaybeColumnsHelper 'False n a names rest =
306+
Column n a ': WrapMaybeColumns names rest
265307

266308
-- | Columns in left whose names collide with right (excluding keys).
267309
type family CollidingColumns (left :: [Type]) (right :: [Type]) (keys :: [Symbol]) :: [Type] where
268310
CollidingColumns '[] _ _ = '[]
269311
CollidingColumns (Column n a ': rest) right keys =
270312
CollidingColumnsHelper1 (IsElem n keys) n a rest right keys
271313

272-
type family CollidingColumnsHelper1 (isKey :: Bool) (n :: Symbol) (a :: Type) (rest :: [Type]) (right :: [Type]) (keys :: [Symbol]) :: [Type] where
273-
CollidingColumnsHelper1 'True n a rest right keys = CollidingColumns rest right keys
314+
type family
315+
CollidingColumnsHelper1
316+
(isKey :: Bool)
317+
(n :: Symbol)
318+
(a :: Type)
319+
(rest :: [Type])
320+
(right :: [Type])
321+
(keys :: [Symbol]) ::
322+
[Type]
323+
where
324+
CollidingColumnsHelper1 'True n a rest right keys =
325+
CollidingColumns rest right keys
274326
CollidingColumnsHelper1 'False n a rest right keys =
275327
CollidingColumnsHelper2 (HasName n right) n a rest right keys
276328

277-
type family CollidingColumnsHelper2 (inRight :: Bool) (n :: Symbol) (a :: Type) (rest :: [Type]) (right :: [Type]) (keys :: [Symbol]) :: [Type] where
278-
CollidingColumnsHelper2 'True n a rest right keys = Column n (These a (Lookup n right)) ': CollidingColumns rest right keys
279-
CollidingColumnsHelper2 'False n a rest right keys = CollidingColumns rest right keys
329+
type family
330+
CollidingColumnsHelper2
331+
(inRight :: Bool)
332+
(n :: Symbol)
333+
(a :: Type)
334+
(rest :: [Type])
335+
(right :: [Type])
336+
(keys :: [Symbol]) ::
337+
[Type]
338+
where
339+
CollidingColumnsHelper2 'True n a rest right keys =
340+
Column n (These a (Lookup n right)) ': CollidingColumns rest right keys
341+
CollidingColumnsHelper2 'False n a rest right keys =
342+
CollidingColumns rest right keys
280343

281344
-- | Inner join result schema.
282345
type family InnerJoinSchema (keys :: [Symbol]) (left :: [Type]) (right :: [Type]) :: [Type] where
@@ -339,8 +402,17 @@ type family GroupKeyColumns (keys :: [Symbol]) (cols :: [Type]) :: [Type] where
339402
GroupKeyColumns keys (Column n a ': rest) =
340403
GroupKeyColumnsHelper (IsElem n keys) n a keys rest
341404

342-
type family GroupKeyColumnsHelper (found :: Bool) (n :: Symbol) (a :: Type) (keys :: [Symbol]) (rest :: [Type]) :: [Type] where
343-
GroupKeyColumnsHelper 'True n a keys rest = Column n a ': GroupKeyColumns keys rest
405+
type family
406+
GroupKeyColumnsHelper
407+
(found :: Bool)
408+
(n :: Symbol)
409+
(a :: Type)
410+
(keys :: [Symbol])
411+
(rest :: [Type]) ::
412+
[Type]
413+
where
414+
GroupKeyColumnsHelper 'True n a keys rest =
415+
Column n a ': GroupKeyColumns keys rest
344416
GroupKeyColumnsHelper 'False n a keys rest = GroupKeyColumns keys rest
345417

346418
-- | Provides runtime evidence of a schema: a list of (name, TypeRep) pairs.

0 commit comments

Comments
 (0)