git.iko.soy/rowtype-yoga/purescript-native
on b40c4e6 help sign in
77 lines 1.5 kB history raw
1module Main where
3 import Prelude
4 import Control.Monad.Eff
5 import Debug.Trace
6 import Global
7 import Data.Array
9 bar = \s1 s2 -> s1 ++ s2
11 test1 :: forall n. (Num n) => n -> n -> (n -> n -> n) -> n
12 test1 x y z = x * y + z x y
14 test2 = (\x -> x.foo false) { foo : \_ -> 1 }
16 test3 = (\x y -> x)(1 + 2 * (1 + 2)) (true && (false || false))
18 k = \x -> \y -> x
20 test4 = 1 `k` 2
22 infixl 5 %%
24 (%%) :: Number -> Number -> Number
25 (%%) x y = x * y + y
27 test5 = 1 %% 2 %% 3
29 test6 = ((\x -> x) `k` 2) 3
31 (<>) = \s1 s2 -> s1 ++ s2
33 test7 = "Hello" <> "World!"
35 (@@) :: forall a b. (a -> b) -> a -> b
36 (@@) = \f x -> f x
38 foo :: String -> String
39 foo = \s -> s
41 test8 = foo @@ "Hello World"
43 test9 = Main.foo @@ "Hello World"
45 test10 = "Hello" `Main.bar` "World"
47 (...) :: forall a. [a] -> [a] -> [a]
48 (...) = \as -> \bs -> as
50 test11 = [1, 2, 3] ... [4, 5, 6]
52 test12 (<%>) a b = a <%> b
54 test13 = \(<%>) a b -> a <%> b
56 test14 :: Number -> Number -> Boolean
57 test14 a b = a < b
59 test15 :: Number -> Number -> Boolean
60 test15 a b = const false $ a `test14` b
62 main = print [ show $ test1 1 2 $ \x y -> x + y
63 , show test2
64 , show test3
65 , show test4
66 , show test5
67 , show test6
68 , show test7
69 , show test8
70 , show test9
71 , show test10
72 , show test11
73 , show (test12 k 1 2)
74 , show (test13 k 1 2)
75 , show (test14 1 2)
76 , show (test15 1 2)
77 ]