git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Person example for talk
commit69c028d93b4a5fa3a52ca1b1d8c5c27b845d78f1 authorPhil Freeman <paf31@cantab.net> dateWed 23 Oct 2013, 10:52 (13 years ago) parentca13b3a
2 files changed+8−1
examples/Person.ps+7 src/PureScript/CodeGen/JS.hs+1−1
examples/Person.psnew file+7
@@ -0,0 +1,7 @@
1+data Person = Person { name :: String; age :: Number }
2+
3+extern itoa :: Number -> String
4+
5+showPerson :: Person -> String
6+showPerson = \p -> case p of
7+ Person o -> o.name ++ ", aged " ++ itoa(o.age)
src/PureScript/CodeGen/JS.hs+1−1
@@ -124,7 +124,7 @@ valueToJs = fromMaybe (error "Incomplete pattern") . pattern matchValue
124124 , [ binary Multiply "*" ]
125125 , [ binary Divide "/" ]
126126 , [ binary Modulus "%" ]
127− , [ binary Concat "++" ]
127+ , [ binary Concat "+" ]
128128 , [ binary Add "+" ]
129129 , [ binary Subtract "-" ]
130130 , [ binary ShiftLeft "<<" ]