git.iko.soy/rowtype-yoga/purescript-native
on 28fa718 help sign in
82 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
18 import Operators1 ((@@))
20 test1 :: forall n. (Num n) => n -> n -> (n -> n -> n) -> n
21 test1 x y z = x * y + z x y
23 test2 = (\x -> x.foo false) { foo : \_ -> 1 }
25 test3 = (\x y -> x)(1 + 2 * (1 + 2)) (true && (false || false))
27 k = \x -> \y -> x
29 test4 = 1 `k` 2
31 infixl 5 %%
33 (%%) :: Number -> Number -> Number
34 (%%) x y = x * y + y
36 test5 = 1 %% 2 %% 3
38 test6 = ((\x -> x) `k` 2) 3
40 (<>) = \s1 s2 -> s1 ++ s2
42 test7 = "Hello" <> "World!"
44 test9 = Operators1.foo @@ "Hello World"
46 test10 = "Hello" `Operators1.bar` "World"
48 (...) :: forall a. [a] -> [a] -> [a]
49 (...) = \as -> \bs -> as
51 test11 = [1, 2, 3] ... [4, 5, 6]
53 test12 (<%>) a b = a <%> b
55 test13 = \(<%>) a b -> a <%> b
57module Main where
59import Operators1
60import Operators2
62import Prelude
63import Eff
64import Trace
65import Global
66import Arrays
68main =
69 print [ show $ test1 1 2 $ \x y -> x + y
70 , show test2
71 , show test3
72 , show test4
73 , show test5
74 , show test6
75 , show test7
76 , show test8
77 , show test9
78 , show test10
79 , show test11
80 , show (test12 k 1 2)
81 , show (test13 k 1 2)
82 ]