git.iko.soy/rowtype-yoga/purescript-native
on ebbc4e4 help sign in
53 lines 1.1 kB history raw
1module Main where
3import Prelude
4import Control.Monad.Eff
5import Control.Monad.ST
7test1 x = let
8 y :: Number
9 y = x + 1.0
10 in y
12test2 x y =
13 let x' = x + 1.0 in
14 let y' = y + 1.0 in
15 x' + y'
17test3 = let f x y z = x + y + z in
18 f 1.0 2.0 3.0
20test4 = let f x [y, z] = x y z in
21 f (+) [1.0, 2.0]
23test5 = let
24 f x | x > 0.0 = g (x / 2.0) + 1.0
25 f x = 0.0
26 g x = f (x - 1.0) + 1.0
27 in f 10.0
29test7 = let
30 f :: forall a. a -> a
31 f x = x
32 in if f true then f 1.0 else f 2.0
34test8 :: Number -> Number
35test8 x = let
36 go y | (x - 0.1 < y * y) && (y * y < x + 0.1) = y
37 go y = go $ (y + x / y) / 2.0
38 in go x
40test10 _ =
41 let
42 f x = g x * 3.0
43 g x = f x / 2.0
44 in f 10.0
46main = do
47 Control.Monad.Eff.Console.print (test1 1.0)
48 Control.Monad.Eff.Console.print (test2 1.0 2.0)
49 Control.Monad.Eff.Console.print test3
50 Control.Monad.Eff.Console.print test4
51 Control.Monad.Eff.Console.print test5
52 Control.Monad.Eff.Console.print test7
53 Control.Monad.Eff.Console.print (test8 100.0)