git.iko.soy/rowtype-yoga/purescript-native
on cd4c708 help sign in
91 lines 1.6 kB history raw
1module Main where
3import Prelude
4import Other (foo)
5import Other as Other
6import Control.Monad.Eff
7import Control.Monad.Eff.Console
9op1 :: forall a. a -> a -> a
10op1 x _ = x
12infix 4 op1 as ?!
14test1 :: forall n. (Semiring n) => n -> n -> (n -> n -> n) -> n
15test1 x y z = x * y + z x y
17test2 = (\x -> x.foo false) { foo : \_ -> 1.0 }
19test3 = (\x y -> x)(1.0 + 2.0 * (1.0 + 2.0)) (true && (false || false))
21k = \x -> \y -> x
23test4 = 1 `k` 2
25op2 :: Number -> Number -> Number
26op2 x y = x * y + y
28infixl 5 op2 as %%
30test5 = 1.0 %% 2.0 %% 3.0
32test6 = ((\x -> x) `k` 2.0) 3.0
34op3 :: String -> String -> String
35op3 = \s1 s2 -> s1 <> s2
37infix 4 op3 as <+>
39test7 = "Hello" <+> "World!"
41op4 :: forall a b. (a -> b) -> a -> b
42op4 = \f x -> f x
44infix 4 op4 as @@
46test8 = foo @@ "Hello World"
48test9 = Other.foo @@ "Hello World"
50test10 = "Hello" `Other.baz` "World"
52op5 :: forall a. Array a -> Array a -> Array a
53op5 = \as -> \bs -> as
55infix 4 op5 as ...
57test11 = [1.0, 2.0, 0.0] ... [4.0, 5.0, 6.0]
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)
74main = do
75 let t1 = test1 1.0 2.0 (\x y -> x + y)
76 let t2 = test2
77 let t3 = test3
78 let t4 = test4
79 let t5 = test5
80 let t6 = test6
81 let t7 = test7
82 let t8 = test8
83 let t9 = test9
84 let t10 = test10
85 let t11 = test11
86 let t14 = test14 1.0 2.0
87 let t15 = test15 1.0 2.0
88 let t17 = test17
89 let t18 = test18
90 let t19 = test19
91 log "Done"