git.iko.soy/rowtype-yoga/purescript-native
on 132a430 help sign in
16 lines 434 B history raw
1module Main where
3import Prelude
4import Control.Monad.Eff
5import Test.Assert
7data List a = Cons a (List a) | Nil
9match2 :: List Number -> Number
10match2 (Cons x (Cons y xs)) = x * y + match2 xs
11match2 _ = 0.0
13main = do
14 let result = 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)))))))))
15 assert' "Incorrect result!" (result == 100.0)
16 Control.Monad.Eff.Console.log "Done"