Version française
Home     About     Download     Resources     Contact us    
Browse thread
Bug report: Caml-Light 0.5
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: murthy@m...
Subject: Bug report: Caml-Light 0.5

It seems to me that there should at least be some sort of error
message, saying that I cannot redefine constructors.

--chet--
------------------------------------------
vougeot:camllight
>       Caml Light version 0.5

#type foo = A of int | B of bool;;
Type foo defined.
#let mkA x = A x
and mkB x = B x;;
mkA : int -> foo = <fun>
mkB : bool -> foo = <fun>
#let A 5 = 5 and B 5 = 5;;
> Toplevel input:
>let A 5 = 5 and B 5 = 5;;
>                ^^^^^^^
> Warning: pattern matching is not exhaustive

> Toplevel input:
>let A 5 = 5 and B 5 = 5;;
>    ^^^^^^^
> Warning: pattern matching is not exhaustive

A : int -> int = <fun>
B : int -> int = <fun>
#A 5;;
- : foo = A 5
#B true;;
- : foo = B true
#B 5;;
> Toplevel input:
>B 5;;
>  ^
> Expression of type int
> cannot be used with type bool
#