[Haskell-cafe] Re: Debugging partial functions by the rules
Jacques Carette
carette at mcmaster.ca
Wed Nov 15 13:08:55 EST 2006
Robert Dockins wrote:
> Or how about.... ??
>
> lookupVarible target env =
> case [ v | (n,v) <- env, n==target ] of
> (x:_) -> x
> _ -> assert False $ "BUG: Unexpected variable out of scope
> "++(show target)++" in environment "++(show env)
>
Other have pointed out that, in the CURRENT Haskell semantics, the above
is quite difficult to reason about.
Note that the whole point of Wolfram Kahl's Pattern Matching Calculus is
to restore equational reasoning to pattern-matches.
http://www.cas.mcmaster.ca/~kahl/PMC/
Jacques
More information about the Haskell-Cafe
mailing list