89381a44435f725ed9ac70b13855a1a86fee4db0c05c231c7940bafdc9c62518.tri (738B)
1 !import prelude * 2 !export * 3 4 match_ = y (self value patterns : 5 triage 6 t 7 (_ : t) 8 (pattern rest : 9 triage 10 t 11 (_ : t) 12 (test result : 13 if (test value) 14 (result value) 15 (self value rest)) 16 pattern) 17 patterns) 18 19 match = (value patterns : 20 match_ value (map (sublist : 21 pair (head sublist) (head (tail sublist))) 22 patterns)) 23 24 otherwise = const (t t) 25 26 cond_ self patterns = 27 lazyList 28 (_ : t) 29 (pattern rest : 30 matchPair 31 (testK actionK : 32 lazyBool 33 actionK 34 (_ : self rest) 35 (testK t)) 36 pattern) 37 patterns 38 39 cond patterns = y cond_ patterns 40 41 guard testK actionK = pair testK actionK 42