Commit 0004215f authored by Camil Staps's avatar Camil Staps 🍃

Add toJSArgs for [a] | gToJS{|*|} a

parent 6227658d
......@@ -134,7 +134,7 @@ instance .# Int // array access
* - `()` relates to no arguments; tuples relates to lists of arguments
*/
class toJSArgs a :: !a -> {!JSVal}
instance toJSArgs Int, Bool, String, JSVal, (Maybe b) | gToJS{|*|} b, ()
instance toJSArgs Int, Bool, String, JSVal, [a] | gToJS{|*|} a, (Maybe a) | gToJS{|*|} a, ()
instance toJSArgs (a,b) | gToJS{|*|} a & gToJS{|*|} b
instance toJSArgs (a,b,c) | gToJS{|*|} a & gToJS{|*|} b & gToJS{|*|} c
instance toJSArgs (a,b,c,d) | gToJS{|*|} a & gToJS{|*|} b & gToJS{|*|} c & gToJS{|*|} d
......
......@@ -475,7 +475,10 @@ instance toJSArgs Int where toJSArgs i = {toJS i}
instance toJSArgs Bool where toJSArgs b = {toJS b}
instance toJSArgs String where toJSArgs s = {toJS s}
instance toJSArgs JSVal where toJSArgs v = {v}
instance toJSArgs (Maybe b) | gToJS{|*|} b
instance toJSArgs [a] | gToJS{|*|} a
where
toJSArgs v = {JSArray {toJS x \\ x <- v}}
instance toJSArgs (Maybe a) | gToJS{|*|} a
where
toJSArgs v = case v of
Just v -> {toJS v}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment