Skip to content

Instantly share code, notes, and snippets.

View jjant's full-sized avatar
馃挜

Julian Antonielli jjant

馃挜
View GitHub Profile
--------------
| 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: _ _ _ _ _
{-# LANGUAGE ScopedTypeVariables,
KindSignatures,
DataKinds,
TypeOperators #-}
import Data.Proxy
import GHC.TypeLits
data Val (a :: Nat)
type alias Table =
List EmployeeFromDb
lookUpEmployee : Id -> Table -> Maybe EmployeeApp
lookUpEmployee id table =
let
maybePerson =
List.find (\(Employee employee _) -> employee.id == id) table
map : (a -> b) -> Employee a -> Employee b
map f (Employee sharedData a) =
Employee sharedData (f a)
type alias EmployeeApp =
Employee (List (Employee ()))
type alias EmployeeWithCount =
Employee Int
type alias EmployeeFromDb =
Employee Id
type Employee a
= Employee
{ id : Id
, name : String
, age : Int
}
a
type EmployeeWithCount1
= EmployeeWithCount1
{ id : Id
, name : String
, age : Int
, employeeCount : Int
}
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)