companion_cube changed the topic of #ocaml to: Discussion about the OCaml programming language | http://www.ocaml.org | OCaml 5.0 released(!!1!): https://ocaml.org/releases/5.0.0.html | Try OCaml in your browser: https://try.ocamlpro.com | Public channel logs at https://libera.irclog.whitequark.org/ocaml/
troydm1 has quit [Server closed connection]
troydm has joined #ocaml
<src> I have a folder with a few .ml source files (mainly very tiny learning programs), one of which is called `15_zarith.ml` https://dpaste.com/DBEQ9TM3B I can't compile this because no matter what I do I get a `Error: Unbound module Zarith` even though zarith is installed (I did so via `opam`. `zarith` shows up when doing `opam list`, it's in `~/.opam/default/lib` (zarith folder with .cmxa .cma files etc)...
<src> can anyone give ma hint how to compile this?
waleee has quit [Ping timeout: 246 seconds]
<discocaml> <Kali> are you linking zarith when compiling?
waleee has joined #ocaml
Techcable has quit [Remote host closed the connection]
<src> Oh sorry, you didn't highlight me it seems
<src> (I'm confused... did you mean to respond to me, didn't you?)
<discocaml> <Kali> i did
<discocaml> <Kali> discocaml is the irc-discord bridge
<src> lol alright
<discocaml> <Kali> i'm not sure what's wrong then; im not super familiar with manunal compilation
<src> I tried various stuff with `-I`, `~/.opam/default/lib` also is in my $PATH
<discocaml> <Kali> *manual
<discocaml> <Kali> maybe fix the warning first
<src> it's also my understanding `$ ocamlbuild 15_zarith.native` should work but it also gives the "unbound module Zarith" error
<discocaml> <darrenldl> i think the general recommendation is to use dune or other build system
<discocaml> <darrenldl> for the same reason you dont see many people asking how to javac manually
<src> yes but ever 5 line toy test shouldn't need a build system imo :/
<src> s/ever/every
<discocaml> <darrenldl> if its 5 lines, maybe try utop?
<src> it works in utop if I pull in Zarith via #require
<discocaml> <darrenldl> (though i concede it would be nice to be able to setup a playground very quickly)
<src> but there must be a way to compile this and I want to know so here I am
waleee has quit [Ping timeout: 245 seconds]
<discocaml> <Kali> your problem might just be that you're missing ocamlfind in front
<src> $ ocamlfind ocamlopt -o 15_zarith -linkpkg -package zarith 15_zarith.ml
<src> doesn't work
<src> + ocamlfind could work but obv it should still be compilable via `ocamlopt`
waleee has joined #ocaml
<src> anyways... I'm probably calling it a day here
<src> thanks for trying to help
<discocaml> <Kali> have you tried renaming your file so it's valid? modules can't begin with numbers
<src> I have, the warning goes away the problem persists (as expected)
<discocaml> <Kali> makes sense
<discocaml> <jumpnbrownweasel> maybe use `ocamlfind list` (from the docs) to make sure `zarith` is shown?
<src> it's there
<src> stated originally it's there in `opam list`
<src> it's also there in `ocamlfind list`
bibi_ has quit [Quit: Konversation terminated!]
<discocaml> <jumpnbrownweasel> src: "The module is simply named Z" <https://github.com/ocaml/Zarith>
<discocaml> <jumpnbrownweasel> you're opening Zarith
<discocaml> <jumpnbrownweasel> you can just remove the "open Zarith"
<src> I did
<src> - afk for a while (just fyi)
<discocaml> <jumpnbrownweasel> src: (when you're back) this worked for me:
<discocaml> <jumpnbrownweasel> $ Z.to_int @@ Z.abs @@ Z.of_int (-3)
<discocaml> <jumpnbrownweasel> oops, scratch that
<discocaml> <jumpnbrownweasel> contents of test.ml: let () = Format.printf "%d\n" @@ Z.to_int @@ Z.abs @@ Z.of_int (-3)
<discocaml> <jumpnbrownweasel> compiled with: ocamlfind ocamlopt -o exe -linkpkg -package zarith test.ml
<discocaml> <jumpnbrownweasel> the exe prints 3 when run
<companion_cube> oh my oh my, some drama around the ocaml platform
waleee has quit [Ping timeout: 246 seconds]
jumpnbrownweasel has joined #ocaml
chrisz has quit [Ping timeout: 252 seconds]
chrisz has joined #ocaml
<discocaml> <geoff> mobileink continues to *HATE* dune
<companion_cube> the people who use bazel?
<discocaml> <geoff> I think that he is that guy
humasect has joined #ocaml
bartholin has joined #ocaml
humasect has quit [Ping timeout: 252 seconds]
jsoo has quit [Server closed connection]
jsoo has joined #ocaml
<discocaml> <geoff> > pretty straightforward
<discocaml> <geoff>
<discocaml> <geoff> *130 lines of makefile*
<companion_cube> 😅
<discocaml> <darrenldl> is makefile truly superior if you end up at the same place as dune but takes longer
<discocaml> <darrenldl>
<discocaml> <darrenldl> hmm
<discocaml> <darrenldl> there are only so many ways to spin a wheel
<discocaml> <hockletock> what purpose is served by their being in unpopular languages?
dhil has joined #ocaml
Johann has quit [Ping timeout: 246 seconds]
adrien has joined #ocaml
adrien has quit [Ping timeout: 246 seconds]
chrisz has joined #ocaml
chrisz has quit [Ping timeout: 255 seconds]
jumpnbrownweasel has quit [Ping timeout: 252 seconds]
Johann_ has joined #ocaml
Serpent7776 has joined #ocaml
rgrinberg has joined #ocaml
mro has joined #ocaml
rgrinberg has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
dhil has quit [Ping timeout: 246 seconds]
bacam has quit [Server closed connection]
bacam has joined #ocaml
azimut has joined #ocaml
bartholin has quit [Quit: Leaving]
mro has quit [Quit: Leaving]
ursa-major has quit [Ping timeout: 255 seconds]
Guest97 has joined #ocaml
bibi_ has joined #ocaml
Guest97 has quit [Quit: Client closed]
Hammdist has quit [Quit: Client closed]
Hammdist has joined #ocaml
Hammdist has quit [Quit: Client closed]
mro has joined #ocaml
bibi_ has quit [Ping timeout: 255 seconds]
dnh has joined #ocaml
Hammdist has joined #ocaml
rgrinberg has joined #ocaml
<discocaml> <contextfreebeer> Even though SICP has been translated into many different languages, and it aims to be a book about learning how to think like a programmer rather than how to use a particular language, I would still call it inherently a Lisp book, so the fact that it uses Scheme is certainly not an arbitrary decision
<discocaml> <Kali> thinking forth is nice
<discocaml> <contextfreebeer> really couldn't imagine it using any non-lisp language
rgrinberg has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
rgrinberg has joined #ocaml
<discocaml> <mwzm> ```ocaml
<discocaml> <mwzm> type token_data =
<discocaml> <mwzm> { line : int
<discocaml> <mwzm> ; lexeme : string
<discocaml> <mwzm> }
<discocaml> <mwzm> [@@deriving show]
<discocaml> <mwzm>
<discocaml> <mwzm> exception LoxError of string
<discocaml> <mwzm>
<discocaml> <mwzm> type token =
<discocaml> <mwzm> | LeftParen of token_data
<discocaml> <mwzm> | RightParen of token_data
<discocaml> <mwzm> | LeftBrace of token_data
<discocaml> <mwzm> | RightBrace of token_data
<discocaml> <mwzm> | Comma of token_data
<discocaml> <mwzm> .
<discocaml> <mwzm> .
<discocaml> <mwzm> .
<discocaml> <mwzm> | Eof of token_data
<discocaml> <mwzm> [@@deriving show]
<discocaml> <mwzm>
<discocaml> <mwzm> type token_list = token list [@@deriving show]
<discocaml> <mwzm>
<discocaml> <mwzm> type scanner =
<discocaml> <mwzm> { tokens : token_list
<discocaml> <mwzm> ; line : int
<discocaml> <mwzm> ; current : int
<discocaml> <mwzm> ; ch : char
<discocaml> <mwzm> ; str : string
<discocaml> <mwzm> }
<discocaml> <mwzm> [@@deriving show]
<discocaml> <mwzm> ```ocaml
<discocaml> <mwzm> type token_data =
<discocaml> <mwzm> { line : int
<discocaml> <mwzm> ; lexeme : string
<discocaml> <mwzm> }
<discocaml> <mwzm> [@@deriving show]
<discocaml> <mwzm>
<discocaml> <mwzm> type token =
<discocaml> <mwzm> | LeftParen of token_data
<discocaml> <mwzm> | RightParen of token_data
<discocaml> <mwzm> | LeftBrace of token_data
<discocaml> <mwzm> | RightBrace of token_data
<discocaml> <mwzm> | Comma of token_data
<discocaml> <mwzm> .
<discocaml> <mwzm> .
<discocaml> <mwzm> .
<discocaml> <mwzm> | Eof of token_data
<discocaml> <mwzm> [@@deriving show]
<discocaml> <mwzm>
<discocaml> <mwzm> type token_list = token list [@@deriving show]
<discocaml> <mwzm>
<discocaml> <mwzm> type scanner =
<discocaml> <mwzm> { tokens : token_list
<discocaml> <mwzm> ; line : int
<discocaml> <mwzm> ; current : int
<discocaml> <mwzm> ; ch : char
<discocaml> <mwzm> ; str : string
<discocaml> <mwzm> }
<discocaml> <mwzm> [@@deriving show]
<discocaml> <mwzm> ```
<discocaml> <octachron> ppx are syntactic, so you can replace the show_token in scope at the definition of token_list.
rgrinberg has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<discocaml> <mwzm> do you mind writing a quick example of how that might go?
<discocaml> <sim642> The second code block in this section shows: https://github.com/ocaml-ppx/ppx_deriving#plugin-show
<discocaml> <mwzm> thanks!
chrisz has quit [Ping timeout: 246 seconds]
chrisz has joined #ocaml
bibi_ has joined #ocaml
waleee has joined #ocaml
chrisz has quit [Ping timeout: 252 seconds]
chrisz has joined #ocaml
waleee has quit [Ping timeout: 246 seconds]
waleee has joined #ocaml
waleee has quit [Remote host closed the connection]
waleee has joined #ocaml
johnel has quit [Server closed connection]
johnel has joined #ocaml
rgrinberg has joined #ocaml
<discocaml> <JM> So weird that they are convinced we will all jump to Bazel once they've stabilise their solution...
<discocaml> <JM> I mean, I do Java for a living, Bazel is written in Java and has top Java support and I wouldn't touch it with barge-pole.
<discocaml> <JM> I don't personally know anybody using Bazel for their builds.
waleee has quit [Ping timeout: 245 seconds]
waleee has joined #ocaml
MarvelousWololo has joined #ocaml
Hammdist has quit [Quit: Client closed]
rgrinberg has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
waleee has quit [Ping timeout: 240 seconds]
<companion_cube> if anything, something like buck2 (I think?) in rust is more appealing to me
jumpnbrownweasel has joined #ocaml
ec has quit [Ping timeout: 246 seconds]
<discocaml> <bluddy5> I think we'll just stick with what works.
<companion_cube> apparently dune is not usable, heh
<companion_cube> damn does Bunzli get on my nerves sometimes
rgrinberg has joined #ocaml
MarvelousWololo has quit [Quit: MarvelousWololo]
ec has joined #ocaml
mro has quit [Ping timeout: 246 seconds]
myrkraverk_ has quit [Quit: Leaving]
<discocaml> <jumpnbrownweasel> if Dune's doc was better the issue may be lessened
<discocaml> <jumpnbrownweasel> i find it difficult to figure out all the things Dune is capable of doing by reading the docs
masterbuilder has quit [Quit: Lost terminal]
masterbuilder has joined #ocaml
rgrinberg has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<companion_cube> yeah I agree, the docs are the weakest point
<discocaml> <regularspatula> maybe it would be better to call "the ocaml platform" something else? haskell had a "haskell platform" too then it got deprecated in favor of something else, which is confusing
<companion_cube> just suggested "the dune platform"
<discocaml> <regularspatula> yeah that would make more sense to me
<discocaml> <regularspatula> its dune-centric workflow to build ocaml programs after all right?
<discocaml> <geoff> They always say cross-language is a big problem, but I haven't had much trouble with running cmake from dune and using the outputs
<companion_cube> maybe it's ex-googlers and they just want their fancy big build system, idk
<discocaml> <jumpnbrownweasel> what about combining Rust and OCaml?
<discocaml> <jumpnbrownweasel> would you do this?: <https://github.com/zshipko/ocaml-rust-starter/blob/main/src/dune>
masterbuilder has quit [Quit: leaving]
<companion_cube> yeah more or less… I only have one project doing this tho
masterbuilder has joined #ocaml
xmachina has quit [Quit: WeeChat 4.0.4]
pie_ has quit [Server closed connection]
pie_ has joined #ocaml
rgrinberg has joined #ocaml
<discocaml> <geoff> Maybe should replace the sh with direct run / dunes copy etc
<discocaml> <jumpnbrownweasel> ok, i may try that
<discocaml> <regularspatula> i do something similar with javascript tools + ocaml
<discocaml> <regularspatula> @jumpnbrownweasel are you currently using rust+ocaml?
Hammdist has joined #ocaml
<discocaml> <jumpnbrownweasel> i'm just starting something, nothing yet
<discocaml> <regularspatula> i see. it seems like it could be a nice pairing
daimrod1 has quit [Server closed connection]
daimrod1 has joined #ocaml
<discocaml> <geoff> Going the other way, what is it that makes dune so bad as a sub project in a project that using another build system?
<discocaml> <bluddy5> The dune devs have been extremely receptive to almost any request from the community. If there's demand for this feature, they will very likely put it on their roadmap.
<discocaml> <bluddy5> Which means that the people complaining are generally searching for a reason to complain.
dhil has joined #ocaml
xmachina has joined #ocaml
<discocaml> <regularspatula> Did something like this: https://github.com/ocaml/dune/issues/1046#issuecomment-408855571, ever make it into dune? (basically looks like `(using myconf 1.0)` or something similar to be able to set flags and other such things across your projects)
m5zs7k has joined #ocaml
myrkraverk has joined #ocaml
Serpent7776 has quit [Quit: leaving]
xmachina has quit [Quit: WeeChat 4.0.4]
yziquel has joined #ocaml
Hammdist has quit [Quit: Client closed]
xmachina has joined #ocaml
Hammdist has joined #ocaml
rgrinberg has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
bibi_ has quit [Ping timeout: 258 seconds]
yziquel has quit [Quit: Client closed]
xmachina has quit [Quit: WeeChat 4.0.4]
xmachina has joined #ocaml
ansiwen has quit [Quit: ZNC 1.7.1 - https://znc.in]
ansiwen has joined #ocaml
Tuplanolla has joined #ocaml
<discocaml> <gar6872> @geoff Please don't spread that kind of nonsense. I do not and never have hated Dune.
bibi_ has joined #ocaml
<discocaml> <geoff> sorry, it just seems that every time you mention it, it is to say that it is not good
<src> jumpnbrownweasel: ty I got it working
<src> your command worked, had an error message due to using OCaml 5.0.0 but installed 4.14.1 as well and there it works (after having installed ocamlfind and Zarith etc)
<discocaml> <geoff> obazl: also, the phrasing is meant to read like those silly clickbait blogs/ads
<discocaml> <geoff> > Doctors *HATE* this one weird trick
<discocaml> <geoff> Not meant to be some kind of slander against you
TrillionEuroNote has joined #ocaml
<discocaml> <gar6872> Haha, "World reacts to ..." is another one.
dnh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bartholin has joined #ocaml
<discocaml> <jumpnbrownweasel> src: I used ocaml 5.0.0 for those commands. I did `opam update` and then installed `zarith`, so maybe I got a more recent zarith than you did.
Hammdist has quit [Quit: Client closed]
yziquel has joined #ocaml
yziquel has quit [Quit: Client closed]
yziquel has joined #ocaml
lilata has quit [Quit: Ping timeout (120 seconds)]
lilata has joined #ocaml
slothby has quit [Ping timeout: 255 seconds]
<discocaml> <cemerick> citing Clojure history as a counterpoint to the platform's existence is *hilarious*
<discocaml> <cemerick> or, "The Platform", I should say
<discocaml> <rikamg> Kismet indeed! I actually got into that thread again becuase I was lurking this room (I gotta change my forum username if possible)
<discocaml> <cemerick> > I don't personally know anybody using Bazel for their builds.
<discocaml> <cemerick> > d
<discocaml> <cemerick> I'm only aware of bazel usage in very large orgs, with all the attendant griping
waleee has joined #ocaml
<discocaml> <rikamg> Kismet indeed! I actually got into that thread again because I was lurking this room (I gotta change my forum username if possible)
rgrinberg has joined #ocaml
dhil has quit [Ping timeout: 246 seconds]
xmachina has quit [Quit: WeeChat 4.0.4]
xmachina has joined #ocaml
rgrinberg has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
slothby has joined #ocaml
rgrinberg has joined #ocaml
myrkraverk has quit [Read error: Connection reset by peer]
myrkraverk has joined #ocaml
random-jellyfish has joined #ocaml
dh` has quit [Ping timeout: 255 seconds]
dh2` has joined #ocaml
wingsorc has joined #ocaml
yziquel has quit [Ping timeout: 245 seconds]
dnh has joined #ocaml
bartholin has quit [Quit: Leaving]
Tuplanolla has quit [Ping timeout: 255 seconds]
nore has quit [Server closed connection]
nore has joined #ocaml
wingsorc has quit [Remote host closed the connection]
dnh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dnh has joined #ocaml
wingsorc has joined #ocaml
rgrinberg has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
random-jellyfish has quit [Quit: Client closed]
oriba has joined #ocaml