git.iko.soy/rowtype-yoga/purescript-native
on b032e0f help sign in
75 lines 1.4 kB history raw
1module Main where
3 import Control.Monad.Eff
4 import Debug.Trace
6 bar = \s1 s2 -> s1 ++ s2
8 test1 :: forall n. (Num n) => n -> n -> (n -> n -> n) -> n
9 test1 x y z = x * y + z x y
11 test2 = (\x -> x.foo false) { foo : \_ -> 1 }
13 test3 = (\x y -> x)(1 + 2 * (1 + 2)) (true && (false || false))
15 k = \x -> \y -> x
17 test4 = 1 `k` 2
19 infixl 5 %%
21 (%%) :: Number -> Number -> Number
22 (%%) x y = x * y + y
24 test5 = 1 %% 2 %% 3
26 test6 = ((\x -> x) `k` 2) 3
28 (<>) = \s1 s2 -> s1 ++ s2
30 test7 = "Hello" <> "World!"
32 (@@) :: forall a b. (a -> b) -> a -> b
33 (@@) = \f x -> f x
35 foo :: String -> String
36 foo = \s -> s
38 test8 = foo @@ "Hello World"
40 test9 = Main.foo @@ "Hello World"
42 test10 = "Hello" `Main.bar` "World"
44 (...) :: forall a. [a] -> [a] -> [a]
45 (...) = \as -> \bs -> as
47 test11 = [1, 2, 3] ... [4, 5, 6]
49 test12 (<%>) a b = a <%> b
51 test13 = \(<%>) a b -> a <%> b
53 test14 :: Number -> Number -> Boolean
54 test14 a b = a < b
56 test15 :: Number -> Number -> Boolean
57 test15 a b = const false $ a `test14` b
59 main = do
60 let t1 = test1 1 2 (\x y -> x + y)
61 let t2 = test2
62 let t3 = test3
63 let t4 = test4
64 let t5 = test5
65 let t6 = test6
66 let t7 = test7
67 let t8 = test8
68 let t9 = test9
69 let t10 = test10
70 let t11 = test11
71 let t12 = test12 k 1 2
72 let t13 = test13 k 1 2
73 let t14 = test14 1 2
74 let t15 = test15 1 2
75 trace "Done"