git.iko.soy/rowtype-yoga/purescript-native
on 7c19115 help sign in
30 lines 532 B history raw
1module Patterns where
3 import Prelude
5 test = \x -> case x of
6 { str = "Foo", bool = true } -> true
7 { str = "Bar", bool = b } -> b
8 _ -> false
10 f = \o -> case o of
11 { foo = "Foo" } -> o.bar
12 _ -> 0
14 g = \o -> case o of
15 { arr = [x : xs], take = "car" } -> x
16 { arr = [_, x : xs], take = "cadr" } -> x
17 _ -> 0
20 h = \o -> case o of
21 a@[_,_,_] -> a
22 _ -> []
24 isDesc :: [Number] -> Boolean
25 isDesc [x, y] | x > y = true
26 isDesc _ = false
28module Main where
30main = Trace.trace "Done"