git.iko.soy/rowtype-yoga/purescript-native
on e82e607 help sign in
49 lines 811 B history raw
1module Main where
3import Prelude
4import Control.Monad.Eff
5import Control.Monad.ST
7test1 x = y
8 where
9 y :: Number
10 y = x + 1
12test2 x y = x' + y'
13 where
14 x' = x + 1
15 y' = y + 1
18test3 = f 1 2 3
19 where f x y z = x + y + z
22test4 = f (+) [1, 2]
23 where f x [y, z] = x y z
26test5 = g 10
27 where
28 f x | x > 0 = g (x / 2) + 1
29 f x = 0
30 g x = f (x - 1) + 1
32test6 = if f true then f 1 else f 2
33 where f :: forall a. a -> a
34 f x = x
36test7 :: Number -> Number
37test7 x = go x
38 where
39 go y | (x - 0.1 < y * y) && (y * y < x + 0.1) = y
40 go y = go $ (y + x / y) / 2
42main = do
43 Debug.Trace.print (test1 1)
44 Debug.Trace.print (test2 1 2)
45 Debug.Trace.print test3
46 Debug.Trace.print test4
47 Debug.Trace.print test5
48 Debug.Trace.print test6
49 Debug.Trace.print (test7 100)