git.iko.soy/rowtype-yoga/purescript-native
on b58d4e5 help sign in
81 lines 1.4 kB history raw
1module Operators1 where
3 import Prelude ((++))
5 (@@) :: forall a b. (a -> b) -> a -> b
6 (@@) = \f x -> f x
8 foo :: String -> String
9 foo = \s -> s
11 test8 = foo @@ "Hello World"
13 bar = \s1 s2 -> s1 ++ s2
15module Operators2 where
17 import Prelude
19 test1 :: forall n. (Num n) => n -> n -> (n -> n -> n) -> n
20 test1 x y z = x * y + z x y
22 test2 = (\x -> x.foo false) { foo : \_ -> 1 }
24 test3 = (\x y -> x)(1 + 2 * (1 + 2)) (true && (false || false))
26 k = \x -> \y -> x
28 test4 = 1 `k` 2
30 infixl 5 %%
32 (%%) :: Number -> Number -> Number
33 (%%) x y = x * y + y
35 test5 = 1 %% 2 %% 3
37 test6 = ((\x -> x) `k` 2) 3
39 (<>) = \s1 s2 -> s1 ++ s2
41 test7 = "Hello" <> "World!"
43 test9 = Operators1.foo Operators1.@@ "Hello World"
45 test10 = "Hello" `Operators1.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
56module Main where
58import Operators1
59import Operators2
61import Prelude
62import Eff
63import Trace
64import Global
65import Arrays
67main =
68 print [ show $ test1 1 2 $ \x y -> x + y
69 , show test2
70 , show test3
71 , show test4
72 , show test5
73 , show test6
74 , show test7
75 , show test8
76 , show test9
77 , show test10
78 , show test11
79 , show (test12 k 1 2)
80 , show (test13 k 1 2)
81 ]