shithub: MicroHs

ref: e0142c055d9ce0de9ab1f9fa7af3fadadee7d2fc
dir: /tests/Guard.hs/

View raw version
module Guard(main) where
import Prelude

f :: [Int] -> Int
f [x] | x < 0 = 0 - x
      | x < 10 = x+1
      | otherwise = 99
f [x,y] = x+y
f xs | l < 4 = 0
     | otherwise = l
   where { l = length xs }

main :: IO ()
main = do
  putStrLn $ show [f [0 - 7], f [5], f [20], f [2,3], f [1,2,3], f[1,2,3,4]]