<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
<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?