[Haskell-cafe] OverloadedLists pattern-matching

Roman Cheplyaka roma at ro-che.info
Sun Apr 13 11:24:38 UTC 2014


* Konstantine Rybnikov <k-bx at k-bx.com> [2014-04-13 12:21:44+0200]
> Just FYI, this still gives a warning:
> ...
>     case m of
>       [] -> putStrLn "empty"
>       (M.toList -> (x:_)) -> putStrLn $ "ok, some random elem is: " ++ show x

Does that surprise you? The compiler doesn't have any special knowledge about
the M.toList function to infer that these two cases are exhaustive.

Roman
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140413/e90c64db/attachment.sig>


More information about the Haskell-Cafe mailing list