<Harzilein>
hmm... "Shake build systems can discover additional dependencies after running previous rules, allowing the build system to generate files and then examine them to determine their dependencies, rather than predict the dependencies in advance. Such capabilities are essential when working with generated source files, but often allow build systems to be structured more logically."
<Harzilein>
there's no comparable thing in ocaml, is there?
cbot has joined #ocaml
<Harzilein>
hmm
<Harzilein>
jenga, supposedly
MercurialAlchemi has quit [Ping timeout: 268 seconds]
olibjerd has joined #ocaml
segmond has quit [Quit: l8r]
sgronblo has joined #ocaml
MercurialAlchemi has joined #ocaml
ygrek has joined #ocaml
aggelos_ has quit [Ping timeout: 245 seconds]
aggelos_ has joined #ocaml
aggelos_ has quit [Ping timeout: 245 seconds]
aggelos_ has joined #ocaml
average has quit [Ping timeout: 245 seconds]
Simn has joined #ocaml
bbc_ is now known as bbc
<def`>
octachron: can I find this file somewhere?
<companion_cube>
orbifx[m]: well if you're not convinced by the reddit thread, maybe give a try to containers and tell me if you miss something ;)
jlam__ has joined #ocaml
<orbifx[m]>
companion_cube: I think I will. The only remark I have so far is the CC prefix to everything seems noisy. I didn't like Qt code either for all the Qs :P . Could it not be CC.container?
jlam_ has quit [Ping timeout: 240 seconds]
Orion3k has quit [Ping timeout: 260 seconds]
sgronblo has quit [Ping timeout: 240 seconds]
chat__ has quit [Ping timeout: 260 seconds]
sgronblo has joined #ocaml
ygrek has quit [Ping timeout: 240 seconds]
Muzer has quit [Ping timeout: 260 seconds]
chat_ has joined #ocaml
kalio has quit [Ping timeout: 240 seconds]
Muzer has joined #ocaml
pookleblinky has left #ocaml ["WeeChat 1.2"]
<companion_cube>
open Containers
KeyJoo has joined #ocaml
pierpa has quit [Ping timeout: 268 seconds]
zpe has joined #ocaml
argent_smith has joined #ocaml
<toolslive>
fwiw merlin regularly/systematically hangs my emacs on some files
dtornabene has joined #ocaml
cbot has quit [Quit: Leaving]
jack5638 has quit [Ping timeout: 260 seconds]
dtornabene has quit [Quit: Leaving]
dtornabene has joined #ocaml
average has joined #ocaml
jack5638 has joined #ocaml
<Leonidas>
Does anybody know when I >>= an already resolved (or whatever Async calls it) Deferred.t, does it just return the previous result or will it re-run it?
<rks`>
it returns the already computed result.
<rks`>
"returns"*
mfp has joined #ocaml
<orbifx[m]>
companion_cube: ow that could work.
<Leonidas>
rks`: thanks. That's exactly what I want. But suppose I wanted to recompute it (since it might do some network requests), how would I do that?
<rks`>
have a function returning a deferred
<rks`>
and call the function again ?
<Leonidas>
right. thanks
<Leonidas>
with all the excitement about jbuilder, what happened to janestreet's own jenga? it still seems to be updated
kakadu has joined #ocaml
rossberg has quit [Ping timeout: 260 seconds]
pootler has joined #ocaml
malc_ has joined #ocaml
pootler has quit [Read error: Connection reset by peer]
<Leonidas>
is there a way to get a record key accessor function? Or do I need a oox rewriter to generate those?
shinnya has joined #ocaml
ontologiae has joined #ocaml
<octachron>
Leonidas, janestreet's "ppx_fields_conv" does exactly that
<Leonidas>
octachron: nice, I even have installed that already, thanks :)
fraggle-boate_ has quit [Ping timeout: 240 seconds]
Lonios has joined #ocaml
Magnum has joined #ocaml
zpe_ has quit [Remote host closed the connection]
zpe has joined #ocaml
zpe has quit [Ping timeout: 240 seconds]
Lonios has quit [Remote host closed the connection]
Magnum has quit [Remote host closed the connection]
Magnum has joined #ocaml
Magnum has quit [Remote host closed the connection]
sepp2k has joined #ocaml
jlam_ has joined #ocaml
jlam has quit [Killed (wilhelm.freenode.net (Nickname regained by services))]
jlam_ is now known as jlam
jlam_ has joined #ocaml
toolslive has quit [Ping timeout: 240 seconds]
jlam__ has quit [Ping timeout: 268 seconds]
toolslive has joined #ocaml
kalio has joined #ocaml
pierpa has quit [Remote host closed the connection]
kalio has quit [Quit: WeeChat 1.8]
kalio has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 246 seconds]
yomimono has joined #ocaml
copy` has joined #ocaml
yomimono has quit [Ping timeout: 240 seconds]
yomimono has joined #ocaml
ansiwen|lunch is now known as ansiwen
jao has joined #ocaml
kalio has quit [Quit: WeeChat 1.8]
kalio has joined #ocaml
barcabuona has joined #ocaml
<barcabuona>
hey guys im looking to overload boolean operations. like my own type can represent either true or false, and operations on my own type (such as or/and) can be specified just like native.
<barcabuona>
is this possible?
yomimono has quit [Ping timeout: 258 seconds]
<theblatte>
barcabuona: you can let (&&) x y = ... to rebind the infix && operator for instance
<theblatte>
now whether or not this is advisable... ;)
<theblatte>
I find that overloading primitive infix operators tends to make code harder to read in the long run, but ymmv
ziyourenxiang has quit [Ping timeout: 240 seconds]
<barcabuona>
theblatte: maybe i can pattern match? like if x and y are my own type do this else do the default && (which has not been replaced until the let is done)?
<theblatte>
that you cannot do
<barcabuona>
i mean in let (&&)
<theblatte>
yes
<barcabuona>
let (&&) x y = match x,y with MyType(x),MyType(y) -> whatever | x',y' -> x'&&y'
<theblatte>
to pattern match, you need patterns; you cannot match on the type of some value
<barcabuona>
the other issue is i want to do something like if MyType(x) then ... else ...
<barcabuona>
and MyType is actually an enumeration so i can choose what is true
<theblatte>
so it would be more like let (&&) x y = match x,y with MyTpe(x), MyType(y) -> whatever | Bool(x'), Bool(y') -> x' && y'
<theblatte>
i.e., you have to wrap all your values into MyType/Bool as appropriate
<theblatte>
and create type foo = MyType of mytype | Bool of bool
<barcabuona>
Bool is a native type?
<theblatte>
nope
<octachron>
theblatte, redefining (&&) and (||) are even less advisble than usual since the new operators would not been short-circuiting
<theblatte>
bool is a type, Bool is a variant I made up that takes a bool as argument
<theblatte>
octachron: ouch, good catch :)
ontologiae has quit [Ping timeout: 268 seconds]
ziyourenxiang has joined #ocaml
HunterOfSouls has joined #ocaml
HunterOfSouls has quit [Remote host closed the connection]
Kubacik has joined #ocaml
Sebalos has joined #ocaml
Sebalos has quit [Remote host closed the connection]
Kubacik has quit [Remote host closed the connection]
Euturiel has joined #ocaml
Lonios has joined #ocaml
NightCrawler has joined #ocaml
Euturiel has quit [Remote host closed the connection]
NightCrawler has quit [Remote host closed the connection]
Lonios has quit [Remote host closed the connection]
<Drup>
There is one case I found where redefining such operator is nice: building logic formulas (for SMT solvers, in particular)
jlam__ has joined #ocaml
jlam is now known as Guest72606
jlam__ is now known as jlam
Guest72606 has quit [Killed (wolfe.freenode.net (Nickname regained by services))]
<zv>
It is extremely nice
<zv>
It's hard enough to corral a script into a SAT or SMT solver without having to change every single operator
yomimono has joined #ocaml
jlam__ has joined #ocaml
<octachron>
Drup, I am also very fond of local opens + DSL + short operator names; but I am not sure that it is not my mathematical leaning which is speaking
shinnya has quit [Ping timeout: 255 seconds]
jlam_ has quit [Ping timeout: 260 seconds]
<companion_cube>
Drup: I'd rather use &&& ||| or something else which doesn't collide
<rixed_>
Suppose I want to add an HTTP server to some daemon written in ocaml, can I use ocsigen as a library?
Sandocan has joined #ocaml
<companion_cube>
use cohttp
<rixed_>
Looks good. Actually I hadn't considered it because of the perceived dependency on mirage but apparently it's only in the name
Sandocan has quit [Remote host closed the connection]
average has quit [Ping timeout: 245 seconds]
average has joined #ocaml
Namish has joined #ocaml
kakadu has left #ocaml ["Konversation terminated!"]
Namish has quit [Remote host closed the connection]
letaris has joined #ocaml
dtornabene has quit [Read error: Connection reset by peer]
tane has joined #ocaml
olibjerd has quit [Ping timeout: 245 seconds]
ryanartecona has joined #ocaml
KeyJoo has quit [Ping timeout: 268 seconds]
zaquest has quit [Ping timeout: 272 seconds]
jlam__ has quit [Quit: jlam__]
jlam_ has joined #ocaml
zaquest has joined #ocaml
fraggle_ has quit [Read error: Connection reset by peer]
<barcabuona>
hello. i need something like a set of associations on which i can perform: adding/modifying an element, uniting 2 sets based on a law/function for 2 equal keys
<barcabuona>
is there some module that provides this? performance is not an issue
<barcabuona>
octachron: nice. so basically add,merge and union seem to be what i want thanks
ryanartecona has quit [Quit: ryanartecona]
ryanartecona has joined #ocaml
yomimono has quit [Ping timeout: 255 seconds]
AlexRussia has joined #ocaml
ontologiae has joined #ocaml
katness has joined #ocaml
olibjerd has joined #ocaml
ontologiae has quit [Ping timeout: 245 seconds]
<Drup>
rixed_: there really is not such thing as "dependency on mirage"
<katness>
Hi guys, can anyone help with this question: if i find an element is included in a certain list, how do i return a list that excludes this element.Say I match z with |Z(listx, listy) and i want a Z(listx-element), listy)
<Drup>
mirage is a set of loosely coupled libraries, a bunch of tools and some runtime to run on various platforms
<malc_>
Katness: List.filter (fun e -> e != element) listx
KeyJoo has joined #ocaml
<katness>
@malc_ thx!!
<malc_>
Katness: np, List.filter ((!=) element) listx will do just fine too
Namish has quit [Remote host closed the connection]
Alastair has joined #ocaml
ryanartecona has joined #ocaml
Alastair has quit [Remote host closed the connection]
L4M4RCK has joined #ocaml
katness has joined #ocaml
letaris has quit [Remote host closed the connection]
pierpa has joined #ocaml
yomimono has quit [Quit: Leaving]
kakadu has joined #ocaml
mcc has quit [Quit: Connection closed for inactivity]
olibjerd has quit [Remote host closed the connection]
<barcabuona>
hey guys about the Map. i need an assoc nativeint -> enum. how am i supposed to do this exaclty? i got this https://ptpb.pw/bZqh but the typing doesnt look right
L4M4RCK has quit [Remote host closed the connection]
segmond has joined #ocaml
<octachron>
barcabuona, the Map functor only takes the type t (aka the type of key) as an argument, the resulting type is polymorphic over its contents
olibjerd has joined #ocaml
malc_ has quit [Remote host closed the connection]
MercurialAlchemi has quit [Ping timeout: 260 seconds]
jack5638 has quit [Ping timeout: 240 seconds]
<companion_cube>
not much :/
jack5638 has joined #ocaml
<rgrinberg>
plenty of occasional ones though :P
jnavila has quit [Ping timeout: 258 seconds]
<octachron>
I love it when I discover an OCaml feature by greping the compiler source code :(
cbot has quit [Ping timeout: 260 seconds]
cbot_ has joined #ocaml
tane has quit [Quit: Leaving]
<Drup>
octachron: which one ?
<octachron>
Drup, the lambda representation plugin hooks
<octachron>
Drup, by the way citing the location of plugin hooks in the documentation is a good idea; I am doing that right now
cbot_ has quit [Ping timeout: 240 seconds]
cbot has joined #ocaml
<octachron>
speaking of it, if anyone want to see a specific feature/examples of compiler plugins documented in the manual, I am all hears
raphaelss has joined #ocaml
ryanartecona has quit [Quit: ryanartecona]
pierpa has quit [Remote host closed the connection]
olibjerd has joined #ocaml
ygrek has joined #ocaml
_andre has quit [Quit: leaving]
SpiceGuid has joined #ocaml
vbmithr has quit [Quit: leaving]
vbmithr has joined #ocaml
mengu has joined #ocaml
kakadu has quit [Remote host closed the connection]
SpiceGuid has quit [Client Quit]
raphaelss has quit [Ping timeout: 240 seconds]
mengu has quit [Quit: Leaving...]
<barcabuona>
hey guys im having a lot of difficulty
<barcabuona>
basically at any one moment i have a list of associations.
<barcabuona>
i generate 2 more lists of associations that extend upon the older one.
<barcabuona>
i then need to isolate the new associations in the 2 new lists from the ones that were also in the older list.
<barcabuona>
(which is why i find it hard touse Map.Make)
<zozozo>
what do you find hard to use with the Map module ?
<barcabuona>
anyway, after having done so i now have basically 2 lists that contain the elements that were of exceeding length compared to the original one.
<barcabuona>
i then need to create a set out of each list, grabbing only the newest elements.
<barcabuona>
finally, i need to merge the 2 sets of associations according to some law
<zozozo>
what is the problem you are trying to solve using your lists of associations ?
<barcabuona>
and i find all of this extremely hard with ocaml
<barcabuona>
zozozo: it's a bit complex. im doing something called taint analysis
mengu has joined #ocaml
Simn has quit [Quit: Leaving]
<barcabuona>
anyway an association is basically what each variable gets mapped to
<barcabuona>
also the issue with the map module is that it overwrites old values, but whenever im going to receive the 2 new lists i need to extract all the newer values and with Map it would be impossible to tell the difference betweeen older and newer values
<zozozo>
for that, Maps are really nicer than associations lists, anyway, reading yours messages in order, how do you build the 2 lists that "extend upon the older one" ?
<barcabuona>
the lists basically traverse some code that generates new associations, and append them to the list whenever one is found
<zozozo>
what about also keeping the added associations in another lists ?
<barcabuona>
well actually this happens for one list. i repeat the process 2 times and i get 2 lists
<barcabuona>
zozozo: that cannot work as the process of adding new associations requires older ones as well
ontologiae has quit [Ping timeout: 272 seconds]
ygrek has quit [Remote host closed the connection]
<zozozo>
not a problem, during your traversal you maintain two lists : the full one that you use to do your computations, and another list; and every time you add as association in your principal list, you also add it to the other list
<zozozo>
that seems simpler thant to try and compute the difference afterwards
<barcabuona>
i see.
<barcabuona>
that is slightly easier for this particular thing, but it screws up the rest of the program
<barcabuona>
im not having trouble with the difference
<barcabuona>
im having trouble with the next 2 points
ygrek has joined #ocaml
<barcabuona>
making each "new associations list" a set of associations (based on keys, not keys and values)
<barcabuona>
and then merging them
<zozozo>
what do you mean by a set of associations ? a set of pairs (key, value) ?
<barcabuona>
yes. a list of pairs
<barcabuona>
i have a list of pairs that contains repeated keys. i want non-repeated keys
<barcabuona>
and then i have 2 of these list, and i want to join them according to some rule
<barcabuona>
the order is not important after i have generated the "set"
<zozozo>
ok, so two questions: is it really useful to maintain the list with repeated keys ? i.e why not replace old values ?
<barcabuona>
that is because the elements that were added most recently to the association list get to be in the set
<barcabuona>
just a sec i think about this. i think not...
<zozozo>
so back to my original point : you should *really* use Maps and not association lists
AltGr has left #ocaml [#ocaml]
<zozozo>
they're more efficient and really easier to reason about
<barcabuona>
zozozo: i dont think i can overwrite values. because if i could overwrite values then i would not be able to recognize which values are new associations
<barcabuona>
so that rules out both array and map
<zozozo>
why not ? compare the value associated with the key : if it's different, the binding is new
<barcabuona>
its not that simple...
<barcabuona>
the value may be new multiple times
<barcabuona>
Clean -> Dirty -> Clean
<barcabuona>
..
<barcabuona>
one sec
<zozozo>
ok, in that case, the good way to do things is to also maintain a list/association/whatever structure to keep in mind what values have been changed
<zozozo>
and not try and compute it after the fact
silver has quit [Ping timeout: 260 seconds]
<barcabuona>
okay so it's more like this
<barcabuona>
if i have a Clean -> Dirty -> Clean and i have a map, i won't notice the change
<barcabuona>
the issue is that at some point it might be worthy of reason that what was clean is actually Dirty
<barcabuona>
so even that last variable that did not apparently seem t change state, ineed becomes Dirty
<barcabuona>
here is the reasoning if e then c1 else c2
<barcabuona>
if e is clean, then basically i need to grab all assignments from c1 and c2, merge them together and if any are dirty then they remain so, otherwise they are clean
ontologiae has joined #ocaml
<barcabuona>
but if e is dirty, then i must consider _all_ assignments from c1 and c2 to be dirty, because that "if" is subject to manipulation and either branch may be chosen randomly, therefore "dirtying" even clean values
<barcabuona>
not sure if that makes any sense, but i think i cannot use maps
<zozozo>
again, from what I understand, a good solution would be to use two data structures : a map *and* a set of dirtied values
<zozozo>
so that the Dirty -> Clean transition affects the map but not the set of dirtied values
<barcabuona>
zozozo: mmmm....not sure. maybe i could try to do like you suggested and have input one map and output 2 maps: one for the older map but modified, one for an empty map with only modifications..
<barcabuona>
that solves both the getting newer values and getting them in a "set"
<barcabuona>
(maybe)
<barcabuona>
the merge is still an issue though
<zozozo>
how so ?
<zozozo>
have you looked at Map's merge function ?
<barcabuona>
zozozo: i see that union is promising. thanks i'll try this! having 2 outputs is slightly troublesome but if it solves the issue im not complaining
argent_smith has quit [Quit: Leaving.]
<barcabuona>
zozozo: how does merge work? it's a bit vague
<octachron>
barcabuona, in "merge f map_1 map_2" the function "f" drives the merge
pierpa has joined #ocaml
<octachron>
it takes as argument "f key value_in_map_1_if_present value_in_map2_if_present"
<octachron>
and it returns either "None", if you want to discard the binding to the key
<octachron>
or "Some x" if you want key to be associated to x in the new map
<barcabuona>
thx i was having trouble understaing the double options
ontologiae has quit [Ping timeout: 240 seconds]
jlam__ has joined #ocaml
jlam_ has quit [Ping timeout: 260 seconds]
olibjerd has quit [Ping timeout: 240 seconds]
ygrek_ has joined #ocaml
ygrek has quit [Ping timeout: 260 seconds]
ygrek__ has joined #ocaml
<barcabuona>
zozozo: maybe it has worked! does anybody know why i get val m: tenv = <abstr> when i do let m = ...new envmap...
<barcabuona>
tenv is the type within the module
ygrek_ has quit [Ping timeout: 240 seconds]
<zozozo>
well, the top-level doesn't know how to print values of type tenv, so yes it's normal
<zozozo>
you can register a printer using #register_printer iirc
copy` has quit [Quit: Connection closed for inactivity]
<barcabuona>
thanks. another werid typing error
<barcabuona>
everything works fine, but for some reason trying to show the associations fails :\
<barcabuona>
Error: This expression has type tstore = taint StoreMap/9891.t but an expression was expected of type 'a StoreMap/10551.t
<barcabuona>
StoreMap.bindings o;;
<zozozo>
seems like you have at least two different modules StoreMap ?