
16 Jun
2014
16 Jun
'14
11:19 a.m.
Hello, I've bumped into strange GHC behaviour with OverloadedLists and pattern matching. Consider this example: {-# LANGUAGE OverloadedLists #-} len :: [a] -> Int len [] = 0 len (_:t) = 1 + len t If I load this with "ghci -Wall", I get a warning: Test.hs:4:1: Warning: Pattern match(es) are non-exhaustive In an equation for ‘len’: Patterns not matched: [] If I disable OverloadedLists extension, warning goes away. Can someone clear this behaviour out for me? It looks like a bug, but I'm not sure. Thanks for help, Nikolay.