git.iko.soy/rowtype-yoga/purescript-native
on 703dd66 help sign in
102 lines 1.9 kB history raw
1module Main where
3 import Control.Monad.Eff
4 import Debug.Trace
6 (?!) :: forall a. a -> a -> a
7 (?!) x _ = x
9 bar :: String -> String -> String
10 bar = \s1 s2 -> s1 ++ s2
12 test1 :: forall n. (Num n) => n -> n -> (n -> n -> n) -> n
13 test1 x y z = x * y + z x y
15 test2 = (\x -> x.foo false) { foo : \_ -> 1 }
17 test3 = (\x y -> x)(1 + 2 * (1 + 2)) (true && (false || false))
19 k = \x -> \y -> x
21 test4 = 1 `k` 2
23 infixl 5 %%
25 (%%) :: Number -> Number -> Number
26 (%%) x y = x * y + y
28 test5 = 1 %% 2 %% 3
30 test6 = ((\x -> x) `k` 2) 3
32 (<+>) :: String -> String -> String
33 (<+>) = \s1 s2 -> s1 ++ s2
35 test7 = "Hello" <+> "World!"
37 (@@) :: forall a b. (a -> b) -> a -> b
38 (@@) = \f x -> f x
40 foo :: String -> String
41 foo = \s -> s
43 test8 = foo @@ "Hello World"
45 test9 = Main.foo @@ "Hello World"
47 test10 = "Hello" `Main.bar` "World"
49 (...) :: forall a. [a] -> [a] -> [a]
50 (...) = \as -> \bs -> as
52 test11 = [1, 2, 3] ... [4, 5, 6]
54 test12 (<%>) a b = a <%> b
56 test13 = \(<%>) a b -> a <%> b
58 test14 :: Number -> Number -> Boolean
59 test14 a b = a < b
61 test15 :: Number -> Number -> Boolean
62 test15 a b = const false $ a `test14` b
64 test16 :: Number -> Number -> Number
65 test16 x y = x .|. y .&. y
67 test17 :: Number
68 test17 = negate (-1)
70 test18 :: Number
71 test18 = negate $ negate 1
73 test19 :: Number
74 test19 = negate $ negate (-1)
76 test20 :: Number
77 test20 = 1 @ 2
78 where
79 (@) x y = x + y * y
81 main = do
82 let t1 = test1 1 2 (\x y -> x + y)
83 let t2 = test2
84 let t3 = test3
85 let t4 = test4
86 let t5 = test5
87 let t6 = test6
88 let t7 = test7
89 let t8 = test8
90 let t9 = test9
91 let t10 = test10
92 let t11 = test11
93 let t12 = test12 k 1 2
94 let t13 = test13 k 1 2
95 let t14 = test14 1 2
96 let t15 = test15 1 2
97 let t16 = test16 1 2
98 let t17 = test17
99 let t18 = test18
100 let t19 = test19
101 let t20 = test20
102 trace "Done"