git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Fix some examples
d1d5cc2Phil Freeman
examples/failing/Arrays.purs+3−1
@@ -1 +1,3 @@
1+module Arrays where
2+
1−test = \arr -> arr !! (0 !! 0)
3+ test = \arr -> arr !! (0 !! 0)
examples/failing/Import.purs+3−1
@@ -1 +1,3 @@
1+module Module where
2+
1−import UndefinedModule
3+ import UndefinedModule
examples/failing/KindError.purs+3−1
@@ -1 +1,3 @@
1+module KindError where
2+
1−data KindError f a = One f | Two f a
3+ data KindError f a = One f | Two f a
examples/failing/LocalVars.purs+6−3
@@ -1,3 +1,6 @@
1+module LocalVars where
2+
1−bad = \x -> do
3+ bad = \x -> {
2− x = x + 1
4+ x = x + 1;
3− return x
5+ return x;
6+ }
examples/failing/PatternScope.purs+9−6
@@ -1,7 +1,10 @@
1+module PatternScope where
2+
1−-- Pattern scope doesn't leak
3+ -- Pattern scope doesn't leak
2−foobar = \x -> do
4+ foobar = \x -> {
3− var y = case x of
5+ var y = case x of
4− z | z % 2 == 0 -> 1
6+ z | z % 2 == 0 -> 1
5− _ -> 2
7+ _ -> 2;
6− return z
8+ return z;
9+ }
7
10
examples/failing/Rank2Types.purs+4−2
@@ -1,3 +1,5 @@
1−foreign import test :: (forall a. a -> a) -> Number
1+module Rank2Types where
2
2
3+ foreign import test :: (forall a. a -> a) -> Number
4+
3−test1 = test (\n -> n + 1)
5+ test1 = test (\n -> n + 1)
examples/failing/ReadShow.purs+5−3
@@ -1,5 +1,7 @@
1−foreign import read :: forall a. String -> a
1+module ReadShow where
2
2
3−foreign import show :: forall a. a -> String
3+ foreign import read :: forall a. String -> a
4
4
5+ foreign import show :: forall a. a -> String
6+
5−test = \x -> show (read x)
7+ test = \x -> show (read x)
examples/failing/SkolemEscape.purs+4−2
@@ -1,3 +1,5 @@
1−foreign import foo :: (forall a. a -> a) -> Number
1+module SkolemEscape where
2
2
3+ foreign import foo :: (forall a. a -> a) -> Number
4+
3−test = \x -> foo x
5+ test = \x -> foo x
examples/failing/TypeError.purs+3−3
@@ -1,3 +1,3 @@
1+module TypeError where
2+
1−test = do
3+ test = x ++ "A"
2− var x = 0
3− return x ++ "A"
examples/passing/Arrays.purs+17−15
@@ -1,20 +1,22 @@
1−test1 = \arr -> arr !! 0 + arr !! 1
1+module Arrays where
2
2
3−test2 = \arr -> case arr of
3+ test1 = \arr -> arr !! 0 + arr !! 1
4− [x, y] -> x + y
5− [x] -> x
6− [] -> 0
7− (x : y : _) -> x + y
8
4
9−data Tree = One Number | Some [Tree]
5+ test2 = \arr -> case arr of
6+ [x, y] -> x + y
7+ [x] -> x
8+ [] -> 0
9+ (x : y : _) -> x + y
10
10
11−test3 = \(tree, sum) -> case tree of
11+ data Tree = One Number | Some [Tree]
12− One n -> n
13− Some (n1 : n2 : rest) -> test3(n1, sum) * 10 + test3(n2, sum) * 5 + sum(rest)
14
12
13+ test3 = \(tree, sum) -> case tree of
14+ One n -> n
15+ Some (n1 : n2 : rest) -> test3(n1, sum) * 10 + test3(n2, sum) * 5 + sum(rest)
16+
15−test4 = \arr -> case arr of
17+ test4 = \arr -> case arr of
16− [] -> 0
18+ [] -> 0
17− [_] -> 0
19+ [_] -> 0
18− x : y : xs -> x * y + test4 xs
20+ x : y : xs -> x * y + test4 xs
19−
21+
20
22
examples/passing/Assign.purs+8−6
@@ -1,7 +1,9 @@
1+module Assign where
2+
1−sum = \n -> {
3+ sum = \n -> {
2− var x = 0;
4+ var x = 0;
3− for (i <- 0 until n) {
5+ for (i <- 0 until n) {
4− x = x + i;
6+ x = x + i;
7+ }
8+ return x;
5 }
9 }
6− return x;
7− }
examples/passing/Auto.purs+8−6
@@ -1,9 +1,11 @@
1−data Auto s i o = Auto { state :: s, step :: s -> i -> o }
1+module Auto where
2
2
3−type SomeAuto i o = forall r. (forall s. Auto s i o -> r) -> r
3+ data Auto s i o = Auto { state :: s, step :: s -> i -> o }
4
4
5−exists :: forall s i o. s -> (s -> i -> o) -> SomeAuto i o
5+ type SomeAuto i o = forall r. (forall s. Auto s i o -> r) -> r
6−exists = \state step f -> f (Auto { state: state, step: step })
7
6
7+ exists :: forall s i o. s -> (s -> i -> o) -> SomeAuto i o
8+ exists = \state step f -> f (Auto { state: state, step: step })
9+
8−run :: forall i o. SomeAuto i o -> i -> o
10+ run :: forall i o. SomeAuto i o -> i -> o
9−run = \s i -> s (\a -> case a of Auto a -> a.step a.state i)
11+ run = \s i -> s (\a -> case a of Auto a -> a.step a.state i)
examples/passing/Church.purs+10−8
@@ -1,12 +1,14 @@
1−type List a = forall r. r -> (a -> r -> r) -> r
1+module Church where
2
2
3−empty :: forall a. List a
3+ type List a = forall r. r -> (a -> r -> r) -> r
4−empty = \r f -> r
5
4
6−cons :: forall a. a -> List a -> List a
5+ empty :: forall a. List a
7−cons = \a l r f -> f a (l r f)
6+ empty = \r f -> r
8
7
9−append :: forall a. List a -> List a -> List a
8+ cons :: forall a. a -> List a -> List a
10−append = \l1 l2 r f -> l2 (l1 r f) f
9+ cons = \a l r f -> f a (l r f)
11
10
11+ append :: forall a. List a -> List a -> List a
12+ append = \l1 l2 r f -> l2 (l1 r f) f
13+
12−test = append (cons 1 empty) (cons 2 empty)
14+ test = append (cons 1 empty) (cons 2 empty)
examples/passing/Conditional.purs+5−3
@@ -1,5 +1,7 @@
1−fns = \f -> if f true then f else \x -> x
1+module Conditional where
2
2
3−bin = \x -> if x && !x then x else x
3+ fns = \f -> if f true then f else \x -> x
4
4
5+ bin = \x -> if x && !x then x else x
6+
5−not = \x -> if x then false else true
7+ not = \x -> if x then false else true
examples/passing/Cons.purs+6−4
@@ -1,7 +1,9 @@
1−infixr 6 :
1+module Cons where
2
2
3−foreign import (:) :: forall a. a -> [a] -> [a]
3+ infixr 6 :
4
4
5−test1 = \xs -> 1 : xs
5+ foreign import (:) :: forall a. a -> [a] -> [a]
6
6
7+ test1 = \xs -> 1 : xs
8+
7−test2 = 1 : 2 : 3 : []
9+ test2 = 1 : 2 : 3 : []
examples/passing/Console.purs+17−15
@@ -1,23 +1,25 @@
1−foreign import data IO :: * -> *
1+module Console where
2
2
3−foreign import ret :: forall a. a -> IO a
3+ foreign import data IO :: * -> *
4
4
5−foreign import (>>=) :: forall a b. IO a -> (a -> IO b) -> IO b
5+ foreign import ret :: forall a. a -> IO a
6
6
7−(*>) = \a -> \b -> a >>= \x -> b
7+ foreign import (>>=) :: forall a b. IO a -> (a -> IO b) -> IO b
8
8
9−foreign import putStrLn :: String -> IO {}
9+ (*>) = \a -> \b -> a >>= \x -> b
10
10
11+ foreign import putStrLn :: String -> IO {}
12+
11−replicateM_ :: forall a. Number -> IO a -> IO {}
13+ replicateM_ :: forall a. Number -> IO a -> IO {}
12−replicateM_ = \n -> \x ->
14+ replicateM_ = \n -> \x ->
13− {
15+ {
14− var io = ret {};
16+ var io = ret {};
15− for (i <- 0 until n)
17+ for (i <- 0 until n)
16− {
18+ {
17− io = x *> io;
19+ io = x *> io;
20+ }
21+ return io;
18 }
22 }
19− return io;
20− }
21
23
22−main = replicateM_ 10 (putStrLn "Hello World!")
24+ main = replicateM_ 10 (putStrLn "Hello World!")
23
25
examples/passing/ExternData.purs+9−7
@@ -1,13 +1,15 @@
1−foreign import data IO :: * -> *
1+module ExternData where
2
2
3−foreign import fmap :: forall a b. IO a -> (a -> b) -> IO b
3+ foreign import data IO :: * -> *
4
4
5−foreign import ret :: forall a. a -> IO a
5+ foreign import fmap :: forall a b. IO a -> (a -> b) -> IO b
6
6
7−foreign import bind :: forall a b. IO a -> (a -> IO b) -> IO b
7+ foreign import ret :: forall a. a -> IO a
8
8
9−foreign import showMessage :: String -> IO { }
9+ foreign import bind :: forall a b. IO a -> (a -> IO b) -> IO b
10
10
11−foreign import prompt :: IO String
11+ foreign import showMessage :: String -> IO { }
12
12
13+ foreign import prompt :: IO String
14+
13−main = prompt `bind` \s -> showMessage s
15+ main = prompt `bind` \s -> showMessage s
examples/passing/FFI.purs+5−3
@@ -1,5 +1,7 @@
1−foreign import foo :: String -> String
1+module FFI where
2
2
3−bar :: String -> String
3+ foreign import foo :: String -> String
4
4
5+ bar :: String -> String
6+
5−bar = \x -> foo (x ++ "bar")
7+ bar = \x -> foo (x ++ "bar")
examples/passing/Foreach.purs+8−6
@@ -1,7 +1,9 @@
1+module Foreach where
2+
1−sum = \ns -> {
3+ sum = \ns -> {
2− var total = 0;
4+ var total = 0;
3− foreach (n in ns) {
5+ foreach (n in ns) {
4− total = total + n;
6+ total = total + n;
7+ }
8+ return total;
5 }
9 }
6− return total;
7− }
examples/passing/Functions.purs+8−6
@@ -1,11 +1,13 @@
1−test1 = \ -> 0
1+module Functions where
2
2
3−test2 = \() -> 0
3+ test1 = \ -> 0
4
4
5−test3 = \a (b, c) d -> a + b + c + d
5+ test2 = \() -> 0
6
6
7−test4 = \(a) -> a
7+ test3 = \a (b, c) d -> a + b + c + d
8
8
9−test5 = \(%%) -> 1 %% 2
9+ test4 = \(a) -> a
10
10
11+ test5 = \(%%) -> 1 %% 2
12+
11−test6 = \((+++), (***)) -> 1 +++ 2 *** 3
13+ test6 = \((+++), (***)) -> 1 +++ 2 *** 3
examples/passing/Guards.purs+9−7
@@ -1,8 +1,10 @@
1−collatz = \x -> case x of
1+module Guards where
2− y | y % 2 == 0 -> y / 2
3− y -> y * 3 + 1
4
2
3+ collatz = \x -> case x of
4+ y | y % 2 == 0 -> y / 2
5+ y -> y * 3 + 1
6+
5−-- Guards have access to current scope
7+ -- Guards have access to current scope
6−collatz2 = \x y -> case x of
8+ collatz2 = \x y -> case x of
7− z | y > 0 -> z / 2
9+ z | y > 0 -> z / 2
8− z -> z * 3 + 1
10+ z -> z * 3 + 1
examples/passing/IfThenElse.purs+30−28
@@ -1,34 +1,36 @@
1−testIf =
1+module IfThenElse where
2− {
3− var x = 0;
4− if (x == 0) {
5− x = x + 1;
6− }
7− return x;
8− }
9
2
10−testIfElse =
3+ testIf =
11− {
4+ {
12− var x = 0;
5+ var x = 0;
13− if (x == 0) {
6+ if (x == 0) {
14− x = x + 1;
7+ x = x + 1;
15− } else {
8+ }
16− x = x - 1;
9+ return x;
17 }
10 }
18− return x;
19− }
20
11
21−testIfElseIf = \x ->
12+ testIfElse =
22− {
13+ {
23− var y = x;
14+ var x = 0;
24− while (y > 1) {
25− if (y % 3 == 0) {
15+ if (x == 0) {
26− y = y / 3;
16+ x = x + 1;
27− } else if (y % 3 == 1) {
28− y = (y - 1) % 3;
29 } else {
17 } else {
18+ x = x - 1;
19+ }
20+ return x;
21+ }
22+
23+ testIfElseIf = \x ->
24+ {
25+ var y = x;
26+ while (y > 1) {
27+ if (y % 3 == 0) {
28+ y = y / 3;
29+ } else if (y % 3 == 1) {
30+ y = (y - 1) % 3;
31+ } else {
30− y = y * 4 + 1;
32+ y = y * 4 + 1;
33+ }
31 }
34 }
35+ return y;
32 }
36 }
33− return y;
34− }
examples/passing/List.purs+17−15
@@ -1,19 +1,21 @@
1+module List where
2+
1−data List a
3+ data List a
2− = Nil
4+ = Nil
3− | Cons
5+ | Cons
4− { head :: a
6+ { head :: a
5− , tail :: List a
7+ , tail :: List a
6− }
8+ }
7
9
8−isNull Nil = true
10+ isNull Nil = true
9−isNull _ = false
11+ isNull _ = false
10
12
11−concat Nil l2 = l2
13+ concat Nil l2 = l2
12−concat (Cons x) l2 = Cons
14+ concat (Cons x) l2 = Cons
13− { head: x.head
15+ { head: x.head
14− , tail: concat x.tail l2
16+ , tail: concat x.tail l2
15− }
17+ }
16
18
17−flatten Nil = Nil
19+ flatten Nil = Nil
18−flatten (Cons cons) = concat cons.head (flatten cons.tail)
20+ flatten (Cons cons) = concat cons.head (flatten cons.tail)
19
21
examples/passing/Match.purs+4−2
@@ -1,3 +1,5 @@
1−data Foo a = Foo
1+module Match where
2
2
3+ data Foo a = Foo
4+
3−foo = \f -> case f of Foo -> "foo"
5+ foo = \f -> case f of Foo -> "foo"
examples/passing/Maybe.purs+8−6
@@ -1,9 +1,11 @@
1−data Maybe a = Nothing | Just a
1+module Maybe where
2
2
3−maybe :: forall a b. b -> (a -> b) -> Maybe a -> b
3+ data Maybe a = Nothing | Just a
4−maybe b _ Nothing = b
5−maybe _ f (Just a) = f a
6
4
5+ maybe :: forall a b. b -> (a -> b) -> Maybe a -> b
7−fmap m f = maybe Nothing (\a -> Just (f a)) m
6+ maybe b _ Nothing = b
7+ maybe _ f (Just a) = f a
8
8
9+ fmap m f = maybe Nothing (\a -> Just (f a)) m
10+
9−bind m f = maybe Nothing f m
11+ bind m f = maybe Nothing f m
examples/passing/MethodCall.purs+7−5
@@ -1,6 +1,8 @@
1−foreign import foo :: () -> {}
1+module MethodCall where
2
2
3+ foreign import foo :: () -> {}
4+
3−test = {
5+ test = {
4− foo();
6+ foo();
5− return 0;
7+ return 0;
6− }
8+ }
examples/passing/Monad.purs+21−19
@@ -1,26 +1,28 @@
1−type Monad m = { ret :: forall a. a -> m a
1+module Monad where
2− , bind :: forall a b. m a -> (a -> m b) -> m b }
3
2
4−data Id a = Id a
3+ type Monad m = { ret :: forall a. a -> m a
4+ , bind :: forall a b. m a -> (a -> m b) -> m b }
5
5
6−id :: Monad Id
6+ data Id a = Id a
7−id = { ret : Id
8− , bind : \ma f -> case ma of Id a -> f a }
9
7
10−data Maybe a = Nothing | Just a
8+ id :: Monad Id
9+ id = { ret : Id
10+ , bind : \ma f -> case ma of Id a -> f a }
11
11
12−maybe :: Monad Maybe
12+ data Maybe a = Nothing | Just a
13−maybe = { ret : Just
14− , bind : \ma f -> case ma of
15− Nothing -> Nothing
16− Just a -> f a
17− }
18
13
19−test :: forall m. Monad m -> m Number
14+ maybe :: Monad Maybe
20−test = \m -> m.bind (m.ret 1) (\n1 ->
15+ maybe = { ret : Just
21− m.bind (m.ret "Test") (\n2 ->
16+ , bind : \ma f -> case ma of
22− m.ret n1))
17+ Nothing -> Nothing
18+ Just a -> f a
19+ }
23
20
24−test1 = test id
21+ test :: forall m. Monad m -> m Number
22+ test = \m -> m.bind (m.ret 1) (\n1 ->
23+ m.bind (m.ret "Test") (\n2 ->
24+ m.ret n1))
25
25
26+ test1 = test id
27+
26−test2 = test maybe
28+ test2 = test maybe
examples/passing/NameResolution.pursdeleted−15
@@ -1,15 +0,0 @@
1−foo = \x -> x
2−
3−module A where
4− bar = foo
5−
6− module B where
7−
8− abc = foo
9− xyz = bar
10−
11− foo = \x y -> x
12−
13− baz = foo
14−
15− abc = A.B.abc
examples/passing/NamedPatterns.purs+5−3
@@ -1,3 +1,5 @@
1+module NamedPatterns where
2+
1−foo = \x -> case x of
3+ foo = \x -> case x of
2− y@{ foo = "Foo" } -> y
4+ y@{ foo = "Foo" } -> y
3− y -> y
5+ y -> y
examples/passing/Nested.purs+4−2
@@ -1,3 +1,5 @@
1−data Extend r a = Extend { prev :: r a, next :: a }
1+module Nested where
2
2
3+ data Extend r a = Extend { prev :: r a, next :: a }
4+
3−data Matrix r a = Square (r (r a)) | Bigger (Matrix (Extend r) a)
5+ data Matrix r a = Square (r (r a)) | Bigger (Matrix (Extend r) a)
examples/passing/ObjectUpdate.purs+12−10
@@ -1,14 +1,16 @@
1−update1 = \o -> o { foo = "Foo" }
1+module ObjectUpdate where
2
2
3−update2 :: forall r. { foo :: String | r } -> { foo :: String | r }
4−update2 = \o -> o { foo = "Foo" }
3+ update1 = \o -> o { foo = "Foo" }
5
4
6−replace = \o -> case o of
5+ update2 :: forall r. { foo :: String | r } -> { foo :: String | r }
7− { foo = "Foo" } -> o { foo = "Bar" }
6+ update2 = \o -> o { foo = "Foo" }
8− { foo = "Bar" } -> o { bar = "Baz" }
9− o -> o
10
7
11−polyUpdate :: forall a r. { foo :: a | r } -> { foo :: String | r }
8+ replace = \o -> case o of
12−polyUpdate = \o -> o { foo = "Foo" }
9+ { foo = "Foo" } -> o { foo = "Bar" }
10+ { foo = "Bar" } -> o { bar = "Baz" }
11+ o -> o
13
12
13+ polyUpdate :: forall a r. { foo :: a | r } -> { foo :: String | r }
14+ polyUpdate = \o -> o { foo = "Foo" }
15+
14−inferPolyUpdate = \o -> o { foo = "Foo" }
16+ inferPolyUpdate = \o -> o { foo = "Foo" }
examples/passing/Objects.purs+9−7
@@ -1,12 +1,14 @@
1−test = \x -> x.foo + x.bar
1+module Objects where
2
2
3−append = \o -> { foo: o.foo, bar: 1 }
3+ test = \x -> x.foo + x.bar
4
4
5−apTest = append({foo : "Foo", baz: "Baz"})
5+ append = \o -> { foo: o.foo, bar: 1 }
6
6
7−f = (\a -> a.b.c) { b: { c: 1, d: "Hello" }, e: "World" }
7+ apTest = append({foo : "Foo", baz: "Baz"})
8
8
9−g = (\a -> a.f { x: 1, y: "y" }) { f: \o -> o.x + 1 }
9+ f = (\a -> a.b.c) { b: { c: 1, d: "Hello" }, e: "World" }
10
10
11+ g = (\a -> a.f { x: 1, y: "y" }) { f: \o -> o.x + 1 }
12+
11−typed :: { foo :: Number }
13+ typed :: { foo :: Number }
12−typed = { foo: 0 }
14+ typed = { foo: 0 }
examples/passing/Operators.purs+27−25
@@ -1,42 +1,44 @@
1−test1 = \(x, y, z) -> x * y + z(x)(y)
1+module Operators1 where
2
2
3−test2 = (\x -> x.foo false) { foo : \_ -> 1 }
3+ (@@) :: forall a b. (a -> b) -> a -> b
4+ (@@) = \f x -> f x
4
5
5−test3 = (\(x, y) -> x)(1 + 2 * (1 + 2), true && (false || false))
6+ foo :: String -> String
7+ foo = \s -> s
8+
9+ test8 = foo @@ "Hello World"
6
10
7−k = \x -> \y -> x
11+ bar = \s1 s2 -> s1 ++ s2
8
12
9−test4 = 1 `k` 2
13+module Operators2 where
10
14
11−infixl 5 %%
15+ test1 = \(x, y, z) -> x * y + z(x)(y)
12
16
13−(%%) = \x -> \y -> x * y + y
17+ test2 = (\x -> x.foo false) { foo : \_ -> 1 }
14
18
15−test5 = 1 %% 2 %% 3
19+ test3 = (\(x, y) -> x)(1 + 2 * (1 + 2), true && (false || false))
16
20
17−test6 = ((\x -> x) `k` 2) 3
21+ k = \x -> \y -> x
18
22
19−(<>) = \s1 -> \s2 -> s1 ++ s2
23+ test4 = 1 `k` 2
20
24
21−test7 = "Hello" <> "World!"
25+ infixl 5 %%
22
26
23−module Ops where
24−
25− (@@) :: forall a b. (a -> b) -> a -> b
26− (@@) = \f x -> f x
27+ (%%) = \x -> \y -> x * y + y
27
28
28− foo :: String -> String
29+ test5 = 1 %% 2 %% 3
29− foo = \s -> s
30−
31− test8 = foo @@ "Hello World"
32
30
31+ test6 = ((\x -> x) `k` 2) 3
32+
33− bar = \s1 s2 -> s1 ++ s2
33+ (<>) = \s1 -> \s2 -> s1 ++ s2
34+
35+ test7 = "Hello" <> "World!"
34
36
35−test9 = Ops.foo Ops.@@ "Hello World"
37+ test9 = Operators1.foo Operators1.@@ "Hello World"
36
38
37−test10 = "Hello" `Ops.bar` "World"
39+ test10 = "Hello" `Operators1.bar` "World"
38
40
39−(...) :: forall a. [a] -> [a] -> [a]
41+ (...) :: forall a. [a] -> [a] -> [a]
40−(...) = \as -> \bs -> as
42+ (...) = \as -> \bs -> as
41
43
42−test11 = [1, 2, 3] ... [4, 5, 6]
44+ test11 = [1, 2, 3] ... [4, 5, 6]
examples/passing/Patterns.purs+20−18
@@ -1,23 +1,25 @@
1−test = \x -> case x of
1+module Patterns where
2− { str = "Foo", bool = true } -> true
3− { str = "Bar", bool = b } -> b
4− _ -> false
5
2
6−f = \o -> case o of
3+ test = \x -> case x of
7− { foo = "Foo" } -> o.bar
4+ { str = "Foo", bool = true } -> true
8− _ -> 0
5+ { str = "Bar", bool = b } -> b
6+ _ -> false
9
7
10−g = \o -> case o of
8+ f = \o -> case o of
11− { arr = [x : xs], take = "car" } -> x
9+ { foo = "Foo" } -> o.bar
12− { arr = [_, x : xs], take = "cadr" } -> x
13− _ -> 0
10+ _ -> 0
14
11
12+ g = \o -> case o of
13+ { arr = [x : xs], take = "car" } -> x
14+ { arr = [_, x : xs], take = "cadr" } -> x
15+ _ -> 0
15
16
16−h = \o -> case o of
17− a@[_,_,_] -> a
18− _ -> []
19
17
18+ h = \o -> case o of
19+ a@[_,_,_] -> a
20+ _ -> []
21+
20−isDesc = \o -> case o of
22+ isDesc = \o -> case o of
21− [x, y] | x > y -> true
23+ [x, y] | x > y -> true
22− _ -> false
24+ _ -> false
23−
25+
examples/passing/Person.purs+8−6
@@ -1,7 +1,9 @@
1−data Person = Person { name :: String, age :: Number }
1+module Person where
2
2
3+ data Person = Person { name :: String, age :: Number }
4+
3−foreign import itoa :: Number -> String
5+ foreign import itoa :: Number -> String
4−
6+
5−showPerson :: Person -> String
7+ showPerson :: Person -> String
6−showPerson = \p -> case p of
8+ showPerson = \p -> case p of
7− Person o -> o.name ++ ", aged " ++ itoa(o.age)
9+ Person o -> o.name ++ ", aged " ++ itoa(o.age)
examples/passing/Rank2Data.purs+18−16
@@ -1,23 +1,25 @@
1−data Id = Id forall a. a -> a
1+module Rank2Data where
2
2
3−runId = \id a -> case id of
3+ data Id = Id forall a. a -> a
4− Id f -> f a
5
4
6−data Nat = Nat forall r. r -> (r -> r) -> r
5+ runId = \id a -> case id of
6+ Id f -> f a
7
7
8−runNat = \nat -> case nat of
8+ data Nat = Nat forall r. r -> (r -> r) -> r
9− Nat f -> f 0 (\n -> n + 1)
10
9
11−zero = Nat (\zero _ -> zero)
10+ runNat = \nat -> case nat of
11+ Nat f -> f 0 (\n -> n + 1)
12
12
13−succ = \n -> case n of
14− Nat f -> Nat (\zero succ -> succ (f zero succ))
13+ zero = Nat (\zero _ -> zero)
15
14
16−add = \n m -> case n of
15+ succ = \n -> case n of
17− Nat f -> case m of
18− Nat g -> Nat (\zero succ -> g (f zero succ) succ)
16+ Nat f -> Nat (\zero succ -> succ (f zero succ))
19
17
18+ add = \n m -> case n of
19+ Nat f -> case m of
20+ Nat g -> Nat (\zero succ -> g (f zero succ) succ)
21+
20−one = succ zero
22+ one = succ zero
21−two = succ zero
23+ two = succ zero
22−four = add two two
24+ four = add two two
23−fourNumber = runNat four
25+ fourNumber = runNat four
examples/passing/Rank2Types.purs+13−11
@@ -1,17 +1,19 @@
1−test1 :: (forall a. (a -> a)) -> Number
1+module Rank2Types where
2−test1 = \f -> f 0
3
2
4−foreign import data ST :: * -> * -> *
3+ test1 :: (forall a. (a -> a)) -> Number
4+ test1 = \f -> f 0
5
5
6−foreign import runST :: forall a. (forall s. ST s a) -> a
6+ foreign import data ST :: * -> * -> *
7
7
8−foreign import exampleST :: forall s. ST s Number
8+ foreign import runST :: forall a. (forall s. ST s a) -> a
9
9
10−testST = runST exampleST
10+ foreign import exampleST :: forall s. ST s Number
11
11
12−foreign import push :: forall el. el -> [el] -> [el]
12+ testST = runST exampleST
13
13
14+ foreign import push :: forall el. el -> [el] -> [el]
15+
14−replicateM :: forall m a. (forall a. a -> m a) -> (forall a b. m a -> (a -> m b) -> m b) -> Number -> m a -> m [a]
16+ replicateM :: forall m a. (forall a. a -> m a) -> (forall a b. m a -> (a -> m b) -> m b) -> Number -> m a -> m [a]
15−replicateM = \ret bind n m -> case n of
17+ replicateM = \ret bind n m -> case n of
16− 0 -> ret []
18+ 0 -> ret []
17− n -> bind m (\x -> bind (replicateM ret bind (n - 1) m) (\xs -> ret (push x xs)))
19+ n -> bind m (\x -> bind (replicateM ret bind (n - 1) m) (\xs -> ret (push x xs)))
examples/passing/Recursion.purs+6−4
@@ -1,4 +1,6 @@
1+module Recursion where
2+
1−fib = \n -> case n of
3+ fib = \n -> case n of
2− 0 -> 1
4+ 0 -> 1
3− 1 -> 1
5+ 1 -> 1
4− n -> fib (n - 1) + fib (n - 2)
6+ n -> fib (n - 1) + fib (n - 2)
examples/passing/TopLevelCase.purs+11−9
@@ -1,12 +1,14 @@
1−gcd :: (Number, Number) -> Number
1+module TopLevelCase where
2−gcd (0, x) = x
3−gcd (x, 0) = x
4−gcd (x, y) | x > y = gcd (x % y, y)
5−gcd (x, y) = gcd (y % x, x)
6
2
7−guardsTest (x:xs) | x > 0 = guardsTest xs
3+ gcd :: (Number, Number) -> Number
8−guardsTest xs = xs
4+ gcd (0, x) = x
5+ gcd (x, 0) = x
6+ gcd (x, y) | x > y = gcd (x % y, y)
7+ gcd (x, y) = gcd (y % x, x)
9
8
10−data A = A
9+ guardsTest (x:xs) | x > 0 = guardsTest xs
10+ guardsTest xs = xs
11
11
12+ data A = A
13+
12−parseTest A 0 = 0
14+ parseTest A 0 = 0
examples/passing/TypeDecl.purs+13−11
@@ -1,14 +1,16 @@
1−id :: forall a. (a) -> a
1+module TypeDecl where
2−id = \x -> x
3
2
4−k :: String -> Number -> String
3+ id :: forall a. (a) -> a
5−k = \x -> \y -> x
4+ id = \x -> x
6
5
6+ k :: String -> Number -> String
7+ k = \x -> \y -> x
8+
7−iterate :: forall a. Number -> (a -> a) -> a -> a
9+ iterate :: forall a. Number -> (a -> a) -> a -> a
8−iterate = \n -> \f -> \a -> {
10+ iterate = \n -> \f -> \a -> {
9− var result = a;
11+ var result = a;
10− for (i <- 0 until n) {
12+ for (i <- 0 until n) {
11− result = f result;
13+ result = f result;
14+ }
15+ return result;
12 }
16 }
13− return result;
14− }
examples/passing/TypeSynonyms.purs+26−24
@@ -1,31 +1,33 @@
1−type Lens a b =
1+module TypeSynonyms where
2− { get :: a -> b
3− , set :: a -> b -> a
4− }
5
2
6−composeLenses :: forall a b c. Lens a b -> Lens b c -> Lens a c
3+ type Lens a b =
7−composeLenses = \l1 -> \l2 ->
8− { get: \a -> l2.get (l1.get a)
4+ { get :: a -> b
9− , set: \a -> \c ->
5+ , set :: a -> b -> a
10− {
11− var b = l1.get a;
12− var b1 = l2.set b c;
13− return l1.set a b1;
14 }
6 }
15− }
16
7
8+ composeLenses :: forall a b c. Lens a b -> Lens b c -> Lens a c
9+ composeLenses = \l1 -> \l2 ->
10+ { get: \a -> l2.get (l1.get a)
11+ , set: \a -> \c ->
12+ {
13+ var b = l1.get a;
14+ var b1 = l2.set b c;
15+ return l1.set a b1;
16+ }
17+ }
18+
17−type Pair a b = { fst :: a, snd :: b }
19+ type Pair a b = { fst :: a, snd :: b }
18
20
19−fst :: forall a b. Lens (Pair a b) a
21+ fst :: forall a b. Lens (Pair a b) a
20−fst =
22+ fst =
21− { get: \p -> p.fst
23+ { get: \p -> p.fst
22− , set: \p -> \a -> { fst: a, snd: p.snd }
24+ , set: \p -> \a -> { fst: a, snd: p.snd }
23− }
25+ }
24
26
25−test1 :: forall a b c. Lens (Pair (Pair a b) c) a
27+ test1 :: forall a b c. Lens (Pair (Pair a b) c) a
26−test1 = composeLenses fst fst
28+ test1 = composeLenses fst fst
27
29
28−foreign import head :: forall a. Lens [a] a
30+ foreign import head :: forall a. Lens [a] a
29
31
30−test2 :: forall a b c. Lens (Pair [Pair a b] c) a
32+ test2 :: forall a b c. Lens (Pair [Pair a b] c) a
31−test2 = composeLenses fst (composeLenses head fst)
33+ test2 = composeLenses fst (composeLenses head fst)
examples/passing/iota.purs+5−3
@@ -1,5 +1,7 @@
1−s = \x -> \y -> \z -> x z (y z)
1+module Iota where
2
2
3−k = \x -> \y -> x
3+ s = \x -> \y -> \z -> x z (y z)
4
4
5+ k = \x -> \y -> x
6+
5−iota = \x -> x s k
7+ iota = \x -> x s k
examples/passing/s.purs+3−1
@@ -1 +1,3 @@
1+module S where
2+
1−s = \x y z -> x z (y z)
3+ s = \x y z -> x z (y z)
libraries/jquery/example.purs+10−6
@@ -1,6 +1,10 @@
1+module Example where
2+
3+ import JQuery
4+
1−main = {
5+ main = {
2− var div = create "<div>";
6+ var div = create "<div>";
3− div = div `appendText` "Hello World!" `css` { color: "#FF0000" };
7+ div = div `appendText` "Hello World!" `css` { color: "#FF0000" };
4− div = div `appendTo` select "body";
8+ div = div `appendTo` select "body";
5− return { };
9+ return { };
6− }
10+ }
libraries/jquery/jquery.purs+18−16
@@ -1,23 +1,25 @@
1−-- The jQuery wrapper type
1+module JQuery where
2−foreign import data JQuery :: *
3
2
4−-- Wrapper function for jQuery selection $('..')
3+ -- The jQuery wrapper type
5−foreign import select :: String -> JQuery
4+ foreign import data JQuery :: *
6
5
7−-- Wrapper function for jQuery creation e.g. $('<div>')
6+ -- Wrapper function for jQuery selection $('..')
8−foreign import create :: String -> JQuery
7+ foreign import select :: String -> JQuery
9
8
10−-- .attr({ ... })
9+ -- Wrapper function for jQuery creation e.g. $('<div>')
11−foreign import attr :: forall attr. JQuery -> { | attr } -> JQuery
10+ foreign import create :: String -> JQuery
12
11
13−-- .css({ ... })
12+ -- .attr({ ... })
14−foreign import css :: forall css. JQuery -> { | css } -> JQuery
13+ foreign import attr :: forall attr. JQuery -> { | attr } -> JQuery
15
14
16−-- .append(...)
15+ -- .css({ ... })
17−foreign import append :: JQuery -> JQuery -> JQuery
16+ foreign import css :: forall css. JQuery -> { | css } -> JQuery
18
17
19−-- .appendTo(...)
18+ -- .append(...)
20−foreign import appendTo :: JQuery -> JQuery -> JQuery
19+ foreign import append :: JQuery -> JQuery -> JQuery
21
20
21+ -- .appendTo(...)
22+ foreign import appendTo :: JQuery -> JQuery -> JQuery
23+
22−-- .append(...)
24+ -- .append(...)
23−foreign import appendText :: JQuery -> String -> JQuery
25+ foreign import appendText :: JQuery -> String -> JQuery
libraries/prelude/prelude.purs+173−171
@@ -1,263 +1,265 @@
1−id :: forall a. a -> a
1+module Prelude where
2−id = \x -> x
3
2
4−flip :: forall a b c. (a -> b -> c) -> b -> a -> c
3+ id :: forall a. a -> a
5−flip = \f -> \b -> \a -> f a b
4+ id = \x -> x
6
5
7−konst :: forall a b. a -> b -> a
6+ flip :: forall a b c. (a -> b -> c) -> b -> a -> c
8−konst = \a -> \b -> a
7+ flip = \f -> \b -> \a -> f a b
9
8
10−(|>) :: forall a b c. (a -> b) -> (b -> c) -> a -> c
9+ konst :: forall a b. a -> b -> a
11−(|>) = \f -> \g -> \a -> g (f a)
10+ konst = \a -> \b -> a
12
11
13−(<|) :: forall a b c. (b -> c) -> (a -> b) -> a -> c
12+ (|>) :: forall a b c. (a -> b) -> (b -> c) -> a -> c
14−(<|) = flip (|>)
13+ (|>) = \f -> \g -> \a -> g (f a)
15
14
16−-- Maybe
15+ (<|) :: forall a b c. (b -> c) -> (a -> b) -> a -> c
16+ (<|) = flip (|>)
17
17
18−data Maybe a = Nothing | Just a
18+ -- Maybe
19
19
20−maybe :: forall a b. b -> (a -> b) -> Maybe a -> b
20+ data Maybe a = Nothing | Just a
21−maybe b _ Nothing = b
22−maybe _ f (Just a) = f a
23
21
24−fromMaybe :: forall a. a -> Maybe a -> a
22+ maybe :: forall a b. b -> (a -> b) -> Maybe a -> b
25−fromMaybe a = maybe a id
23+ maybe b _ Nothing = b
24+ maybe _ f (Just a) = f a
26
25
27−bindMaybe :: forall a b. Maybe a -> (a -> Maybe b) -> Maybe b
26+ fromMaybe :: forall a. a -> Maybe a -> a
28−bindMaybe m f = maybe Nothing f m
27+ fromMaybe a = maybe a id
29
28
30−-- Either
29+ bindMaybe :: forall a b. Maybe a -> (a -> Maybe b) -> Maybe b
30+ bindMaybe m f = maybe Nothing f m
31
31
32−data Either a b = Left a | Right b
32+ -- Either
33
33
34−either :: forall a b c. (a -> c) -> (b -> c) -> Either a b -> c
34+ data Either a b = Left a | Right b
35−either f _ (Left a) = f a
36−either _ g (Right b) = g b
37
35
38−bindEither :: forall e a b. Either e a -> (a -> Either e b) -> Either e b
36+ either :: forall a b c. (a -> c) -> (b -> c) -> Either a b -> c
39−bindEither = either (\e _ -> Left e) (\a f -> f a)
37+ either f _ (Left a) = f a
38+ either _ g (Right b) = g b
40
39
41−-- Arrays
40+ bindEither :: forall e a b. Either e a -> (a -> Either e b) -> Either e b
41+ bindEither = either (\e _ -> Left e) (\a f -> f a)
42
42
43−head :: forall a. [a] -> a
43+ -- Arrays
44−head (x : _) = x
45
44
46−headSafe :: forall a. [a] -> Maybe a
45+ head :: forall a. [a] -> a
47−headSafe (x : _) = Just x
46+ head (x : _) = x
48−headSafe _ = Nothing
49
47
50−tail :: forall a. [a] -> [a]
48+ headSafe :: forall a. [a] -> Maybe a
51−tail (_ : xs) = xs
49+ headSafe (x : _) = Just x
50+ headSafe _ = Nothing
52
51
53−tailSafe :: forall a. [a] -> Maybe [a]
52+ tail :: forall a. [a] -> [a]
54−tailSafe (_ : xs) = Just xs
53+ tail (_ : xs) = xs
55−tailSafe _ = Nothing
56
54
57−foreign import map :: forall a b. (a -> b) -> [a] -> [b]
55+ tailSafe :: forall a. [a] -> Maybe [a]
56+ tailSafe (_ : xs) = Just xs
57+ tailSafe _ = Nothing
58
58
59−foldr :: forall a b. (a -> b -> a) -> a -> [b] -> a
59+ foreign import map :: forall a b. (a -> b) -> [a] -> [b]
60−foldr f a (b : bs) = f (foldr f a bs) b
61−foldr _ a [] = a
62
60
61+ foldr :: forall a b. (a -> b -> a) -> a -> [b] -> a
62+ foldr f a (b : bs) = f (foldr f a bs) b
63+ foldr _ a [] = a
64+
63−foldl :: forall a b. (a -> b -> b) -> b -> [a] -> b
65+ foldl :: forall a b. (a -> b -> b) -> b -> [a] -> b
64−foldl f b as = {
66+ foldl f b as = {
65− var result = b;
67+ var result = b;
66− foreach (a in as) {
68+ foreach (a in as) {
67− result = f a result;
69+ result = f a result;
70+ }
71+ return result;
68 }
72 }
69− return result;
70− }
71
73
72−foreign import member "length" length :: forall a. [a] -> Number
74+ foreign import member "length" length :: forall a. [a] -> Number
73
75
74−foreign import indexOf :: forall a. [a] -> a -> Number
76+ foreign import indexOf :: forall a. [a] -> a -> Number
75
77
76−foreign import lastIndexOf :: forall a. [a] -> a -> Number
78+ foreign import lastIndexOf :: forall a. [a] -> a -> Number
77
79
78−foreign import concat :: forall a. [a] -> [a] -> [a]
80+ foreign import concat :: forall a. [a] -> [a] -> [a]
79
81
80−foreign import join :: [String] -> String
82+ foreign import join :: [String] -> String
81
83
82−foreign import joinWith :: [String] -> String -> String
84+ foreign import joinWith :: [String] -> String -> String
83
85
84−foreign import push :: forall a. [a] -> a -> [a]
86+ foreign import push :: forall a. [a] -> a -> [a]
85
87
86−foreign import reverse :: forall a. [a] -> [a]
88+ foreign import reverse :: forall a. [a] -> [a]
87
89
88−foreign import shift :: forall a. [a] -> [a]
90+ foreign import shift :: forall a. [a] -> [a]
89
91
90−foreign import slice :: forall a. Number -> Number -> [a] -> [a]
92+ foreign import slice :: forall a. Number -> Number -> [a] -> [a]
91
93
92−foreign import sort :: forall a. [a] -> [a]
94+ foreign import sort :: forall a. [a] -> [a]
93
95
94−foreign import splice :: forall a. Number -> Number -> [a] -> [a] -> [a]
96+ foreign import splice :: forall a. Number -> Number -> [a] -> [a] -> [a]
95
97
96−cons :: forall a. a -> [a] -> [a]
98+ cons :: forall a. a -> [a] -> [a]
97−cons = \a -> concat([a])
99+ cons = \a -> concat([a])
98
100
99−concatMap :: forall a b. [a] -> (a -> [b]) -> [b]
101+ concatMap :: forall a b. [a] -> (a -> [b]) -> [b]
100−concatMap as f = {
102+ concatMap as f = {
101− var result = [];
103+ var result = [];
102− foreach (a in as) {
104+ foreach (a in as) {
103− result = result `concat` f a;
105+ result = result `concat` f a;
106+ }
107+ return result;
104 }
108 }
105− return result;
106− }
107
109
108−foreign import filter :: forall a. [a] -> (a -> Boolean) -> [a]
110+ foreign import filter :: forall a. [a] -> (a -> Boolean) -> [a]
109
111
110−empty :: forall a. [a] -> Boolean
112+ empty :: forall a. [a] -> Boolean
111−empty [] = true
113+ empty [] = true
112−empty _ = false
114+ empty _ = false
113
115
114−range :: Number -> Number -> [Number]
116+ range :: Number -> Number -> [Number]
115−range lo hi = {
117+ range lo hi = {
116− var ns = [];
118+ var ns = [];
117− for (n <- lo until hi) {
119+ for (n <- lo until hi) {
118− ns = push ns n;
120+ ns = push ns n;
121+ }
122+ return ns;
119 }
123 }
120− return ns;
124+
121− }
122−
123−zipWith :: forall a b c. (a -> b -> c) -> [a] -> [b] -> [c]
125+ zipWith :: forall a b c. (a -> b -> c) -> [a] -> [b] -> [c]
124−zipWith f (a:as) (b:bs) = cons (f a b) (zipWith f as bs)
126+ zipWith f (a:as) (b:bs) = cons (f a b) (zipWith f as bs)
125−zipWith _ _ _ = []
127+ zipWith _ _ _ = []
126−
128+
127−any :: forall a. (a -> Boolean) -> [a] -> Boolean
129+ any :: forall a. (a -> Boolean) -> [a] -> Boolean
128−any p as = {
130+ any p as = {
129− for (i <- 0 until length as) {
131+ for (i <- 0 until length as) {
130− if (p (as !! i)) {
132+ if (p (as !! i)) {
131− return true;
133+ return true;
134+ }
132 }
135 }
136+ return false;
133 }
137 }
134− return false;
138+
135− }
136−
137−all :: forall a. (a -> Boolean) -> [a] -> Boolean
139+ all :: forall a. (a -> Boolean) -> [a] -> Boolean
138−all p as = {
140+ all p as = {
139− for (i <- 0 until length as) {
141+ for (i <- 0 until length as) {
140− if (!(p (as !! i))) {
142+ if (!(p (as !! i))) {
141− return false;
143+ return false;
144+ }
142 }
145 }
146+ return true;
143 }
147 }
144− return true;
145− }
146
148
147−-- Pairs
149+ -- Pairs
148
150
149−type Tuple a b = { fst :: a, snd :: b }
151+ type Tuple a b = { fst :: a, snd :: b }
150
152
151−curry :: forall a b c. (Tuple a b -> c) -> a -> b -> c
153+ curry :: forall a b c. (Tuple a b -> c) -> a -> b -> c
152−curry f a b = f { fst: a, snd: b }
154+ curry f a b = f { fst: a, snd: b }
153
155
154−uncurry :: forall a b c. (a -> b -> c) -> Tuple a b -> c
156+ uncurry :: forall a b c. (a -> b -> c) -> Tuple a b -> c
155−uncurry f t = f t.fst t.snd
157+ uncurry f t = f t.fst t.snd
156
158
157−tuple :: forall a b. a -> b -> Tuple a b
159+ tuple :: forall a b. a -> b -> Tuple a b
158−tuple = curry id
160+ tuple = curry id
159
161
160−zip :: forall a b. [a] -> [b] -> [Tuple a b]
162+ zip :: forall a b. [a] -> [b] -> [Tuple a b]
161−zip = zipWith tuple
163+ zip = zipWith tuple
162
164
163−unzip :: forall a b. [Tuple a b] -> Tuple [a] [b]
165+ unzip :: forall a b. [Tuple a b] -> Tuple [a] [b]
164−unzip (t:ts) = case unzip ts of
166+ unzip (t:ts) = case unzip ts of
165− { fst = as, snd = bs } -> tuple (cons t.fst as) (cons t.snd bs)
167+ { fst = as, snd = bs } -> tuple (cons t.fst as) (cons t.snd bs)
166−unzip [] = tuple [] []
168+ unzip [] = tuple [] []
167
169
168−-- Strings
170+ -- Strings
169
171
170−foreign import member "length" lengthS :: String -> Number
172+ foreign import member "length" lengthS :: String -> Number
171
173
172−foreign import charAt :: Number -> String -> String
174+ foreign import charAt :: Number -> String -> String
173
175
174−foreign import indexOfS :: String -> String -> Number
176+ foreign import indexOfS :: String -> String -> Number
175
177
176−foreign import lastIndexOfS :: String -> String -> Number
178+ foreign import lastIndexOfS :: String -> String -> Number
177
179
178−foreign import localeCompare :: String -> String -> Number
180+ foreign import localeCompare :: String -> String -> Number
179
181
180−foreign import replace :: String -> String -> String -> String
182+ foreign import replace :: String -> String -> String -> String
181
183
182−foreign import sliceS :: Number -> Number -> String -> String
184+ foreign import sliceS :: Number -> Number -> String -> String
183
185
184−foreign import split :: String -> String -> [String]
186+ foreign import split :: String -> String -> [String]
185
187
186−foreign import substr :: Number -> Number -> String -> String
188+ foreign import substr :: Number -> Number -> String -> String
187
189
188−foreign import substring :: Number -> Number -> String -> String
190+ foreign import substring :: Number -> Number -> String -> String
189
191
190−foreign import toLower :: String -> String
192+ foreign import toLower :: String -> String
191
193
192−foreign import toUpper :: String -> String
194+ foreign import toUpper :: String -> String
193
195
194−foreign import trim :: String -> String
196+ foreign import trim :: String -> String
195
197
196−-- Regex
198+ -- Regex
197
199
198−foreign import data Regex :: *
200+ foreign import data Regex :: *
199
201
200−foreign import regex :: String -> String -> Regex
202+ foreign import regex :: String -> String -> Regex
201
203
202−foreign import test :: Regex -> String -> Boolean
204+ foreign import test :: Regex -> String -> Boolean
203
205
204−foreign import match :: Regex -> String -> [String]
206+ foreign import match :: Regex -> String -> [String]
205
207
206−foreign import replaceR :: Regex -> String -> String -> String
208+ foreign import replaceR :: Regex -> String -> String -> String
207
209
208−foreign import search :: Regex -> String -> Number
210+ foreign import search :: Regex -> String -> Number
209
211
210−-- Globals
212+ -- Globals
211
213
212−foreign import nan :: Number
214+ foreign import nan :: Number
213
215
214−foreign import infinity :: Number
216+ foreign import infinity :: Number
215
217
216−foreign import toExponential :: Number -> String
218+ foreign import toExponential :: Number -> String
217
219
218−foreign import toFixed :: Number -> Number -> String
220+ foreign import toFixed :: Number -> Number -> String
219
221
220−foreign import toPrecision :: Number -> Number -> String
222+ foreign import toPrecision :: Number -> Number -> String
221
223
222−foreign import numberToString :: Number -> String
224+ foreign import numberToString :: Number -> String
223
225
224−foreign import isNaN :: Number -> Boolean
226+ foreign import isNaN :: Number -> Boolean
225
227
226−foreign import isFinite :: Number -> Boolean
228+ foreign import isFinite :: Number -> Boolean
227
229
228−foreign import parseFloat :: String -> Number
230+ foreign import parseFloat :: String -> Number
229
231
230−foreign import parseInt :: String -> Number
232+ foreign import parseInt :: String -> Number
231
233
232−foreign import encodeURIComponent :: String -> String
234+ foreign import encodeURIComponent :: String -> String
233
235
234−foreign import decodeURIComponent :: String -> String
236+ foreign import decodeURIComponent :: String -> String
235
237
236−foreign import encodeURI :: String -> String
238+ foreign import encodeURI :: String -> String
237
239
238−foreign import decodeURI :: String -> String
240+ foreign import decodeURI :: String -> String
239
241
240−-- Math
242+ -- Math
241
243
242−type Math =
244+ type Math =
243− { abs :: Number -> Number
245+ { abs :: Number -> Number
244− , acos :: Number -> Number
246+ , acos :: Number -> Number
245− , asin :: Number -> Number
247+ , asin :: Number -> Number
246− , atan :: Number -> Number
248+ , atan :: Number -> Number
247− , atan2 :: (Number, Number) -> Number
249+ , atan2 :: (Number, Number) -> Number
248− , aceil :: Number -> Number
250+ , aceil :: Number -> Number
249− , cos :: Number -> Number
251+ , cos :: Number -> Number
250− , exp :: Number -> Number
252+ , exp :: Number -> Number
251− , floor :: Number -> Number
253+ , floor :: Number -> Number
252− , log :: Number -> Number
254+ , log :: Number -> Number
253− , max :: (Number, Number) -> Number
255+ , max :: (Number, Number) -> Number
254− , pow :: (Number, Number) -> Number
256+ , pow :: (Number, Number) -> Number
255− , random :: () -> Number
257+ , random :: () -> Number
256− , round :: Number -> Number
258+ , round :: Number -> Number
257− , sin :: Number -> Number
259+ , sin :: Number -> Number
258− , sqrt :: Number -> Number
260+ , sqrt :: Number -> Number
259− , tan :: Number -> Number
261+ , tan :: Number -> Number
260− }
262+ }
261
263
262−foreign import math :: Math
264+ foreign import math :: Math
263
265