[Haskell-cafe] Re: Non-Overlapping Patterns

Michael Karcher usenet at mkarcher.dialup.fu-berlin.de
Mon May 5 11:47:09 EDT 2008


PR Stanley <prstanley at ntlworld.com> wrote:
> after the more specific cases?To put it another way, why doesn't the 
> interpreter identify the more specific cases and put them before the 
> general ones.

Given the function foo below, which of the first lines is more specific?
No reordering means, that it is obvious that (foo 0 1) results in one.

foo :: Int -> Int -> Bool
foo x 1 = 1
foo 0 y = 0
foo x y = 2


Regards,
  Michael Karcher



More information about the Haskell-Cafe mailing list