This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type alias Table1 = | |
| List EmployeeFromDb1 | |
| lookUpEmployee1 : Id -> Table -> Maybe Employee1 | |
| lookUpEmployee1 id table = | |
| table | |
| |> List.filter (\employee -> employee.id == id) | |
| |> List.head |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| employeeFromDbToApplication : EmployeeFromDb1 -> List Employee1 -> Employee1 | |
| employeeFromDbToApplication (EmployeeFromDb1 empDb) employees = | |
| Employee1 | |
| { id = empDb.id | |
| , name = empDb.name | |
| , age = empDb.age | |
| , employees = employees | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| lookUpEmployee2 : Id -> Table1 -> Maybe Employee1 | |
| lookUpEmployee2 id table = | |
| let | |
| maybePerson = | |
| table | |
| |> List.find (\(EmployeeFromDb1 employee) -> employee.id == id) | |
| employees = | |
| table | |
| |> List.filter (\(EmployeeFromDb1 emp) -> emp.employerId == id) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type EmployeeWithCount1 | |
| = EmployeeWithCount1 | |
| { id : Id | |
| , name : String | |
| , age : Int | |
| , employeeCount : Int | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type Employee a | |
| = Employee | |
| { id : Id | |
| , name : String | |
| , age : Int | |
| } | |
| a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type alias EmployeeFromDb = | |
| Employee Id |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type alias EmployeeWithCount = | |
| Employee Int |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type alias EmployeeApp = | |
| Employee (List (Employee ())) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| map : (a -> b) -> Employee a -> Employee b | |
| map f (Employee sharedData a) = | |
| Employee sharedData (f a) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type alias Table = | |
| List EmployeeFromDb | |
| lookUpEmployee : Id -> Table -> Maybe EmployeeApp | |
| lookUpEmployee id table = | |
| let | |
| maybePerson = | |
| List.find (\(Employee employee _) -> employee.id == id) table |