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
| -------------- | |
| | T1 | T2 | T3 | | |
| |----|----|----| | |
| | r1 | r2 | r3 | | |
| | w1 | w2 | w3 | | |
| -------------- | |
| w3 tiene que ir en el ultimo lugar, as铆 que me puedo olvidar de el, y tomar como que solo tengo 5 lugares. | |
| Tengo 5 lugares: _ _ _ _ _ |
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
| {-# LANGUAGE ScopedTypeVariables, | |
| KindSignatures, | |
| DataKinds, | |
| TypeOperators #-} | |
| import Data.Proxy | |
| import GHC.TypeLits | |
| data Val (a :: Nat) |
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 |
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 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
| 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 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 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 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
| 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) |