shithub: MicroHs

ref: 5bcc30b7813a7bd15717f44d57cfb0dcbab3c87e
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]]