govg has quit [Read error: Connection reset by peer]
govg has joined #ocaml
zpe has joined #ocaml
seangrove has joined #ocaml
SomeDamnBody has joined #ocaml
antkong has quit [Ping timeout: 245 seconds]
<SomeDamnBody>
hey I have this program that uses Cmdliner
<SomeDamnBody>
and it uses module Options, as in open Options
<SomeDamnBody>
but I've searched everywhere for the definition of that module, because now I'm trying to replicate some of the functionality
<SomeDamnBody>
I can't find Options anywhere
<SomeDamnBody>
some submodules are Provider and Fields
<SomeDamnBody>
but Option is different than Options
sh0t has quit [Ping timeout: 260 seconds]
<SomeDamnBody>
I've searched through the interfaces that are being opened, and I've got the oasis file that is being used, so I can resolve dependencies
<SomeDamnBody>
nevermind lol
<SomeDamnBody>
I found it
<reynir>
\o/
infinity0 has joined #ocaml
groovy2shoes has quit [Quit: Leaving]
govg has quit [Ping timeout: 264 seconds]
govg has joined #ocaml
shinnya has quit [Ping timeout: 240 seconds]
ggole has quit [Ping timeout: 240 seconds]
shinnya has joined #ocaml
ggole has joined #ocaml
kevinch has joined #ocaml
ygrek_ has joined #ocaml
hnagamin has quit [Ping timeout: 250 seconds]
hnagamin has joined #ocaml
govg has quit [Ping timeout: 240 seconds]
<SomeDamnBody>
is there a way to specify what target to build when using ocamlbuild
<adrien>
you just tell it on the command line but with the path iirc
<SomeDamnBody>
ok... can I get an example? Like, normally I use the following to build everything like this: ocaml setup.ml -quiet -build
<seangrove>
Is there a way to pull in just Core_kernel.Std.Option, so that I can do e.g. `Option.value ~default:"blah" x`, but *not* open the rest of the module?
<thizanne>
module Option = Core_kernel.Std.Option
<seangrove>
thizanne: Thanks, that's great!
<seangrove>
And is there something about infix operators? I notice `let open Lwt in ... >>= fun (x) -> ...` works, but not `module L = Lwt; ... L.>>= fun(x) -> ...`
<zozozo>
seangrove: just do L.(... >>= ...)
<zozozo>
which is the same as 'let open L in ... >>= ...'
<seangrove>
zozozo: Ah, ok, that makes sense
<reynir>
there's Lwt.Infix that you might want to open instead
govg has joined #ocaml
<ggole>
Hmm. Is there some obvious way, given a set of ints, to generate an int not in the set?
sh0t has joined #ocaml
ygrek_ has quit [Ping timeout: 250 seconds]
<fds>
In better than linear time? I think you'd have to store some extra info
Guest38 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<ggole>
Linear time is fine.
yawnt has joined #ocaml
<fds>
Erm, linear assuming constant-time look-ups. Maybe nlogn with OCaml Sets.
<fds>
Then `if 1 is not in S then 1 else next'
<fds>
:-P
<ggole>
Oh, actually, this should be easy because Set is sorted
<thizanne>
with OCaml Sets, I velieve you can get the min/max element
<ggole>
I can fold over it looking for gaps
<thizanne>
so just take min - 1 or max + 1
lokien has quit [Quit: Leaving]
<ggole>
The min/max could be min/max_int
<thizanne>
if it's a possibility, then you can indeed fold the tree
<ggole>
Hmm, I'll also need a pre-test to make sure that the set isn't, say, { max_int - 1, max_int } (which has no gaps)
<Drup>
compared to a normal invocation of clang, it's not much longer
<lokien>
"ocamlfind: Error from package `threads': Missing -thread or -vmthread switch"
<Drup>
beh, core ._.
<Drup>
add -threads
ollehar has joined #ocaml
<Drup>
-thread*
<lokien>
is batteries/containers any better?
<Drup>
ignore my remark and keep learning, it doesn't matter for now ;)
<lokien>
welp, okay
<lokien>
is using oasis necessary for every thing I build?
<Drup>
not really
<Drup>
you can use other build systems :p
<lokien>
eh, everything's so tangled :')
ggole has quit [Ping timeout: 250 seconds]
yawnt has quit [Ping timeout: 264 seconds]
<lokien>
oh, they are using corebuild in the book. it gives me infinite loop though
<Drup>
how did you used it ? ^^
antkong_ has joined #ocaml
<lokien>
copy-pasted "a complete program" from "real world ocaml"'s first chapter
<lokien>
ran corebuild sum.native
<lokien>
it compiled
<lokien>
now I can type in numbers, but it gives me nothing back
<lokien>
ohh, I have to ctrl+d
<lokien>
great, thank you book for being intuitive
<seangrove>
Jenga certainly sounds interesting, does anyone outside of Janestreet use it?
<lokien>
I'm stupid, it clearly said I have to ctrl+d, but I skimmed over it. sorry for that, irc folks
<Drup>
:D
<lokien>
:(
* lokien
feeling unnecessary
<seangrove>
I have a `string Lwt.t list` that I'm trying to String.concat "\n", but obviously I can't use straight String.concat. What would be the straightforward way to reduce it all into a string Lwt.t?
<Drup>
don't worry, it happens to everyone ;)
<Drup>
seangrove: first, transform it into a string list Lwt.t using Lwt_list.map_p, then use concat
<seangrove>
Drup: So transform it from a string Lwt.t list to a string list Lwt.t?
* seangrove
's gaze goes slightly cross-eyed
<Drup>
yes
<Drup>
you start with a list of thread
<Drup>
to do anything about it
<Drup>
you must get a thread that returns a list instead
<seangrove>
Is there an identity function, or does everyone just write (fun x -> x) ?
<Drup>
I tend to write it ..
<foolishmonkey>
seangrove, no, and there is no 0 for int. Those are useless things.
Another_Nickname has quit [Quit: Page closed]
<lokien>
Drup: I can compile it, but I still get "Unbound module Core" message from merlin.
<lokien>
how to get rid of that?
kakadu has joined #ocaml
<reynir>
You need to tell merlin what packages you are using
<lokien>
how?
antkong_ has quit [Quit: antkong_]
<reynir>
One way would be to add "PKG core" in .merlin, if I remember correctly
<lokien>
and now, where is .merlin.. let me find it
<reynir>
In vim you can use »:MerlinUse core« for a temporary fix
<lokien>
so I just put it in my directory? phew, ocaml rocks
<reynir>
Yes
<lokien>
works as expected, thank you
dmbaturin_ is now known as dmbaturin
sh0t has quit [Ping timeout: 240 seconds]
<seangrove>
Hrm, I'm doing something like: List.map (fun id -> make_http_request_returning_string_Lwt.t) big_list_of_ids, and it seems like they all launch very quickly (makes sense), but that's pretty bad on my part for the webserver I'm hitting. Is there perhaps an easy way to add some throttling here?
<lokien>
how would I create a map? something like let my_map = [("one",1);("two",2)]
<reynir>
You can use Lwt_list.map_s instead to make it run in serial (i.e. one req at a time)
<flux>
lokien, well, I suppose there are three options, one you just did (and then use ie. List.assoc do deal with it)
<lokien>
flux: my code was valid?! :D
<flux>
lokien, another is to use the Hashtbl module, and the third is using Map, which is a functor-based interface
<flux>
lokien, it was, yes ;)
<lokien>
flux: I'm porting a tictactoe to ocaml, so I'll go with that first option, since it looks simpler
<seangrove>
reynir: Brilliant, thanks!
<flux>
lokien, the query operations are going to take linear to the length of the list, of course, so if performance is a convern, you may want to reconsider :)
<reynir>
seangrove: note that it will return whatever list Lwt.t instead of whatever Lwt.t list (I think)
<lokien>
flux: also, what is idiomatic for keys? in clojure we have keywords, I don't know what to put here. strings?
<lokien>
flux: nah, it's like 9 values
<seangrove>
reynir: Yeah, saw that and fixed things up, thanks!
<flux>
lokien, well, closest to keywords are polymorphic variants
<flux>
lokien, but you probably want to define a sum type for the key
* lokien
is overwhelmed
cyraxjoe has joined #ocaml
<lokien>
flux: I guess I have to learn some more. thank you :)
<flux>
lokien, happy learning :)
<lokien>
flux: thanks again, I'll nag you if necessary :D
<lokien>
s/if/when
lokien_ has joined #ocaml
yawnt has joined #ocaml
lokien has quit [Quit: Leaving]
Jane-PC has joined #ocaml
Jane-PC has joined #ocaml
skeuomorf has quit [Ping timeout: 240 seconds]
Haudegen has joined #ocaml
skeuomorf has joined #ocaml
yawnt has quit [Ping timeout: 276 seconds]
sh0t has joined #ocaml
skeuomorf has quit [Ping timeout: 250 seconds]
skeuomorf has joined #ocaml
simn__ has joined #ocaml
zpe_ has joined #ocaml
JacobEdelman_ has joined #ocaml
rwmjones_ has joined #ocaml
DanielRi1hman has joined #ocaml
JacobEdelman has quit [Ping timeout: 240 seconds]
zpe has quit [Ping timeout: 240 seconds]
fluter has quit [Ping timeout: 240 seconds]
Sim_n has quit [Ping timeout: 240 seconds]
rwmjones has quit [Ping timeout: 240 seconds]
JacobEdelman_ is now known as JacobEdelman
Jane-PC has quit [Quit: Leaving]
fluter has joined #ocaml
DanielRi1hman has quit [Quit: Reconnecting]
DanielRichman has joined #ocaml
<SomeDamnBody>
hey the compiler isn't seeing code that is autogenerated by "with fields"
<SomeDamnBody>
it's saying there's no MyModule.Fields module
<SomeDamnBody>
I don't know what to do to get it to see that that module is generated
ollehar has quit [Quit: ollehar]
madroach has quit [Ping timeout: 248 seconds]
skeuomorf has quit [Ping timeout: 250 seconds]
antkong has joined #ocaml
hcarty has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 276 seconds]
madroach has joined #ocaml
<seangrove>
What are my options for de/serializing data conveniently? In Clojure I'd just (spit "filename.edn" (pr-str my-data)), and then (read-string (slurp "filename.edn")) and be good to go without any sort of DB for a long time
<hcarty>
seangrove: You can use ppx_deriving_yojson to get easy (de)serialization functions
<SomeDamnBody>
hcarty, ^
<hcarty>
SomeDamnBody: You're welcome. For extra fun, "ocamlbuild src/bar.inferred.mli" will put the automatically inferred interface for src/bar.ml into _build/src/bar.inferred.mli
<SomeDamnBody>
nice
<SomeDamnBody>
So um, I'm having trouble where the with fields facility isn't resulting in a Fields module seen by the compiler
<SomeDamnBody>
like, I have type t = { blah : string } with fields
<SomeDamnBody>
it was the requirement that there be a textual equality of the type name
<SomeDamnBody>
so I can't name it whatever I want. It has to be type t = blah
Guest38 has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 276 seconds]
antkong has quit [Ping timeout: 250 seconds]
Guest38 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
damason has joined #ocaml
Stalkr has joined #ocaml
<seangrove>
I'm trying to run the very basic example here https://github.com/mirage/irmin#usage, but getting an error: "Error: Unbound value Irmin.basic"
<seangrove>
Getting started with OCaml packages is still a very difficult prospect for me :P
<seangrove>
I have irmin.unix listed in my _oasis file