git.iko.soy/rowtype-yoga/purescript-native
on 5159dfd help sign in
25 lines 456 B history raw
1module Patterns where
3 test = \x -> case x of
4 { str = "Foo", bool = true } -> true
5 { str = "Bar", bool = b } -> b
6 _ -> false
8 f = \o -> case o of
9 { foo = "Foo" } -> o.bar
10 _ -> 0
12 g = \o -> case o of
13 { arr = [x : xs], take = "car" } -> x
14 { arr = [_, x : xs], take = "cadr" } -> x
15 _ -> 0
18 h = \o -> case o of
19 a@[_,_,_] -> a
20 _ -> []
22 isDesc = \o -> case o of
23 [x, y] | x > y -> true
24 _ -> false