packages feed

Frames-0.7.4: test/examples.toml

[managers]
csv = """
id,manager,age,pay
1,Joe,53,"80,000"
2,Sarah,44,"80,000"
"""

generated = """
type Row = Record [Id, Manager, Age, Pay]
rowParser :: ParserOptions
rowParser = ParserOptions Nothing (T.pack ",") (Frames.CSV.RFC4180Quoting '"')

type Id = "id" :-> Int
id :: forall f_0 rs_1 . (Functor f_0, Id ∈ rs_1) =>
                        (Int -> f_0 Int) -> Record rs_1 -> f_0 (Record rs_1)
id = rlens @Id . rfield
id' :: forall f_2 g_3 rs_4 . (Functor f_2, Id ∈ rs_4) =>
                             (g_3 Id -> f_2 (g_3 Id)) -> Rec g_3 rs_4 -> f_2 (Rec g_3 rs_4)
id' = rlens' @Id

type Manager = "manager" :-> Text
manager :: forall f_5 rs_6 . (Functor f_5, Manager ∈ rs_6) =>
                             (Text -> f_5 Text) -> Record rs_6 -> f_5 (Record rs_6)
manager = rlens @Manager . rfield
manager' :: forall f_7 g_8 rs_9 . (Functor f_7,
                                   Manager ∈ rs_9) =>
                                  (g_8 Manager -> f_7 (g_8 Manager)) -> Rec g_8 rs_9 -> f_7 (Rec g_8 rs_9)
manager' = rlens' @Manager

type Age = "age" :-> Int
age :: forall f_10 rs_11 . (Functor f_10, Age ∈ rs_11) =>
                           (Int -> f_10 Int) -> Record rs_11 -> f_10 (Record rs_11)
age = rlens @Age . rfield
age' :: forall f_12 g_13 rs_14 . (Functor f_12,
                                  Age ∈ rs_14) =>
                                 (g_13 Age -> f_12 (g_13 Age)) -> Rec g_13 rs_14 -> f_12 (Rec g_13 rs_14)
age' = rlens' @Age

type Pay = "pay" :-> Double
pay :: forall f_15 rs_16 . (Functor f_15, Pay ∈ rs_16) =>
                           (Double -> f_15 Double) -> Record rs_16 -> f_15 (Record rs_16)
pay = rlens @Pay . rfield
pay' :: forall f_17 g_18 rs_19 . (Functor f_17,
                                  Pay ∈ rs_19) =>
                                 (g_18 Pay -> f_17 (g_18 Pay)) -> Rec g_18 rs_19 -> f_17 (Rec g_18 rs_19)
pay' = rlens' @Pay"""

[employees]
csv = """
id,employee,age,pay,manager_id
3,Sadie,28,"40,000",1
4,Tom,25,"40,000",2
"""

generated = """
type Row = Record [Id, Employee, Age, Pay, ManagerId]
rowParser :: ParserOptions
rowParser = ParserOptions Nothing (T.pack ",") (Frames.CSV.RFC4180Quoting '"')

type Id = "id" :-> Int
id :: forall f_0 rs_1 . (Functor f_0, Id ∈ rs_1) =>
                        (Int -> f_0 Int) -> Record rs_1 -> f_0 (Record rs_1)
id = rlens @Id . rfield
id' :: forall f_2 g_3 rs_4 . (Functor f_2, Id ∈ rs_4) =>
                             (g_3 Id -> f_2 (g_3 Id)) -> Rec g_3 rs_4 -> f_2 (Rec g_3 rs_4)
id' = rlens' @Id

type Employee = "employee" :-> Text
employee :: forall f_5 rs_6 . (Functor f_5, Employee ∈ rs_6) =>
                              (Text -> f_5 Text) -> Record rs_6 -> f_5 (Record rs_6)
employee = rlens @Employee . rfield
employee' :: forall f_7 g_8 rs_9 . (Functor f_7,
                                    Employee ∈ rs_9) =>
                                   (g_8 Employee -> f_7 (g_8 Employee)) -> Rec g_8 rs_9 -> f_7 (Rec g_8 rs_9)
employee' = rlens' @Employee

type Age = "age" :-> Int
age :: forall f_10 rs_11 . (Functor f_10, Age ∈ rs_11) =>
                           (Int -> f_10 Int) -> Record rs_11 -> f_10 (Record rs_11)
age = rlens @Age . rfield
age' :: forall f_12 g_13 rs_14 . (Functor f_12,
                                  Age ∈ rs_14) =>
                                 (g_13 Age -> f_12 (g_13 Age)) -> Rec g_13 rs_14 -> f_12 (Rec g_13 rs_14)
age' = rlens' @Age

type Pay = "pay" :-> Double
pay :: forall f_15 rs_16 . (Functor f_15, Pay ∈ rs_16) =>
                           (Double -> f_15 Double) -> Record rs_16 -> f_15 (Record rs_16)
pay = rlens @Pay . rfield
pay' :: forall f_17 g_18 rs_19 . (Functor f_17,
                                  Pay ∈ rs_19) =>
                                 (g_18 Pay -> f_17 (g_18 Pay)) -> Rec g_18 rs_19 -> f_17 (Rec g_18 rs_19)
pay' = rlens' @Pay

type ManagerId = "manager_id" :-> Int
managerId :: forall f_20 rs_21 . (Functor f_20, ManagerId ∈ rs_21) =>
                                 (Int -> f_20 Int) -> Record rs_21 -> f_20 (Record rs_21)
managerId = rlens @ManagerId . rfield
managerId' :: forall f_22 g_23 rs_24 . (Functor f_22,
                                        ManagerId ∈ rs_24) =>
                                       (g_23 ManagerId -> f_22 (g_23 ManagerId)) ->
                                       Rec g_23 rs_24 -> f_22 (Rec g_23 rs_24)
managerId' = rlens' @ManagerId"""

