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