git.iko.soy/rowtype-yoga/purescript-native
on d09d430 help sign in
99 lines 1.8 kB history raw
1module Main where
3import Prelude
4import Control.Monad.Eff
5import Control.Monad.Eff.Console
7(?!) :: forall a. a -> a -> a
8(?!) x _ = x
10bar :: String -> String -> String
11bar = \s1 s2 -> s1 ++ s2
13test1 :: forall n. (Num n) => n -> n -> (n -> n -> n) -> n
14test1 x y z = x * y + z x y
16test2 = (\x -> x.foo false) { foo : \_ -> 1.0 }
18test3 = (\x y -> x)(1.0 + 2.0 * (1.0 + 2.0)) (true && (false || false))
20k = \x -> \y -> x
22test4 = 1 `k` 2
24infixl 5 %%
26(%%) :: Number -> Number -> Number
27(%%) x y = x * y + y
29test5 = 1.0 %% 2.0 %% 3.0
31test6 = ((\x -> x) `k` 2.0) 3.0
33(<+>) :: String -> String -> String
34(<+>) = \s1 s2 -> s1 ++ s2
36test7 = "Hello" <+> "World!"
38(@@) :: forall a b. (a -> b) -> a -> b
39(@@) = \f x -> f x
41foo :: String -> String
42foo = \s -> s
44test8 = foo @@ "Hello World"
46test9 = Main.foo @@ "Hello World"
48test10 = "Hello" `Main.bar` "World"
50(...) :: forall a. Array a -> Array a -> Array a
51(...) = \as -> \bs -> as
53test11 = [1.0, 2.0, 0.0] ... [4.0, 5.0, 6.0]
55test12 (<%>) a b = a <%> b
57test13 = \(<%>) a b -> a <%> b
59test14 :: Number -> Number -> Boolean
60test14 a b = a < b
62test15 :: Number -> Number -> Boolean
63test15 a b = const false $ a `test14` b
65test17 :: Number
66test17 = negate (-1.0)
68test18 :: Number
69test18 = negate $ negate 1.0
71test19 :: Number
72test19 = negate $ negate (-1.0)
74test20 :: Number
75test20 = 1.0 @ 2.0
76 where
77 (@) x y = x + y * y
79main = do
80 let t1 = test1 1.0 2.0 (\x y -> x + y)
81 let t2 = test2
82 let t3 = test3
83 let t4 = test4
84 let t5 = test5
85 let t6 = test6
86 let t7 = test7
87 let t8 = test8
88 let t9 = test9
89 let t10 = test10
90 let t11 = test11
91 let t12 = test12 k 1.0 2.0
92 let t13 = test13 k 1.0 2.0
93 let t14 = test14 1.0 2.0
94 let t15 = test15 1.0 2.0
95 let t17 = test17
96 let t18 = test18
97 let t19 = test19
98 let t20 = test20
99 log "Done"