# [managers_employees]
# generated = """
# type ManagerRec = Record [Id, Manager, Age, Pay]
# managerRecParser :: ParserOptions
# managerRecParser = ParserOptions Nothing (T.pack ",") (Frames.CSV.RFC4180Quoting '"')

# type Id = "id" :-> Int
# id :: forall f_0 rs_1 . (Functor f_0, Id ∈ rs_1) =>
#                         (Int -> f_0 Bool) -> Record rs_1 -> f_0 (Record rs_1)
# id = rlens @Id . rfield
# id' :: forall f_2 g_3 rs_4 . (Functor f_2, Functor g_3, Id ∈ rs_4) =>
#                              (g_3 Id -> f_2 (g_3 Id)) -> Rec g_3 rs_4 -> f_2 (Rec g_3 rs_4)
# id' = rlens' @Id

# type Manager = "manager" :-> Text
# manager :: forall f_5 rs_6 . (Functor f_5, Manager ∈ rs_6) =>
#                              (Text -> f_5 Text) -> Record rs_6 -> f_5 (Record rs_6)
# manager = rlens @Manager . rfield
# manager' :: forall f_7 g_8 rs_9 . (Functor f_7,
#                                    Manager ∈ rs_9) =>
#                                   (g_8 Manager -> f_7 (g_8 Manager)) -> Rec g_8 rs_9 -> f_7 (Rec g_8 rs_9)
# manager' = rlens' @Manager

# type Age = "age" :-> Int
# age :: forall f_10 rs_11 . (Functor f_10, Age ∈ rs_11) =>
#                            (Int -> f_10 Int) -> Record rs_11 -> f_10 (Record rs_11)
# age = rlens @Age . rfield
# age' :: forall f_12 g_13 rs_14 . (Functor f_12,
#                                   Age ∈ rs_14) =>
#                                  (g_13 Age -> f_12 (g_13 Age)) -> Rec g_13 rs_14 -> f_12 (Rec g_13 rs_14)
# age' = rlens' @Age

# type Pay = "pay" :-> Double
# pay :: forall f_15 rs_16 . (Functor f_15, Pay ∈ rs_16) =>
#                            (Double -> f_15 Double) -> Record rs_16 -> f_15 (Record rs_16)
# pay = rlens @Pay . rfield
# pay' :: forall f_17 g_18 rs_19 . (Functor f_17,
#                                   Pay ∈ rs_19) =>
#                                  (g_18 Pay -> f_17 (g_18 Pay)) -> Rec g_18 rs_19 -> f_17 (Rec g_18 rs_19)
# pay' = rlens' @Pay

# type EmployeeRec = Record ["id" :-> Int, "employee" :-> Text, "age" :-> Int, "pay" :-> Double, "manager_id" :-> Int]
# employeeRecParser :: ParserOptions
# employeeRecParser = ParserOptions Nothing (T.pack ",") (Frames.CSV.RFC4180Quoting '"')

# type Employee = "employee" :-> Text
# employee :: forall f_5 rs_6 . (Functor f_5, Employee ∈ rs_6) =>
#                               (Text -> f_5 Text) -> Record rs_6 -> f_5 (Record rs_6)
# employee = rlens @Employee . rfield
# employee' :: forall f_7 g_8 rs_9 . (Functor f_7,
#                                     Employee ∈ rs_9) =>
#                                    (g_8 Employee -> f_7 (g_8 Employee)) -> Rec g_8 rs_9 -> f_7 (Rec g_8 rs_9)
# employee' = rlens' @Employee

# type Age = "age" :-> Int

