git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Update README.md
f46023bPhil Freeman
README.md+12−8
@@ -95,23 +95,27 @@ As an introductory example, here is the usual "Hello World" written in PureScrip
95```haskell
95```haskell
96module Main where
96module Main where
97
97
98−foreign import console :: { log :: String -> {} }
98+import Trace
99
99
100−main = \ -> console.log "Hello, World!"
100+main = trace "Hello, World!"
101```
101```
102
102
103−which compiles to the following Javascript:
103+which compiles to the following Javascript, ignoring the Prelude:
104
104
105```javascript
105```javascript
106−var Main;
106+var Main;
107(function (Main) {
107(function (Main) {
108− function main() {
109− return console.log("Hello, World!");
108+ var main = trace("Hello, World!");
110− };
111− Main.main = main;
109+ Main.main = main;
112})(Main = Main || {});
110})(Main = Main || {});
113```
111```
114
112
113+The following command will compile and execute the PureScript code above:
114+
115+```
116+psc input.purs --run-main | nodejs
117+```
118+
115## Another Example
119## Another Example
116
120
117The following code defines a `Person` data type and a function to generate a string representation for a `Person`:
121The following code defines a `Person` data type and a function to generate a string representation for a `Person`: