git.iko.soy/rowtype-yoga/purescript-native
on eded2bd help sign in
77 lines 1.5 kB history raw
1module Main where
3 import Control.Monad.Eff
4 import Debug.Trace
6 bar :: String -> String -> String
7 bar = \s1 s2 -> s1 ++ s2
9 test1 :: forall n. (Num n) => n -> n -> (n -> n -> n) -> n
10 test1 x y z = x * y + z x y
12 test2 = (\x -> x.foo false) { foo : \_ -> 1 }
14 test3 = (\x y -> x)(1 + 2 * (1 + 2)) (true && (false || false))
16 k = \x -> \y -> x
18 test4 = 1 `k` 2
20 infixl 5 %%
22 (%%) :: Number -> Number -> Number
23 (%%) x y = x * y + y
25 test5 = 1 %% 2 %% 3
27 test6 = ((\x -> x) `k` 2) 3
29 (<+>) :: String -> String -> String
30 (<+>) = \s1 s2 -> s1 ++ s2
32 test7 = "Hello" <+> "World!"
34 (@@) :: forall a b. (a -> b) -> a -> b
35 (@@) = \f x -> f x
37 foo :: String -> String
38 foo = \s -> s
40 test8 = foo @@ "Hello World"
42 test9 = Main.foo @@ "Hello World"
44 test10 = "Hello" `Main.bar` "World"
46 (...) :: forall a. [a] -> [a] -> [a]
47 (...) = \as -> \bs -> as
49 test11 = [1, 2, 3] ... [4, 5, 6]
51 test12 (<%>) a b = a <%> b
53 test13 = \(<%>) a b -> a <%> b
55 test14 :: Number -> Number -> Boolean
56 test14 a b = a < b
58 test15 :: Number -> Number -> Boolean
59 test15 a b = const false $ a `test14` b
61 main = do
62 let t1 = test1 1 2 (\x y -> x + y)
63 let t2 = test2
64 let t3 = test3
65 let t4 = test4
66 let t5 = test5
67 let t6 = test6
68 let t7 = test7
69 let t8 = test8
70 let t9 = test9
71 let t10 = test10
72 let t11 = test11
73 let t12 = test12 k 1 2
74 let t13 = test13 k 1 2
75 let t14 = test14 1 2
76 let t15 = test15 1 2
77 trace "Done"