Version française
Home     About     Download     Resources     Contact us    
Browse thread
Help me find this pdf
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: luc.maranget@i...
Subject: Re: [Caml-list] Re: Help me find this pdf
> 
> You mean that if I write (I use OCaml syntax)
> 
> match p, q with
> | (true, true) -> A
> | _ -> B
> 
> Haskell will first check if (p is evaluated and false) or (q is evaluated and false)
> and then, if it is not the case will evaluate p, and finally if p is true it will evaluate q ?
> 

Haskell has left-to-right semantics for PM. Basically this is expressed
by PM compilation.

"Semantics" of the above code is given by:

match p with
| true -> (match q with true -> A | _ -> goto next enclosing "_")
| _    -> B

Hence if _|_ is a symbol for looping computation, and ?
is a symbol for just anything (in {_|_, true, false}),
we have:

p   q -> result

_|_ ? -> _|_
true _|_ -> _|_
true true -> A
true false -> B
false ? -> B


> 
> 
> -- 
> Christophe Raffalli

In case you are really interested by the issue, may I mention
one of my recent papers on warnings for pattern matching
<http://pauillac.inria.fr/~maranget/papers/warn/index.html>
(See section 4.)

--Luc