git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Update README.md
aefa1b9Phil Freeman
README.md+12−18
@@ -77,6 +77,8 @@ PureScript can also be seen as a trade-off between a theoretically ideal languag
77As an introductory example, here is the usual "Hello World" written in PureScript:
77As an introductory example, here is the usual "Hello World" written in PureScript:
78
78
79```haskell
79```haskell
80+module Main where
81+
80foreign import console :: { log :: String -> {} }
82foreign import console :: { log :: String -> {} }
81
83
82main = \ -> console.log "Hello, World!"
84main = \ -> console.log "Hello, World!"
@@ -85,9 +87,13 @@ main = \ -> console.log "Hello, World!"
85which compiles to the following Javascript:
87which compiles to the following Javascript:
86
88
87```javascript
89```javascript
90+var Main;
91+(function (Main) {
88−function main() {
92+ function main() {
89− console.log("Hello, World!");
93+ return console.log("Hello, World!");
90−}
94+ };
95+ Main.main = main;
96+})(Main = Main || {});
91```
97```
92
98
93## Another Example
99## Another Example
@@ -734,26 +740,14 @@ infixr 7 %%
734
740
735## Modules
741## Modules
736
742
737−Simple modules are supported by the `module` keyword.
743+Modules are introduced using the `module` keyword. All code must be placed in a module.
738
744
739−Introduce a module as follows, with a list of indented declarations:
745+Introduce a module as follows, with a list of declarations:
740
746
741```haskell
747```haskell
742module A where
748module A where
743
749
744− foo = \x -> x
750+id x = x
745−```
746−
747−Modules may be nested:
748−
749−```haskell
750−module A where
751−
752− foo = \x -> x
753−
754− module B where
755−
756− bar = \y -> y
757```
751```
758
752
759Names may be qualified by using a dot:
753Names may be qualified by using a dot: