Browse thread
[Caml-list] Matching when
-
Nicolas Cannasse
- Pierre Weis
- John Max Skaller
- Remi VANICAT
- Oleg
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | John Max Skaller <skaller@o...> |
| Subject: | Re: [Caml-list] Matching when |
Nicolas Cannasse wrote:
>Hi !
>
>I was thinking that the following should be possible :
>
>match e with
>| Any
>| Int x when x > 0 ->
> .... (* here we don't use x *)
>| ....
>
>But the typechecker reject it because of the unbound 'x' in the "Any"
>matching.
>
Hmm. to rewrite it so it works:
| Int _ when (match e with Int x -> x > 0 | _ -> assert false) -> ...
:-)
--
John Max Skaller, mailto:skaller@ozemail.com.au
snail:10/1 Toxteth Rd, Glebe, NSW 2037, Australia.
voice:61-2-9660-0850
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners