You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When following the signatures and abstract types section of Chapter 4, the compilation that should fail for lack of concrete type information hiding actually succeeds.
I can confirm my code matches the version from the book repo:
Mysteriously, however, the expected error appears if I manually import Counter in the toplevel:
─( 14:18:23 )─< command 1 >───────────────────────────────────────────────────────────────────────────{ counter: 0 }─
utop # open Counter;;
─( 14:18:24 )─< command 2 >───────────────────────────────────────────────────────────────────────────{ counter: 0 }─
utop # let build_counts () =
In_channel.fold_lines In_channel.stdin ~init:[] ~f:Counter.touch;;
Error: This expression has type t -> string -> t
but an expression was expected of type 'a list -> Base.string -> 'a list
Type t is not compatible with type 'a list
So perhaps jbuilder is being overly smart? I'm running $ jbuilder --version 1.0+beta10.
My opam configuration:
# Global variables from the environment
ocaml-version 4.04.1 # The version of the currently used OCaml compiler
opam-version 1.2.1 # The currently running OPAM version
compiler 4.04.1 # The name of the current OCaml compiler (may be more specific than the version, eg: "4.01.0+fp", or "system")
preinstalled false # Whether the compiler was preinstalled on the system, or installed by OPAM
switch 4.04.1 # The local name (alias) of the current switch
jobs 1 # The number of parallel jobs set up in OPAM configuration
ocaml-native true # Whether the OCaml native compilers are available
ocaml-native-tools true # Whether the native ".opt" version of the OCaml toolchain is available
ocaml-native-dynlink true # Whether native dynlink is available on this installation
arch x86_64 # The current arch, as returned by "uname -m"
Thanks!
Nathan
The text was updated successfully, but these errors were encountered:
Dear Real World OCaml authors,
When following the signatures and abstract types section of Chapter 4, the compilation that should fail for lack of concrete type information hiding actually succeeds.
I can confirm my code matches the version from the book repo:
But instead of the expected error message, I get
Mysteriously, however, the expected error appears if I manually import
Counter
in the toplevel:So perhaps jbuilder is being overly smart? I'm running
$ jbuilder --version 1.0+beta10
.My opam configuration:
Thanks!
Nathan
The text was updated successfully, but these errors were encountered: