change syntax for javascript code literals
This commit is contained in:
@@ -6,12 +6,12 @@ ptype String
|
||||
infixl 4 _+_
|
||||
infixl 5 _*_
|
||||
|
||||
pfunc _+_ : Int -> Int -> Int := "(x,y) => x + y"
|
||||
pfunc _*_ : Int -> Int -> Int := "(x,y) => x * y"
|
||||
pfunc _+_ : Int -> Int -> Int := `(x,y) => x + y`
|
||||
pfunc _*_ : Int -> Int -> Int := `(x,y) => x * y`
|
||||
|
||||
ptype JVoid
|
||||
|
||||
-- REVIEW - maybe we only have body, use names from the pi-type and generate
|
||||
-- the arrow (or inline?) ourselves
|
||||
pfunc log : String -> JVoid := "x => console.log(x)"
|
||||
pfunc debug : {a : U} -> String -> a -> JVoid := "(_,x,a) => console.log(x,a)"
|
||||
pfunc log : String -> JVoid := `x => console.log(x)`
|
||||
pfunc debug : {a : U} -> String -> a -> JVoid := `(_,x,a) => console.log(x,a)`
|
||||
|
||||
@@ -231,13 +231,13 @@ pfunc listToArray : {a : U} -> List a -> Array a := "
|
||||
return rval
|
||||
}
|
||||
"
|
||||
pfunc alen : {a : U} -> Array a -> Int := "(a,arr) => arr.length"
|
||||
pfunc aget : {a : U} -> Array a -> Int -> a := "(a, arr, ix) => arr[ix]"
|
||||
pfunc aempty : {a : U} -> Unit -> Array a := "() => []"
|
||||
pfunc alen : {a : U} -> Array a -> Int := `(a,arr) => arr.length`
|
||||
pfunc aget : {a : U} -> Array a -> Int -> a := `(a, arr, ix) => arr[ix]`
|
||||
pfunc aempty : {a : U} -> Unit -> Array a := `() => []`
|
||||
|
||||
|
||||
pfunc fastConcat : List String → String := "(xs) => listToArray(undefined, xs).join('')"
|
||||
pfunc replicate : Nat -> Char → String := "() => abort('FIXME replicate')"
|
||||
pfunc fastConcat : List String → String := `(xs) => listToArray(undefined, xs).join('')`
|
||||
pfunc replicate : Nat -> Char → String := `() => abort('FIXME replicate')`
|
||||
|
||||
|
||||
|
||||
@@ -261,4 +261,4 @@ iopure a = \ w => MkIORes a w
|
||||
IOMonad : Monad IO
|
||||
IOMonad = MkMonad iobind iopure
|
||||
|
||||
pfunc putStrLn : String -> IO Unit := "(s) => (w) => console.log(s)"
|
||||
pfunc putStrLn : String -> IO Unit := `(s) => (w) => console.log(s)`
|
||||
|
||||
@@ -11,5 +11,5 @@ ptype Int
|
||||
ptype Array : U -> U
|
||||
|
||||
-- declare a primitive function
|
||||
pfunc alength : {a : U} -> Array a -> Int := "(x) => x.length"
|
||||
pfunc alength : {a : U} -> Array a -> Int := `(x) => x.length`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user