dbuenzli / fmt

OCaml Format pretty-printer combinators
http://erratique.ch/software/fmt
ISC License
71 stars 26 forks source link

Question on howto use "fmt" #37

Closed eiselekd closed 5 years ago

eiselekd commented 5 years ago

(I'm a ocaml newbie) I try to test the "fmt" module and ran into a problem. While "pam install fmt" seems to succeed, I cannot load it open Fmt;; : Error: Unbound module Fmt. I tried to run the test/test.ml example but I dont really know howto compile it.

$ocamlc test.ml 
File "test.ml", line 23, characters 34-48:
Error: Unbound module Fmt
dbuenzli commented 5 years ago

Please ask these questions on https://discuss.ocaml.org/ where people are willing to help newcomers. Also formulate them with a little bit more details about the context.

Presumably you are trying to do this from the ocaml (or utop) toplevel. This should do:

#use "topfind"
#require "fmt"
eiselekd commented 5 years ago

In the REPL I can use #require "fmt" however when using ocamlc the modules is not found.

dbuenzli commented 5 years ago

Try something like ocamlfind ocamlc -package fmt yourfile.ml but please continue that discussion on discuss.ocaml.org.

eiselekd commented 5 years ago

ok thanks

eiselekd commented 5 years ago

Sorry, just one more comment. I now tried "pkg/pkg.ml build" and copied the _build/src/* to ".opam/default/lib/fmt/" and then I can run "open Fmt;;". Seems to be some incompatibility of the opam binary files of fmt....

dbuenzli commented 5 years ago

Don't do these things... and also what you inferred doesn't make any sense.

dbuenzli commented 5 years ago

Here's a small tutorial to compile things by hand and use libraries. But please these questions are OT for this issue tracker, ask these questions on discuss.ocaml.org where it might benefit other newcomers aswell.