[Haskell-beginners] Question re "Pattern match(es) are non-exhaustive"
Frerich Raabe
raabe at froglogic.com
Wed Feb 11 08:24:18 UTC 2015
On 2015-02-10 18:01, Kim-Ee Yeoh wrote:
> On Tue, Feb 10, 2015 at 11:14 PM, Frerich Raabe <raabe at froglogic.com> wrote:
>> I noticed that a similiar case exists with
>>
>> f :: Bool -> Bool
>> f x | x = True
>> | not x = False
[..]
> Now you could point out that "Ah, but look at the definition of not. It
> could inline, simplify, et voila, obtain
>
> f True = True
> f False = False
>
> and hence pattern-matching is complete."
>
> Therein lies the rub. All that inlining and simplification boils down to
> evaluating the program _in_ the compiler, so if your program diverges
> so would the compiler, which wouldn't be a happy thing.
Ah, true. The compiler would need to evaluate the program, I didn't realize
that. But: what do you mean by 'if your program diverges' -- diverges from
what?
--
Frerich Raabe - raabe at froglogic.com
www.froglogic.com - Multi-Platform GUI Testing
More information about the Beginners
mailing list