-
Notifications
You must be signed in to change notification settings - Fork 6
/
t8.idr
38 lines (30 loc) · 763 Bytes
/
t8.idr
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import Js.ASync
export
data ServiceM : Type -> Type where
PureServ : a -> ServiceM a
get_jsio : ServiceM a -> JS_IO (Either String a)
get_jsio (PureServ x) = do
pure $ Right x
export
mytst : String -> ServiceM String
mytst x = PureServ $ "ola "
call_fn : (String -> JS_IO String) -> String -> JS_IO String
call_fn f x = jscall
"%0(%1)"
((JsFn (String -> JS_IO String)) -> String -> JS_IO String)
(MkJsFn f)
x
mytstJs : String -> JS_IO String
mytstJs x = do
r <- get_jsio $ mytst "arst"
case r of
Right k => pure k
tst2 : JS_IO String
tst2 = call_fn mytstJs "inputmytst"
export
main : JS_IO ()
main = do
putStrLn' "start"
r <- tst2
putStrLn' "olare"
putStrLn' r