git.iko.soy/rowtype-yoga/purescript-native
on 33db511 help sign in
17 lines 381 B history raw
1module Main where
3foreign import testError
4 "function testError(f) {\
5 \ try {\
6 \ return f();\
7 \ } catch (e) {\
8 \ if (e instanceof Error) return 'success';\
9 \ throw new Error('Pattern match failure is not Error');\
10 \ }\
11 \}" :: (Unit -> Number) -> String
13fn :: Number -> Number
14fn 0 = 0
15fn 1 = 2
17main = Debug.Trace.trace (show $ testError $ \_ -> fn 2)