= (one passports, two passports)
one = length o filter (valid [(n, const True)\\n<-["byr", "iyr", "eyr", "hgt", "hcl", "ecl", "pid"]])
-
two = length o filter (valid
[ ("byr", fourDigit 1920 2002)
, ("iyr", fourDigit 2010 2020)
, ("pid", reg "\\d{9}")
])
fourDigit lo hi x = reg "\\d{4}" x && between lo hi (toInt x)
-reg p = not o isEmpty o match p
+reg p = not o isEmpty o match ("^"+++p+++"$")
between lo hi x = x >= lo && x <= hi