adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml 4.07.1 release notes: https://caml.inria.fr/pub/distrib/ocaml-4.07/notes/Changes | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml | Due to ongoing spam, you must register your nickname to talk on the channel
assemblyman has joined #ocaml
romildo has joined #ocaml
<romildo> I have a small ocaml application that I build with ocamlbuild. I want to migrate to dune in order to try it.
<romildo> I want to use the release profile. In which file should it be specified?
<romildo> I tried putting it in src/dune, alongside the source code, but it does not work.
<romildo> (profile release)
<romildo> $ dune build src/driver.exe
<romildo> File "src/dune", line 4, characters 3-10:
<romildo> Error: Unknown field profile
<romildo> 4 | (profile release)
<romildo> ^^^^^^^
<romildo> Any clues?
AnAverageHuman has quit [Ping timeout: 256 seconds]
ziyourenxiang has joined #ocaml
caltelt_ has quit [Ping timeout: 245 seconds]
pierpal has joined #ocaml
pierpal has quit [Ping timeout: 250 seconds]
<leah2> /go tran
pierpal has joined #ocaml
assemblyman has quit [Quit: ™]
AtumT_ has quit [Quit: AtumT_]
webshinra has quit [Ping timeout: 259 seconds]
<companion_cube> romildo: it's specified on the command line
<companion_cube> dune build --profile=release
<romildo> companion_cube, can it be specified only in the command line? I would like to have it in the dune configuration file.
<companion_cube> the configuration always allows both
wilfredh has quit [Quit: Connection closed for inactivity]
mfp has quit [Ping timeout: 255 seconds]
romildo has quit [Ping timeout: 252 seconds]
silver has quit [Read error: Connection reset by peer]
caltelt_ has joined #ocaml
romildo has joined #ocaml
AnAverageHuman has joined #ocaml
romildo has quit [Quit: Leaving]
kvda has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
gravicappa has joined #ocaml
tormen_ has joined #ocaml
tormen has quit [Ping timeout: 244 seconds]
AnAverageHuman has quit [Ping timeout: 256 seconds]
amiloradovsky has quit [Read error: Connection reset by peer]
amiloradovsky has joined #ocaml
<Khady> it's possible to add an env stanza with a wildcard to set the flags for all profiles. This is like using release all the time
kvda has joined #ocaml
caltelt_ has quit [Ping timeout: 268 seconds]
kvda has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
kvda has joined #ocaml
pierpal has quit [Quit: Poof]
pierpal has joined #ocaml
troydm has quit [Ping timeout: 250 seconds]
Birdface has joined #ocaml
Birdface has quit [Remote host closed the connection]
gravicappa has quit [Remote host closed the connection]
Birdface has joined #ocaml
webshinra has joined #ocaml
kvda has quit [Ping timeout: 244 seconds]
raduom has quit [Read error: Connection reset by peer]
<xvilka> hi
<xvilka> are there any ready libraries with Applicative, Monad Transformers, etc?
gareppa has joined #ocaml
gareppa has quit [Remote host closed the connection]
barockobamo has joined #ocaml
<xvilka> I see there is Base.Monad, but it is very basic
elts has quit [Quit: .]
<madroach> Are (!) and (:=) on 'a ref atomic operations? I can't find anything about atomicity of operations in OCaml. All I could find is the gcc documentation saying reads and updates of int or pointers are atomic. Since OCaml values are pointers (or long / long long ?!?) they should be atomic, too?
<Enjolras> madroach: are you talking about mutlicore prototype ?
<madroach> no, OCaml 4.07
<Enjolras> ocaml has a runtime lock, with preemption on some syscall or allocation points. Which means any section of code that does not allocate nor call into C is a critical section
<Enjolras> so := and ! are atomic. But... It does not mean that foo := <some expr> is atomic
<Enjolras> evaluation of expr might allocate, trigger preemption, but then the store is definitely atomic
<Enjolras> multicore prototype is another story
<madroach> So OCaml will not yield during pure OCaml code?
<Enjolras> no
<Enjolras> as long as you don't allocate at least
<madroach> ok. May I ask whether multicore differs in atomicity of value set/get operations.
<Enjolras> i do not know the details of multicore
<madroach> so every (implicit) allocation is a possible yield point?
<Enjolras> yes
<Enjolras> also, i *assume* that the use of mutex as global lock ensures a sequentially consitent memory order, but i didn't think about this before so i'm not sure
<madroach> Thank you. All I was worried about is that I won't read partially written long or pointer.
<Enjolras> madroach: non allocating long running sections of ocaml code are not very common, but they do happen from time to time
Guest1684 has joined #ocaml
freyr69 has joined #ocaml
<freyr69> Is there any other way to define infinite lazy lists in OCaml but ugly `let rec stream () = ... in stream ()`?
<freyr69> recursive*
<Enjolras> freyr69: you mean like type 'a stream = Stream of 'a * (unit -> 'a stream) ?
<Enjolras> hm
<freyr69> yeah, like in haskell: `ones = 1 : ones`
<Enjolras> i guess you can use also lazy.t instead of unit -> for memoization purpose
<Enjolras> that being said the stdlib recently got Seq module which are essentially lazy list
<freyr69> Yes, but you can't refer to the lhs value if it is not a recursive function
<octachron> freyr69, "let rec ones = 1 :: ones" "works" in this case.
<freyr69> So I have to define with let rec and use Lazy.from_fun
<freyr69> Wow
<freyr69> val ones : int list = [1; <cycle>]
<freyr69> is this some special case?
<octachron> No?
<freyr69> And why does it prohibits such cycles with my own constructors?
<octachron> it wreaks havoc with most list functions that are not expecting an infinite lists
<freyr69> I see
<Enjolras> freyr69: it doesn't afaik
<octachron> Recursive value definitions have quite stringent rules, you are probably breaking one of them
<Enjolras> i think the best doc about it is PR description of Leo's PR to rewrite the check
<freyr69> octachron: ok, so I can't write
<freyr69> `let rec ones = Cons (1, Lazy.from_val ones)`
<Enjolras> (to be honnest, i never thought about using infinite lists with actual list type :) )
<freyr69> only `let rec ones = Cons (1, ones)`
<freyr69> or `let rec ones () = Cons (1, Lazy.from_fun ones)`?
<octachron> Indeed, because a function call on `ones` might consume `ones` before it is fully defined.
<Enjolras> you cannot use any function at all, not restrict to lazy
<octachron> freyr69, the second definition should be fine
<freyr69> I see, thanks. Why does OCaml allows such definitions on strict lists? It seems it just breaks pretty much any list function?
<octachron> There are situation where such recursive values are more natural, and it is not really the role of a compiler to judge the naturalness of constructions?
Guest1684 has quit [Remote host closed the connection]
<freyr69> octachron: Well, dependently typed languages check recursive inductive definitions
<freyr69> so why not
<freyr69> it checks that there is a cycle after all
<freyr69> why not to prohibit it?
Haudegen has joined #ocaml
<octachron> Prohibiting all recursive values would be another option indeed.
<freyr69> Wow, does lazy save exceptions also?
<freyr69> It's even documented, yet unexpected
bartholin has quit [Ping timeout: 246 seconds]
bartholin has joined #ocaml
ihavelotsoffries has joined #ocaml
<ihavelotsoffries> Hello :)
<ihavelotsoffries> So let hd :: (hd' :: rest) = [1;2;3] works as I expect it.
<ihavelotsoffries> But could some explain how let hd :: (hd' :: _ as rest) = [1;2;3] works?
<ihavelotsoffries> why is rest 2;3 instead of just 3?
<ihavelotsoffries> Even more, I find this variation interesting: let hd :: (hd' :: n as rest) = [1;2;3]
<bartholin> ihavelotsoffries: for let hd :: (hd' :: _ as rest) = [1;2;3], rest is set to let hd' :: _ (that is, [2;3]
<bartholin> It's all about operator priority
<bartholin> You can do let hd :: (hd' :: (n as rest)) = [1;2;3] if you want rest to be [3].
<ihavelotsoffries> Oh
<ihavelotsoffries> I am just trying to wrap my head around pattern matching patterns.
themsay has quit [Read error: Connection reset by peer]
<ihavelotsoffries> "The pattern pattern1 as  value-name matches the same values as
<ihavelotsoffries> pattern1. If the matching against pattern1 is successful,
<ihavelotsoffries> the name value-name is bound to the matched value, in addition to the
<ihavelotsoffries> bindings performed by the matching against pattern1."
themsay has joined #ocaml
<ihavelotsoffries> Can you help me understand how it can be bound to the matched value and the pattern binding?
<ihavelotsoffries> what that even means?
<ihavelotsoffries> :P
<ihavelotsoffries> I think I understood how the alias works though, thank you so much.
<Khady> I think what you pasted means that in let hd :: (hd' :: _ as rest) = [1;2;3] you are binding 3 values: hd, hd' and rest
<Khady> rest is value-name
<Khady> hd and hd' are the "bindings performed by the matching against pattern1."
mfp has joined #ocaml
<ihavelotsoffries> Oh, so it says that the binding is done as usual even when you alias the pattern.
<ihavelotsoffries> That makes sense, thank you.
<ihavelotsoffries> Trying to really learn OCaml seriously, it has been fun.
<ihavelotsoffries> Very disappointed I have not discovered this language earlier in my life.
kvda has joined #ocaml
<Khady> it's never too late to have fun
kvda has quit [Ping timeout: 268 seconds]
ihavelotsoffries has quit [Remote host closed the connection]
barockobamo has quit [Ping timeout: 246 seconds]
barockobamo has joined #ocaml
amiloradovsky has quit [Ping timeout: 245 seconds]
rwmjones has quit [Ping timeout: 250 seconds]
rwmjones has joined #ocaml
silver has joined #ocaml
pie_ has joined #ocaml
Haudegen has quit [Remote host closed the connection]
<freyr69> class virtual test = object method virtual x : unit -> (unit, [> error]) result end
<freyr69> The method x has type unit -> (unit, [> error ] as 'a) result where 'a is unbound
<freyr69> How to return a proper type?
<freyr69> is it impossible without a class parameter?
<freyr69> Is there record-like forall for objects?
<freyr69> It seems there is
<AxiomaticEspress> hi, is there any way to use dune rules to provide an implementation for a particular .mli file? I mean, that the cmx file comes from somewhere else as opposed to being built from a ml file?
omarramo has joined #ocaml
jaar has joined #ocaml
spew has joined #ocaml
q9929t has joined #ocaml
q9929t has quit [Quit: q9929t]
omarramo has quit [Ping timeout: 244 seconds]
Haudegen has joined #ocaml
omarramo has joined #ocaml
<xvilka> hahaha, I am stupid, Applicatives are in the Base library: https://ocaml.janestreet.com/ocaml-core/v0.12/doc/base/Base/Applicative/index.html
omarramo has quit [Ping timeout: 245 seconds]
omarramo has joined #ocaml
gravicappa has joined #ocaml
gareppa has joined #ocaml
<AxiomaticEspress> map toLower "Salut.mlf"
<AxiomaticEspress> sry lol
<companion_cube> xvilka: anyway applicatives will just be modules that provide an API, there isn't a "true" concept of them like in Haskell
AnAverageHuman has joined #ocaml
FreeBirdLjj has joined #ocaml
jaar_ has joined #ocaml
jaar has quit [Ping timeout: 244 seconds]
_y has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
<Leonidas> what is truth anyway
FreeBirdLjj has joined #ocaml
<companion_cube> what I mean it that it's a convention, not something the compiler knows of
<_y> hi! i am facing a very strange problem with opam2 refusing to install a compiler (multicore-ocaml 4.06.1) because it expects a wrong MD5 sum
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
<_y> the strange part is, the same installation process just works on other computers
<_y> even starting from a fresh ~/.opam root did not solve the problem
<Leonidas> memtest86+?
<_y> any idea what could be the issue?
<Leonidas> faulty RAM
<reynir> malicious man in the middle
<Drup> Leonidas: that's a very bold claim for a faulty md5 :p
<Leonidas> reynir: a man in the middle would fake the correct md5 nowadays :p
<_y> very unlikely, i always get the same faulty expected MD5 sum (and i first tried 2 weeks ago)
gareppa has quit [Quit: Leaving]
<Leonidas> _y: maybe the checksum has changed and you need to `opam update` to get the newest expected md5?
<_y> i did
<_y> ( what i did: https://zero.crans.org/?5fdb61b3474d2d45#PgK5+cNvMfxooj4PSFA9TrMpr1a/Q+QQ9g05T28dw9w= )
ziyourenxiang has quit [Ping timeout: 272 seconds]
<_y> (x86-64, linux 4.19.2-arch1-1-ARCH (Archlinux), opam 2.0.1)
<reynir> Leonidas: good point :
<reynir> :D
omarramo has quit [Quit: Konversation terminated!]
omarramo has joined #ocaml
unyu has quit [Ping timeout: 252 seconds]
unyu has joined #ocaml
freyr69 has quit [Remote host closed the connection]
notnotdan` has joined #ocaml
assemblyman has joined #ocaml
ChristopheT has joined #ocaml
von-strauss has joined #ocaml
assemblyman has quit [Quit: ™]
AnAverageHuman has quit [Ping timeout: 256 seconds]
omarramo has quit [Ping timeout: 244 seconds]
Jesin has quit [Quit: Leaving]
sillyotter has joined #ocaml
sillyotter has quit [Client Quit]
Jesin has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
barockobamo has quit [Remote host closed the connection]
FreeBirdLjj has quit [Ping timeout: 252 seconds]
KeyJoo has joined #ocaml
ChristopheT has quit [Quit: ERC (IRC client for Emacs 26.1)]
AnAverageHuman has joined #ocaml
omarramo has joined #ocaml
profan has quit [Ping timeout: 252 seconds]
von-strauss has left #ocaml ["Leaving"]
profan has joined #ocaml
KeyJoo has quit [Remote host closed the connection]
pie_ has quit [Ping timeout: 244 seconds]
KeyJoo has joined #ocaml
vovs03 has joined #ocaml
jaar_ has quit [Ping timeout: 245 seconds]
vovs03 has quit [Quit: vovs03]
AnAverageHuman has quit [Ping timeout: 256 seconds]
omarramo has quit [Ping timeout: 244 seconds]
Haudegen has quit [Remote host closed the connection]
jnavila has joined #ocaml
Haudegen has joined #ocaml
Algebr has joined #ocaml
jnavila has quit [Ping timeout: 246 seconds]
omarramo has joined #ocaml
assemblyman has joined #ocaml
AtumT has joined #ocaml
zolk3ri has joined #ocaml
AnAverageHuman has joined #ocaml
mk__ has joined #ocaml
gravicappa has quit [Ping timeout: 252 seconds]
<mk__> How to tell `ocanlfind ocamlc` to look at the current/other directory for some modules?
<companion_cube> -I
<companion_cube> but maybe also just use dune ;)
Algebr has quit [Read error: Connection reset by peer]
kakadu has joined #ocaml
<mk__> Yes, dune finds it outomatically, but I was just trying `ocamlfind ocamlc`, and `-I .` didn't work too
Cypi has quit [Remote host closed the connection]
Cypi has joined #ocaml
<companion_cube> well if dune finds it automatically, tbh, don't look further?
assemblyman has quit [Quit: ™]
Algebr has joined #ocaml
Algebr is now known as Guest39444
mk__ has quit [Ping timeout: 256 seconds]
KeyJoo has quit [Quit: KeyJoo]
Jesin has quit [Quit: Leaving]
jnavila has joined #ocaml
Jesin has joined #ocaml
ygrek has joined #ocaml
omarramo has quit [Ping timeout: 268 seconds]
klntsky has quit [Remote host closed the connection]
klntsky has joined #ocaml
omarramo has joined #ocaml
jnavila has quit [Ping timeout: 246 seconds]
themsay has quit [Read error: Connection reset by peer]
themsay has joined #ocaml
SpiceGuid has joined #ocaml
jnavila has joined #ocaml
Guest39444 has left #ocaml [#ocaml]
zolk3ri has quit [Remote host closed the connection]
bigmoney has joined #ocaml
bigmoney has quit [Client Quit]
tormen_ has quit [Quit: leaving]
tormen has joined #ocaml
tormen has quit [Client Quit]
tormen has joined #ocaml
tormen_ has joined #ocaml
tormen has quit [Client Quit]
tormen has joined #ocaml
tormen has quit [Client Quit]
jnavila has quit [Remote host closed the connection]
ygrek has quit [Ping timeout: 272 seconds]
kakadu has quit [Remote host closed the connection]
tormen_ has quit [Quit: leaving]
tormen has joined #ocaml
AnAverageHuman has quit [Ping timeout: 256 seconds]
sonologico has quit [Ping timeout: 250 seconds]
Birdface has quit [Ping timeout: 250 seconds]
xuib has joined #ocaml
Jesin has quit [Quit: Leaving]
omarramo has quit [Ping timeout: 268 seconds]
Jesin has joined #ocaml
SpiceGuid has quit [Quit: ChatZilla 0.9.93 [SeaMonkey 2.49.4/20180713174829]]