SquidDev has quit [Read error: Connection reset by peer]
averell has quit [Quit: .]
jbrown has quit [Ping timeout: 272 seconds]
SquidDev has joined #ocaml
SquidDev has quit [Read error: Connection reset by peer]
SquidDev has joined #ocaml
smazga has joined #ocaml
smazga has quit [Ping timeout: 256 seconds]
smazga has joined #ocaml
smazga has quit [Ping timeout: 264 seconds]
smazga has joined #ocaml
smazga has quit [Ping timeout: 240 seconds]
smazga has joined #ocaml
smazga has quit [Ping timeout: 240 seconds]
smazga has joined #ocaml
<haesbaert>
I have a module that needs runtime initialization, it initializes sdl, opens windows, surfaces and so on, I want these to be "globals" inside the module. What's the common approach to it ?
<haesbaert>
so far I have a: let sdl_resources = ref None
<haesbaert>
and a init : unit -> unit function that sets sdl_resources to Some (stuff), but it feels so freaking ugly
smazga has quit [Ping timeout: 265 seconds]
<haesbaert>
I thought about using a functor, so the module takes a another module as initialization
malc_ has joined #ocaml
waleee-cl has joined #ocaml
mangoicedtea has joined #ocaml
smazga has joined #ocaml
smazga has quit [Ping timeout: 240 seconds]
osa1 has quit [Ping timeout: 246 seconds]
craigfe has quit [Ping timeout: 258 seconds]
smazga has joined #ocaml
sonologico has quit [Read error: Connection reset by peer]
smazga has quit [Ping timeout: 246 seconds]
sonologico has joined #ocaml
smazga has joined #ocaml
smazga has quit [Ping timeout: 256 seconds]
reynir is now known as |
| is now known as reynir
smazga has joined #ocaml
smazga has quit [Ping timeout: 240 seconds]
mangoicedtea has quit [Quit: Leaving]
smazga has joined #ocaml
smazga has quit [Ping timeout: 240 seconds]
ansiwen[m] has joined #ocaml
smazga has joined #ocaml
smazga has quit [Ping timeout: 265 seconds]
smazga has joined #ocaml
osa1 has joined #ocaml
<d_bot>
<Et7f3> what about: `let sql_resources = init ()` ?
<companion_cube>
also wrap that stuff in a lazy for idempotence, or check it's not been initialized yet
malc_ has left #ocaml ["ERC (IRC client for Emacs 28.0.50)"]
jbrown has joined #ocaml
jbrown has quit [Ping timeout: 244 seconds]
jbrown has joined #ocaml
smazga has quit [Ping timeout: 258 seconds]
smazga has joined #ocaml
Haudegen has quit [Quit: No Ping reply in 180 seconds.]
Haudegen has joined #ocaml
smazga has quit [Ping timeout: 240 seconds]
smazga has joined #ocaml
averell has joined #ocaml
sonologico has quit [Remote host closed the connection]
smazga has quit [Ping timeout: 240 seconds]
<inkbottle>
`dune build ./bin/hello.exe` fails for errors in source files which are not referenced to in the `dune` file
<companion_cube>
all .ml files in the bin/ dir are fair game to dune, I think
<inkbottle>
okay
<inkbottle>
Is there a way I can ask nicely to leave them alone?
<companion_cube>
I think if your dune stanzas have `(modules a b c)` it'll only touch files for these modules
<companion_cube>
but otherwise, move them to a subdirectory maybe?
<inkbottle>
Thanks, I'll try that
<inkbottle>
(meaning the modules thing)
smazga has joined #ocaml
smazga has quit [Ping timeout: 240 seconds]
smazga has joined #ocaml
jbrown has quit [Ping timeout: 272 seconds]
smazga has quit [Ping timeout: 264 seconds]
<motherfsck>
have an sml question. I know this is an ocaml room but I also asked this over in #sml, but that room is awfully quiet in general. If there is a better place for me to ask this. I'd greatly appreciate it.
<motherfsck>
I've got a copy of Purly Functional Data Structures By Chris Okasaki. The first few implementations seem straight forward enough to follow conceptually, but actually using them in sml has me stumped. Coming from an imperative background, this all is pretty foreign to me.
<motherfsck>
http://codepad.org/pXrrVu4K Judging by the error I feel as if I need to define an additional struct and pass that in in lieu of 1. Anyway, thanks in advance for any help.
<Armael>
insert seems to take a pair
<Armael>
so try ISet.insert (1, ISet.empty)
<motherfsck>
Yep that was it. Thanks a bunch. I 've been beating my head against a wall for a couple days on that
smazga has joined #ocaml
<motherfsck>
Can I ask, what about the syntax told you that?
<Armael>
in signature SET, you have "val insert : Elem * Set -> Set"
<Armael>
"foo * bar" is the type of a pair
* motherfsck
noted
<Armael>
what you wrote would've worked if the type of insert was instead Elem -> Set -> Set
<Armael>
also, in the implementation of insert (l31) you can see that it takes a pair
<motherfsck>
ok. sounds like i have some basic syntax that I need to nail down still
<Armael>
note that in SML it is customary to encode a multiple arguments for a function by having the function take a tuple (so, the function is uncurried)
<Armael>
instead, in ocaml, the convention is instead to have a curried function
<motherfsck>
Is there any reason behind that besides convention?
<Armael>
(these are just conventions, both styles work in SML and ocaml)
* motherfsck
nods
<Armael>
I'm not sure
<Armael>
they are not strictly equivalent, since if you have a function of type a -> b -> c, the function may perform side effects after being provided the first argument only
smazga has quit [Ping timeout: 240 seconds]
<Armael>
whereas with a function of type a*b -> c, you can see that it can only do something after you provided both arguments
<Armael>
so in that sense the SML convention is a bit more explicit (the type gives you a bit more information), but it is less convenient if you want to partially apply the function
<Armael>
but I don't know what is the historical reason for chosing one style over the other in SML/ocaml
<companion_cube>
in SML things were not curried because compilers were not good at making currying efficient
<companion_cube>
part of why Caml/OCaml became its own thing is because of abstract machines that were good at avoiding the overhead of currying
<Armael>
is that the reason ? or is it that compilers were not optimizing currying because it was not the convention?
<companion_cube>
I think it's really because currying is harder
smazga has joined #ocaml
smazga has quit [Ping timeout: 264 seconds]
mirrorbird has quit [Quit: Leaving]
<rwmjones>
rgrinberg (or anyone) ... I'm trying to make modifications to dune to fix https://github.com/ocaml/dune/issues/3736 but to do that I want to modify my local copy of dune and test the changes on a build of ocaml-ssl
<rwmjones>
however I cannot work out how to run dune from the local copy in another directory
<rwmjones>
obvs I don't want to install dune
jbrown has joined #ocaml
<rwmjones>
../dune/dune.exe build does not work with errors similar to:
<rgrinberg>
Pretty much. Although dune makes it a bit easier with exec. If you've built dune and configurator, they should appear in _build/install/default/lib
<rgrinberg>
Then you can just do ./dune.exe exec -- sh
<rgrinberg>
and you'll be in an environment where the locally built public libraries are visible through findlib
bartholin has quit [Remote host closed the connection]
<rgrinberg>
E.g. ./dune.exe exec -- ocamlfind query dune-configurator should point to the right path