summaryrefslogtreecommitdiff
path: root/testsuite/tests/pmcheck/should_compile/pmc006.hs
blob: 7099dea23db8090195fd618c3b1835fa67c85281 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{-# OPTIONS_GHC -fwarn-incomplete-patterns -fwarn-overlapping-patterns #-}

module PMC006 where

len :: [a] -> Int
len xs = case xs of
           []     -> 0
           (_:ys) -> case () of
                       () | (_:_) <- xs -> 1 + len ys

-- -- we would like these to work too but they don't yet
--
-- len :: [a] -> Int
-- len [] = 0
-- len xs = case xs of
--            (_:ys) -> 1 + len ys
--
-- len :: [a] -> Int
-- len xs = case xs of
--            [] -> 0
--            ys -> case ys of
--                    (_:zs) -> 1 + len zs