# type ManagerId = "manager_id" :-> Int
# managerId :: forall f_20 rs_21 . (Functor f_20, ManagerId ∈ rs_21) =>
#                                  (Int -> f_20 Int) -> Record rs_21 -> f_20 (Record rs_21)
# managerId = rlens @ManagerId . rfield
# managerId' :: forall f_22 g_23 rs_24 . (Functor f_22,
#                                         ManagerId ∈ rs_24) =>
#                                        (g_23 ManagerId -> f_22 (g_23 ManagerId)) ->
#                                        Rec g_23 rs_24 -> f_22 (Rec g_23 rs_24)
# managerId' = rlens' @ManagerId
# """

[double_gt_bool]
csv = """
col_a,col_b,col_c
1,9,"1,000,000.00"
2,8,"300,000.00"
3,7,"0"
4,6,0
"""

generated = """
type Row = Record [ColA, ColB, ColC]
rowParser :: ParserOptions
rowParser = ParserOptions Nothing (T.pack ",") (Frames.CSV.RFC4180Quoting '"')

type ColA = "col_a" :-> Int
colA :: forall f_0 rs_1 . (Functor f_0, ColA ∈ rs_1) =>
                          (Int -> f_0 Int) -> Record rs_1 -> f_0 (Record rs_1)
colA = rlens @ColA . rfield
colA' :: forall f_2 g_3 rs_4 . (Functor f_2,
                                ColA ∈ rs_4) =>
                               (g_3 ColA -> f_2 (g_3 ColA)) -> Rec g_3 rs_4 -> f_2 (Rec g_3 rs_4)
colA' = rlens' @ColA

type ColB = "col_b" :-> Int
colB :: forall f_5 rs_6 . (Functor f_5, ColB ∈ rs_6) =>
                          (Int -> f_5 Int) -> Record rs_6 -> f_5 (Record rs_6)
colB = rlens @ColB . rfield
colB' :: forall f_7 g_8 rs_9 . (Functor f_7,
                                ColB ∈ rs_9) =>
                               (g_8 ColB -> f_7 (g_8 ColB)) -> Rec g_8 rs_9 -> f_7 (Rec g_8 rs_9)
colB' = rlens' @ColB

type ColC = "col_c" :-> Double
colC :: forall f_10 rs_11 . (Functor f_10, ColC ∈ rs_11) =>
                            (Double -> f_10 Double) -> Record rs_11 -> f_10 (Record rs_11)
colC = rlens @ColC . rfield
colC' :: forall f_12 g_13 rs_14 . (Functor f_12,
                                   ColC ∈ rs_14) =>
                                  (g_13 ColC -> f_12 (g_13 ColC)) -> Rec g_13 rs_14 -> f_12 (Rec g_13 rs_14)
colC' = rlens' @ColC"""

[text_gt_bool]
csv = """
col_a
"0"
"0"
"0"
"0"
A
"""

generated = """
type Row = Record [ColA]
rowParser :: ParserOptions
rowParser = ParserOptions Nothing (T.pack ",") (Frames.CSV.RFC4180Quoting '"')

type ColA = "col_a" :-> Text
colA :: forall f_0 rs_1 . (Functor f_0, ColA ∈ rs_1) =>
                          (Text -> f_0 Text) -> Record rs_1 -> f_0 (Record rs_1)
colA = rlens @ColA . rfield
colA' :: forall f_2 g_3 rs_4 . (Functor f_2,
                                ColA ∈ rs_4) =>
                               (g_3 ColA -> f_2 (g_3 ColA)) -> Rec g_3 rs_4 -> f_2 (Rec g_3 rs_4)
colA' = rlens' @ColA"""

[missing_data]
csv = """
col_a,col_b
"0","x"
"2","x"
"1","x"
,"x"
"0","x"
"""

generated = """
type Row = Record [ColA, ColB]
rowParser :: ParserOptions
rowParser = ParserOptions Nothing (T.pack ",") (Frames.CSV.RFC4180Quoting '"')

type ColA = "col_a" :-> Int
colA :: forall f_0 rs_1 . (Functor f_0, ColA ∈ rs_1) =>
                          (Int -> f_0 Int) -> Record rs_1 -> f_0 (Record rs_1)
colA = rlens @ColA . rfield
colA' :: forall f_2 g_3 rs_4 . (Functor f_2,
                                ColA ∈ rs_4) =>
                               (g_3 ColA -> f_2 (g_3 ColA)) -> Rec g_3 rs_4 -> f_2 (Rec g_3 rs_4)
colA' = rlens' @ColA

type ColB = "col_b" :-> Text
colB :: forall f_5 rs_6 . (Functor f_5, ColB ∈ rs_6) =>
                          (Text -> f_5 Text) -> Record rs_6 -> f_5 (Record rs_6)
colB = rlens @ColB . rfield
colB' :: forall f_7 g_8 rs_9 . (Functor f_7,
                                ColB ∈ rs_9) =>
                               (g_8 ColB -> f_7 (g_8 ColB)) -> Rec g_8 rs_9 -> f_7 (Rec g_8 rs_9)
colB' = rlens' @ColB"""

