git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Merge pull request #623 from dylex/master
c1fc649Phil Freeman
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