git.iko.soy/rowtype-yoga/purescript-native
on 1ce015c help sign in
72 lines 1.2 kB history raw
1module Operators1 where
3 (@@) :: forall a b. (a -> b) -> a -> b
4 (@@) = \f x -> f x
6 foo :: String -> String
7 foo = \s -> s
8
9 test8 = foo @@ "Hello World"
11 bar = \s1 s2 -> s1 ++ s2
13module Operators2 where
15 test1 = \(x, y, z) -> x * y + z(x)(y)
17 test2 = (\x -> x.foo false) { foo : \_ -> 1 }
19 test3 = (\(x, y) -> x)(1 + 2 * (1 + 2), true && (false || false))
21 k = \x -> \y -> x
23 test4 = 1 `k` 2
25 infixl 5 %%
27 (%%) = \x -> \y -> x * y + y
29 test5 = 1 %% 2 %% 3
31 test6 = ((\x -> x) `k` 2) 3
33 (<>) = \s1 -> \s2 -> s1 ++ s2
35 test7 = "Hello" <> "World!"
37 test9 = Operators1.foo Operators1.@@ "Hello World"
39 test10 = "Hello" `Operators1.bar` "World"
41 (...) :: forall a. [a] -> [a] -> [a]
42 (...) = \as -> \bs -> as
44 test11 = [1, 2, 3] ... [4, 5, 6]
46 test12 (<%>) a b = a <%> b
48module Main where
50import Operators1
51import Operators2
53import Prelude
54import Eff
55import Trace
56import Global
57import Arrays
59main = do
60 print (test1 (1, 2, \x y -> x + y))
61 print test2
62 print test3
63 print test4
64 print test5
65 print test6
66 print test7
67 print test8
68 print test9
69 print test10
70 print test11
71 print (test12 k 1 2)