git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Merge branch 'master' of github.com:paf31/purescript
396b86ePhil Freeman
docs/source/ffi.rst+5−5
@@ -14,11 +14,11 @@ Inline Javascript
14A foreign import declaration may optionally contain its definition in Javascript as a string literal. If this is provided, the string will be inserted directly into the generated Javascript before the current module definition::
14A foreign import declaration may optionally contain its definition in Javascript as a string literal. If this is provided, the string will be inserted directly into the generated Javascript before the current module definition::
15
15
16 foreign import pow
16 foreign import pow
17− "function pow(n) {\
17+ """function pow(n) {
18− \ return function(p) {\
18+ return function(p) {
19− \ return Math.pow(n, p);\
19+ return Math.pow(n, p);
20− \ };\
20+ };
21− \}" :: Number -> Number -> Number
21+ }""" :: Number -> Number -> Number
22
22
23Importing Types
23Importing Types
24---------------
24---------------
docs/source/types.rst+3−3
@@ -38,21 +38,21 @@ Tagged unions can only be created using their constructors, and deconstructed th
38
38
39For example::
39For example::
40
40
41− data Foo a = Foo | Bar String
41+ data Foo = Foo | Bar String
42
42
43 runFoo Foo = "It's a Foo"
43 runFoo Foo = "It's a Foo"
44 runFoo (Bar s) = "It's a Bar. The string is " ++ s
44 runFoo (Bar s) = "It's a Bar. The string is " ++ s
45
45
46 test = runFoo Foo ++ runFoo (Bar "Test")
46 test = runFoo Foo ++ runFoo (Bar "Test")
47
47
48−In the example, Foo is a tagged union type which has two constructors. It's first constructor ``Foo`` takes no argument, and it's second ``Bar`` takes one, which must be a String.
48+In the example, Foo is a tagged union type which has two constructors. Its first constructor ``Foo`` takes no arguments, and its second ``Bar`` takes one, which must be a String.
49
49
50``runFoo`` is an example of pattern matching on a tagged union type to discover its constructor, and the last line shows how to construct values of type ``Foo``.
50``runFoo`` is an example of pattern matching on a tagged union type to discover its constructor, and the last line shows how to construct values of type ``Foo``.
51
51
52Newtypes
52Newtypes
53--------
53--------
54
54
55−Newtypes are like data types introduced with the ``data`` keyword, but are restricted to a single contructor which contains a single arguments. Newtypes are introduced with the ``newtype`` keyword::
55+Newtypes are like data types introduced with the ``data`` keyword, but are restricted to a single contructor which contains a single argument. Newtypes are introduced with the ``newtype`` keyword::
56
56
57 newtype Percentage = Percentage Number
57 newtype Percentage = Percentage Number
58
58