[NoTruncate]
csv = """
id,foo
1,23
2,42
3,
4,56
"""

generated = """
type Row = Record [Id, Foo]
rowParser :: ParserOptions
rowParser = ParserOptions Nothing (T.pack ",") (Frames.CSV.RFC4180Quoting '"')

type Id = "id" :-> Int
id :: forall f_0 rs_1 . (Functor f_0, Id ∈ rs_1) =>
                        (Int -> f_0 Int) -> Record rs_1 -> f_0 (Record rs_1)
id = rlens @Id . rfield
id' :: forall f_2 g_3 rs_4 . (Functor f_2, Id ∈ rs_4) =>
                             (g_3 Id -> f_2 (g_3 Id)) -> Rec g_3 rs_4 -> f_2 (Rec g_3 rs_4)
id' = rlens' @Id

type Foo = "foo" :-> Int
foo :: forall f_5 rs_6 . (Functor f_5, Foo ∈ rs_6) =>
                             (Int -> f_5 Int) -> Record rs_6 -> f_5 (Record rs_6)
foo = rlens @Foo . rfield
foo' :: forall f_7 g_8 rs_9 . (Functor f_7,
                                   Foo ∈ rs_9) =>
                                  (g_8 Foo -> f_7 (g_8 Foo)) -> Rec g_8 rs_9 -> f_7 (Rec g_8 rs_9)
foo' = rlens' @Foo"""

[NoTruncateNA]
csv = """
id,foo
1,23
2,42
3,
4,56
5,NA
6,19
"""

generated = """
type Row = Record [Id, Foo]
rowParser :: ParserOptions
rowParser = ParserOptions Nothing (T.pack ",") (Frames.CSV.RFC4180Quoting '"')

type Id = "id" :-> Int
id :: forall f_0 rs_1 . (Functor f_0, Id ∈ rs_1) =>
                        (Int -> f_0 Int) -> Record rs_1 -> f_0 (Record rs_1)
id = rlens @Id . rfield
id' :: forall f_2 g_3 rs_4 . (Functor f_2, Id ∈ rs_4) =>
                             (g_3 Id -> f_2 (g_3 Id)) -> Rec g_3 rs_4 -> f_2 (Rec g_3 rs_4)
id' = rlens' @Id

type Foo = "foo" :-> Int
foo :: forall f_5 rs_6 . (Functor f_5, Foo ∈ rs_6) =>
                             (Int -> f_5 Int) -> Record rs_6 -> f_5 (Record rs_6)
foo = rlens @Foo . rfield
foo' :: forall f_7 g_8 rs_9 . (Functor f_7,
                                   Foo ∈ rs_9) =>
                                  (g_8 Foo -> f_7 (g_8 Foo)) -> Rec g_8 rs_9 -> f_7 (Rec g_8 rs_9)
foo' = rlens' @Foo"""

[DataHaskellSurvey]
csv = """
Label,Count
"Beginner : read(ing) tutorial material/solved some coding exercises",11
"Beginning : wrote less than 2 libraries or applications/unpublished",30
"Intermediate : wrote and published on Hackage 3 or more libraries/applications",16
"Advanced intermediate : wrote multiple libraries/applications - co-maintain various packages",13
"Advanced : contribute regularly patches to GHC - among other things",0
"Expert : proposed or commented on one or more language extensions",0
"""

generated = """
type Row = Record [Label, Count]
rowParser :: ParserOptions
rowParser = ParserOptions Nothing (T.pack ",") (Frames.CSV.RFC4180Quoting '"')

type Label = "Label" :-> Text
label :: forall f_0 rs_1 . (Functor f_0, Label ∈ rs_1) =>
         (Text -> f_0 Text) -> Record rs_1 -> f_0 (Record rs_1)
label = rlens @Label . rfield
label' :: forall f_2 g_3 rs_4 . (Functor f_2, Label ∈ rs_4) =>
          (g_3 Label -> f_2 (g_3 Label)) -> Rec g_3 rs_4 -> f_2 (Rec g_3 rs_4)
label' = rlens' @Label

type Count = "Count" :-> Int
count :: forall f_5 rs_6 . (Functor f_5, Count ∈ rs_6) =>
         (Int -> f_5 Int) -> Record rs_6 -> f_5 (Record rs_6)
count = rlens @Count . rfield
count' :: forall f_7 g_8 rs_9 . (Functor f_7, Count ∈ rs_9) =>
          (g_8 Count -> f_7 (g_8 Count)) -> Rec g_8 rs_9 -> f_7 (Rec g_8 rs_9)
count' = rlens' @Count
"""