git.iko.soy/rowtype-yoga/purescript-native
on e65645e help sign in
19 lines 387 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 = 0.0
17fn 1.0 = 2.0
19main = Debug.Trace.trace (show $ testError $ \_ -> fn 2.0)