
On Wed, Feb 22, 2006 at 01:14:41PM +0100, Christian Maeder wrote:
John Meacham wrote:
f x = ... y ... where Just y = Map.lookup x theMap
now if the lookup fails you automatically get an error message pointing to the exact line number of the failure. or if the failure message of the routine is more important than the source location you can do
f x = ... y ... where Identity y = Map.lookup x theMap
These are potential runtime errors, that may be not so obvious to see in the source (ie. for user defined types) and even the compiler (ghc) does not emit a warning.
Indeed, that is the entire point of the construct. ghc definitly should not emit a warning in this case as it is what lazy pattern matching is for. John -- John Meacham - ⑆repetae.net⑆john⑈