// Then enrich the implementation so that `GetWorkPermit`
        // returns `None` if the work permit has expired.

        static Option <WorkPermit> GetValidWorkPermit(Dictionary <string, Employee> employees, string employeeId)
        => employees
        .Lookup(employeeId)
        .Bind(e => e.WorkPermit)
        .Where(HasExpired.Negate());
示例#2
0
 Option <WorkPermit> GetWorkPermitEnriched(Dictionary <string, Employee> people, string employeeId)
 => people
 .Lookup(employeeId)
 .Bind(e => e.WorkPermit)
 .Where(HasExpired.Negate());