Skip to content

Instantly share code, notes, and snippets.

@jfdm
Created April 20, 2022 21:24
Show Gist options
  • Save jfdm/f1e3da71e72bd167b9cf148ed125a75f to your computer and use it in GitHub Desktop.
Save jfdm/f1e3da71e72bd167b9cf148ed125a75f to your computer and use it in GitHub Desktop.
Something Something Something Type-Driven; Something Something Darkside; Something Something Complete
λΠ> show EmployeeSchema
"(Employee (PersonInfo ((FullName ((Firstname : String is not restricted) <+>
((Lastname : String is not restricted) <+> {}))) <+>
(((Address : String is not restricted)
<|>
((FirstLine : String is not restricted) <+>
((City : String is not restricted) <+>
((Country : String is restricted) <+>
((PostCode : String is not restricted) <+> {}))))) <+>
{}))))"
λΠ> :t employee0
Example.employee0 : Data EmployeeSchema
λΠ> show employee0
"{Employee = {PersonInfo = {FullName = Firstname = "Thor" <+> Lastname = "Odinson" <+> {}} <+>
Address = "Asgard" <+> {}}}"
λΠ> :t employee1
Example.employee1 : Data EmployeeSchema
λΠ> show employee1
"{Employee = {PersonInfo = {FullName = Firstname = "Loki" <+> Lastname = "Laufison" <+> {}} <+>
FirstLine = "The Frost Palace" <+>
City = "Jotun City" <+>
Country = "JH" <+>
PostCode = "JH01" <+> {} <+> {}}}"
λΠ> :t Query2
Example.Query2 : Query EmployeeSchema
λΠ> show Query2
"Employee/PersonInfo/Address"
λΠ> query Query2 employee0
Just (R (Leaf Address "Asgard" RestrictedNot IsString))
λΠ> query Query2 employee1
Nothing
λΠ> :t query
Data.Schema.Path.query : Query i -> Data i -> Maybe (Result i)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment