mlsub icon indicating copy to clipboard operation
mlsub copied to clipboard

"location.ml", line 47 - This expression has type bytes but an expression was expected of type string

Open AaronNGray opened this issue 4 years ago • 3 comments

$ make
ocamlbuild -no-hygiene -r -cflag -bin-annot -cflag -g -lflag -g -pkg menhirLib -pkg str -use-menhir -yaccflag --explain -yaccflag --table main.byte
+ ocamlc.opt -c -bin-annot -g -I /home/aaron/.opam/default/lib/menhirLib -I /usr/lib/ocaml -o location.cmo location.ml
File "location.ml", line 47, characters 15-38:
47 |   source fname (slurp (open_in fname))
                    ^^^^^^^^^^^^^^^^^^^^^^^
Error: This expression has type bytes but an expression was expected of type
         string
Command exited with code 2.
Compilation unsuccessful after building 8 targets (7 cached) in 00:00:00.
make: *** [Makefile:3: all] Error 10

AaronNGray avatar Jul 18 '20 20:07 AaronNGray

I tried an open Bytes and a

    source fname (to_string (slurp (open_in fname)))

but that has knock on effects.

File "location.ml", line 131, characters 26-76:
131 | module LocSet = Set.Make (struct type t = location let compare = compare end)
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Signature mismatch:
       Modules do not match:
         sig type t = location val compare : Bytes.t -> Bytes.t -> int end
       is not included in
         Set.OrderedType
       Values do not match:
         val compare : Bytes.t -> Bytes.t -> int
       is not included in
         val compare : t -> t -> int
       File "set.mli", line 52, characters 4-31: Expected declaration
       File "location.ml", line 131, characters 55-62: Actual declaration
Command exited with code 2.
Compilation unsuccessful after building 8 targets (6 cached) in 00:00:00.
make: *** [Makefile:3: all] Error 10

AaronNGray avatar Jul 18 '20 20:07 AaronNGray

Solved :-

source fname (Bytes.to_string (slurp (open_in fname)))

Looks like there's more different issues though.

AaronNGray avatar Jul 18 '20 20:07 AaronNGray

This issue still stands.

AaronNGray avatar Jan 21 '22 00:01 AaronNGray