git.iko.soy/rowtype-yoga/purescript-native
on e65645e help sign in
20 lines 485 B history raw
1module Main where
3import Control.Monad.Eff
5data List a = Cons a (List a) | Nil
7match2 :: List Number -> Number
8match2 (Cons x (Cons y xs)) = x * y + match2 xs
9match2 _ = 0.0
11foreign import explode
12 """
13 function explode() {
14 throw new Error('Incorrect result');
15 }
16 """ :: forall eff a. Eff eff a
18main = case match2 (Cons 1.0 (Cons 2.0 (Cons 3.0 (Cons 4.0 (Cons 5.0 (Cons 6.0 (Cons 7.0 (Cons 8.0 (Cons 9.0 Nil))))))))) of
19 100.0 -> Debug.Trace.trace "Done"
20 _ -> explode