companion_cube changed the topic of #ocaml to: Discussion about the OCaml programming language | http://www.ocaml.org | OCaml 5.2.0 released: https://ocaml.org/releases/5.2.0 | Try OCaml in your browser: https://try.ocamlpro.com | Public channel logs at https://libera.irclog.whitequark.org/ocaml/
gentauro has quit [Read error: Connection reset by peer]
gentauro has joined #ocaml
tomku has quit [Ping timeout: 252 seconds]
tomku has joined #ocaml
Tuplanolla has quit [Quit: Leaving.]
ygrek has quit [Remote host closed the connection]
mbuf has joined #ocaml
mbuf has quit [Client Quit]
ygrek has joined #ocaml
bhoot has joined #ocaml
ygrek has quit [Remote host closed the connection]
bhoot has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bhoot has joined #ocaml
bhoot has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bhoot has joined #ocaml
bhoot has quit [Client Quit]
mbuf has joined #ocaml
myrkraverk_ has joined #ocaml
myrkraverk has quit [Read error: Connection reset by peer]
<discocaml> <kunx1233> im having this issue please help me
bhoot has joined #ocaml
myrkraverk__ has joined #ocaml
myrkraverk_ has quit [Ping timeout: 248 seconds]
myrkraverk_ has joined #ocaml
myrkraverk__ has quit [Ping timeout: 265 seconds]
myrkraverk__ has joined #ocaml
myrkraverk_ has quit [Read error: Connection reset by peer]
myrkraverk_ has joined #ocaml
myrkraverk__ has quit [Read error: Connection reset by peer]
bibi_ has quit [Quit: Konversation terminated!]
myrkraverk__ has joined #ocaml
myrkraverk_ has quit [Read error: Connection reset by peer]
myrkraverk__ is now known as myrkraverk
myrkraverk has quit [Ping timeout: 260 seconds]
bhoot has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bhoot has joined #ocaml
bhoot has quit [Client Quit]
bhoot has joined #ocaml
bhoot has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bhoot has joined #ocaml
bhoot has quit [Client Quit]
bhoot has joined #ocaml
bhoot has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bhoot has joined #ocaml
bhoot has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bhoot has joined #ocaml
bhoot has quit [Client Quit]
bartholin has joined #ocaml
bhoot has joined #ocaml
bhoot has quit [Client Quit]
myrkraverk has joined #ocaml
bhoot has joined #ocaml
yosik has joined #ocaml
yosik has quit [Changing host]
yosik has joined #ocaml
bhoot has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bhoot has joined #ocaml
bhoot has quit [Client Quit]
bhoot has joined #ocaml
bhoot has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Inline has quit [Quit: Leaving]
Inline has joined #ocaml
YuGiOhJCJ has quit [Quit: YuGiOhJCJ]
tomku has quit [Ping timeout: 260 seconds]
myrkraverk_ has joined #ocaml
myrkraverk has quit [Ping timeout: 265 seconds]
myrkraverk__ has joined #ocaml
myrkraverk_ has quit [Ping timeout: 252 seconds]
myrkraverk_ has joined #ocaml
Serpent7776 has joined #ocaml
myrkraverk__ has quit [Ping timeout: 276 seconds]
myrkraverk__ has joined #ocaml
Tuplanolla has joined #ocaml
myrkraverk_ has quit [Ping timeout: 252 seconds]
bhoot has joined #ocaml
TCZ has joined #ocaml
malte has quit [Ping timeout: 252 seconds]
bhoot has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
malte has joined #ocaml
alexherbo2 has joined #ocaml
malte has quit [Read error: Connection reset by peer]
malte has joined #ocaml
myrkraverk__ has quit [Read error: Connection reset by peer]
myrkraverk__ has joined #ocaml
Anarchos has joined #ocaml
Anarchos has quit [Client Quit]
Anarchos has joined #ocaml
CalimeroTeknik has quit [Changing host]
CalimeroTeknik has joined #ocaml
tomku has joined #ocaml
TCZ has quit []
<discocaml> <ada2k> is this not more appropriate for #beginners
alexherbo2 has quit [Remote host closed the connection]
<Anarchos> In the case where the file a.ml contains 'module A = struct..end', Is it a way to not use A.A.xxx ? I would prefer a mean to get the module inside the file directly.
<octachron> "module A = struct ... end" defines a submodule "A" inside "A", you can just not define a submodule?
<Anarchos> what is a submodule ?
<octachron> A module defined inside another module
<Anarchos> the pattern 'open A ; module AA = A' seems weird to me
<discocaml> <ada2k> well that's the pattern
<discocaml> <deepspacejohn> It seems weird to name a submodule the same as its parent module.
Anarchos has quit [Quit: Vision[]: i've been blurred!]
tomku has quit [Ping timeout: 252 seconds]
tomku has joined #ocaml
bhoot has joined #ocaml
waleee has joined #ocaml
bhoot has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bhoot has joined #ocaml
bhoot has quit [Client Quit]
myrkraverk__ has quit [Read error: Connection reset by peer]
myrkraverk__ has joined #ocaml
bhoot has joined #ocaml
alexherbo2 has joined #ocaml
bhoot has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bhoot has joined #ocaml
Serpent7776 has quit [Ping timeout: 255 seconds]
bhoot has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bhoot has joined #ocaml
bhoot has quit [Client Quit]
bhoot has joined #ocaml
TCZ has joined #ocaml
bhoot has quit [Client Quit]
twobitsp2ite has joined #ocaml
Putonlalla1 has joined #ocaml
bartholin has quit [*.net *.split]
twobitsprite has quit [*.net *.split]
thizanne has quit [*.net *.split]
Fardale has quit [*.net *.split]
Ekho has quit [*.net *.split]
caasih has quit [*.net *.split]
Duns_Scrotus____ has quit [*.net *.split]
JSharp has quit [*.net *.split]
Putonlalla has quit [*.net *.split]
bartholin has joined #ocaml
Duns_Scrotus____ has joined #ocaml
Fardale has joined #ocaml
thizanne has joined #ocaml
caasih has joined #ocaml
JSharp has joined #ocaml
Ekho- has joined #ocaml
<discocaml> <lerzide> Quick question, does anyone know how to fully uninstall opam including cygwin? my first installation failed which led to me reinstalling and not being able to download some packages. I'm trying to use LingshaSR fyi
<discocaml> <heri_2> i have to locate it and delete the folder
<discocaml> <heri_2> usually it's in appdata/local
<discocaml> <heri_2> btw u have the same problem as me before
<discocaml> <heri_2> check if u have install msys2 and uninstall it might help
<discocaml> <heri_2> it work for me
<discocaml> <lerzide> forgot to say that i've already tried uninstalling the folder
waleee has quit [Ping timeout: 252 seconds]
TCZ has quit [Remote host closed the connection]
mbuf has quit [Quit: Leaving]
germ has quit [Read error: Connection reset by peer]
alexherbo2 has quit [Remote host closed the connection]
alexherbo2 has joined #ocaml
ygrek has joined #ocaml
germ has joined #ocaml
alexherbo2 has quit [Remote host closed the connection]
terrorjack has quit [Quit: The Lounge - https://thelounge.chat]
alexherbo2 has joined #ocaml
alexherbo2 has quit [Remote host closed the connection]
alexherbo2 has joined #ocaml
terrorjack has joined #ocaml
<twobitsp2ite> Is there a way to import values from a module into the current namespace, i.e., so "Module.func val" can just be "func val"?
<discocaml> <Kali> open
alexherbo2 has quit [Remote host closed the connection]
<discocaml> <Kali> `open Module`
<discocaml> <Kali> you can also open in just an expression with `let open Module in expr` or `Module.(expr)`
alexherbo2 has joined #ocaml
<twobitsp2ite> tried that, I still have to do Module.func or I get errors... maybe I'm building it wrong?
twobitsp2ite is now known as twobitsprite
<discocaml> <Kali> show the code
<twobitsprite> specifically the lib/window.ml and the lib/util.ml files
<discocaml> <Kali> it seems like in bin/main.ml you are trying to `open Olarn.Fmts`/`.Window`/etc. but still call `Fmts.`/`Window.` qualified
<discocaml> <Kali> just `open Olarn`
<discocaml> <Kali> open exposes the contents of the module to the current namespace, it's not some sort of import
<twobitsprite> 9 | | Error (`Msg e) -> Util.log_err " Sdl.set_render_draw_color: %s" e; ()
<twobitsprite> Error: Unbound value Util.log_err
<discocaml> <Kali> oh, i see what the problem is
<discocaml> <Kali> you have `module Utils = ... end` in `utils.ml`
<discocaml> <Kali> the filename is already the module name
<discocaml> <Kali> so this is like `Olarn.Utils.Utils`
<twobitsprite> ahh... maybe it was Haskell or Scheme or some other language that required a module declaration at the top... idk, it's been a while :P
<discocaml> <Kali> remove the inner module declaration and then you can just use `open Olarn`
<twobitsprite> ok, so I removed the module declaration in the util.ml, window.ml complained about trying to open Olarn.Util, and when I tried to just "open Olarn" it says "this doesn't make sense to me"
<discocaml> <Kali> util.ml and window.ml are both inside the Olarn library, so it does not make sense to open what they are already in
<discocaml> <Kali> you don't need to open anything in them, they already have access to each other
<twobitsprite> well, adding "open Util" inside window.ml seemed to fix it...?
<twobitsprite> Without the "open Util" I get errors
<twobitsprite> Error: Unbound value log_err
<discocaml> <Kali> have you
<discocaml> <Kali> 1. removed all the extraneous inner module declarations in util, fmts, window.ml
<discocaml> <Kali> 2. written the file(s) in your editor to the disk
<discocaml> <Kali> 3. re-run `dune build`
<twobitsprite> 1. no, just in util.ml - 2. yes - 3. yes
TCZ has joined #ocaml
<discocaml> <Kali> fix 1, then
<discocaml> <Kali> anyway, if you want to write the functions completely unqualified then yes you will need to `open Util`
<discocaml> <Kali> if you want to write them as they are on github (qualified with `Util.`) then just get rid of the `open Util`
<discocaml> <Kali> in the `lib` folder
<discocaml> <Kali> outside the lib folder you will have to `open Olarn` and then either `open Util` or call them with `Util.`
<discocaml> <Kali> or you could just call them all with `Olarn.Util.` and not open anything
<discocaml> <Kali> i doubt you want that
<twobitsprite> that did the trick! thanks!
Serpent7776 has joined #ocaml
YuGiOhJCJ has joined #ocaml
Anarchos has joined #ocaml
alexherbo2 has quit [Remote host closed the connection]
TCZ has quit []
alexherbo2 has joined #ocaml
alexherbo2 has quit [Remote host closed the connection]
<twobitsprite> is there a better way to check for errors than half a dozen nested "match ... with" layers? the levels of indentation is starting to get silly
<discocaml> <Kali> by error, do you mean exception or the `Error` constructor of the `('a, 'e) result` type
<twobitsprite> as in the Error (`Msg e) -> ... | Ok m -> ... constuct
<dh`> twobitsprite: there is not, it is a core drawback of using pattern-matching the way functional languages do
<dh`> you can adopt ratty non-standard indentation but it isn't any better that way
<discocaml> <Kali> well, it depends; do you need to inspect the contents of the error?
<twobitsprite> dh`: not even a way to generalize it into a function, like: chk_err myfunc1 arg1; chk_err myfunc2 arg2
<twobitsprite> kali: I just want to print it mostly for now
<dh`> not really
<dh`> in haskell you can write do-notation in the error monad (which has its own problems) but ocaml has no equivalent syntax
<discocaml> <Kali> it is hard to say without seeing the code
<discocaml> <Kali> dh`, that is false
<dh`> since when is there do-notation?
<discocaml> <Kali> ocaml permits you to write let-operators
<twobitsprite> Kali: same code as before: https://github.com/memotype/olarn/tree/test
<discocaml> <Kali> which is just like do-notation, if you define it to be
<dh`> ah, I didn't realize that could be abused that far
<discocaml> <Kali> abused? it's literally the entire purpose
<discocaml> <Kali> the manual gives monadic binding as an example
<discocaml> <Kali> for let-op usage
<discocaml> <Kali> literally the first sentence of the second paragraph
<discocaml> <Kali> > Binding operators were introduced to offer convenient syntax for working with monads and applicative functors;
<twobitsprite> ok, well all of that sounds a bit over my head... I guess I'll just refacter into helper functions after a certain level of indentation :P
<discocaml> <Kali> anyway, let me take a look at the code
<dh`> I must have missed some of that bulletin
<Anarchos> twobitsprite you can write a big (try ... with) around all your match patterns
<dh`> anyway even if you do that it's still limited to the behavior available in the error monad, which doesn't include cleanup on error
<dh`> (or at least not naturally)
<twobitsprite> Anarchos: but each match depends on the result of the previous... perhaps I'm not familiar what what you're describing...
<discocaml> <Kali> which file is it in
<dh`> s/some of that bulletin/most of that bulletin/ apparently
* dh` dum today it seems
<discocaml> <Kali> ok, bin/main.ml
<Anarchos> twobitsprite you can also align all the match on the same columns.
<twobitsprite> Kali: yep, I was just about to paste the link... the nesting has gotten worse since I last pushed :P
<twobitsprite> Anarchos: I like auto-indentation... I could manually fix it, but I know at some point I'm going to gg=G and fuck it all up again :P
<discocaml> <Kali> ok, well, it seems like the pattern here is to either
<dh`> I guess you can do "let result = foo in" "if is_error result then raise (Foo result) else ();"
<discocaml> <Kali> ``| Error (`Msg e) -> Util.log_err " string" e; ()``
<discocaml> <Kali> or
<discocaml> <Kali> `| Ok () -> do_thing ()`
<discocaml> <Kali> so, i would write a function that factors out this pattern
<dh`> and then continue at the same indent, and wrap the whole thing in a try
<dh`> use a custom exception Foo and maybe index it with all the distinct cases you need
<twobitsprite> dh`: I'm using an external library
<dh`> but that will also have all the other problems with exceptions, like you lose context when you catch them
<twobitsprite> Kali: I *think* I know what you mean... but could you pastebin an example?
<discocaml> <Kali> ```ocaml
<discocaml> <Kali> let check_err res string body = match res with
<discocaml> <Kali> | Error (`Msg e) -> Util.log_err (" " ^ string) e; ()
<discocaml> <Kali> | Ok () -> body ()
<discocaml> <Kali> ```
<discocaml> <Kali> actually, i would put res as the last argument
<discocaml> <Kali> then you can call it like
<octachron> Also for the SDL setup phase, I tend to advise to print the exception and raises an error
<discocaml> <Kali> actually no, ignore that for one second, let me open a pastebin thing
TCZ has joined #ocaml
<twobitsprite> octachron: that's kind of what I'm thinking for a check_err function
<octachron> I generally define an operator "let (<!>) v msg = match v with Ok v -> v | Error (`Msg e) -> Format.eprintf "Fatal error in %s:%s@." msg e; exit 2"
tomku has quit [Ping timeout: 252 seconds]
tomku has joined #ocaml
<dh`> that kind of thing is fine when you can just exit on error :-)
<twobitsprite> dh`: that's fine with me for now... if I can't initialize an SDL window, there's really no reason to continue running...
<octachron> Yes, that's my point: there is no recovery for your graphical application if the OS decided that today you cannot open a windows.
<dh`> that is true, but it's not the general case
<twobitsprite> octachron: would exit 2 be better than just raising an uncaught exception?
<twobitsprite> dh`: fuck the general case
<dh`> yes, uncaught exceptions look to users like program bugs
<twobitsprite> dh`: ok..... it probably is a bug
<octachron> If you have an error message, it would be more informative than the uncaught exception
<twobitsprite> octachron: ok, I'm migrating from Python, are uncaught exceptions not very useful for tracking down bugs?
<dh`> they are not, no
<discocaml> <Kali> very unuseful
<dh`> in particular they don't print traces by default
<twobitsprite> ah, ok
<discocaml> <Kali> unless compiled with debug mode they don't even print traces or line number
<discocaml> <Kali> yeah
<twobitsprite> ... by default? implying they *can* produce tracebacks?
<dh`> anyway it is ok to exit if you can't open a window but you may not want to just exit from a game that someone's been playing an hour or two if you get a random OS error
<dh`> my recollection is that there's some way to, but I might be thinking of haskell exceptions
<twobitsprite> I literally just started this project last week... so I'm ok with being more dev-friendly than user-friendly
<octachron> dh`, it is a quite general case that on an inconsistency error you want to reach a point in the call stack where you can tear down the inconsistent context
<octachron> OCAMLRUNPARAM=b will display the trace
<twobitsprite> dh`: have you played any modern games? Bethesda, for example, is notorious for just crashing games, forcing you to load the last auto-save :P
<twobitsprite> octachron: is there a way to enable that in the dune file?
<dh`> oh sure, but a lot of games attempt an autosave before crashing
<twobitsprite> dh`: save a potentially corrupted game-state?
<dh`> at least if they hit an error rather than just segfault
<dh`> twobitsprite: as long as it doesn't overwrite the previous autosave, why not?
<discocaml> <Kali> twobitsprite: you can either use OCAMLRUNPARAM=b or execute `let () = Printexc.record_backtrace true` at the entry point of the code
<octachron> With OCAMLRUNPARAM being an environment variable
<twobitsprite> dh`: then the user tries to load the most recent save and it crashes again... now we're back to it "looks like a bug to the user"
Anarchos has quit [Quit: Vision[]: i've been blurred!]
<dh`> if you crash because of a corrupted game state it _is_ a bug
<twobitsprite> Kali: ok, so as a developer, which is more useful: print the error and "exit 1" or enable tracebacks and let exceptions go uncaught?
<dh`> octachron: yes, in general you can't just exit on error so you have to unwind somehow
<twobitsprite> dh`: it's a bug either way, though, right?
<dh`> yes
<dh`> but there's also stuff like transient OS errors, or you go to autosave and discover a disk full condition, or whatever
<twobitsprite> I'm not making a triple-A game, it's just a personal pet-project to write a simple roguelike... dev-friendly takes priority for me right now
<dh`> and in particular "I can't open a window today" is almost certainly not _your_ bug
<dh`> sure
<twobitsprite> dh`: what would you do on a disk full condition?
<dh`> my recommendation would still be to put at least some thought into this so you don't have to go refit the whole thing later (unless you give up on it before you get that far I guess)
<dh`> twobitsprite: maybe alert the user but definitely don't crash
<twobitsprite> either way, whatever, I'm not going to use this everywhere, just in areas that should always work unless there's a bug in the code. I can add specific error handling for things like creating save files
<discocaml> <Kali> twobitsprite: i would use the `failwith` function which does both at once (print string, exit program)
<twobitsprite> Kali: ahh, nice, I didn't know that was a thing, thanks
<discocaml> <Kali> well, more specifically, it raises the Failure exception with the string you pass it
<dh`> anyway if exiting on error is ok there's a variety of things you can do to avoid the increasing indent
<dh`> if it's not, things get harder
<twobitsprite> exiting on error is ok in most cases. exceptions are exceptions and can be handled the hard way
cr1901 has quit [Read error: Connection reset by peer]
<discocaml> <Kali> twobitsprite, i tried rewriting the event_loop function on github to be much nicer: https://paste.centos.org/view/f8c98de0
<discocaml> <Kali> see how it looks (or if it even works)
<twobitsprite> Kali: I'll check it out, but here's my attempt: https://github.com/memotype/olarn/blob/test/bin/main.ml
<twobitsprite> Kali: I'm not familiar with the "let ( let* ) ..." syntax... are the parens there because of the "*"?
<discocaml> <Kali> the parentheses are because you are defining an operator (in this case, a let operator)
<twobitsprite> ah, ok
<discocaml> <Kali> just like if you were to define `let (+) a b = ...`
<twobitsprite> I know I should learn that kind of stuff soon, but for now, I think my check_err is good enough
<twobitsprite> I very much appreciate the help though
<discocaml> <Kali> it seems like you gave up on error messages, which my version preserves
<twobitsprite> mine still prints error messages: https://github.com/memotype/olarn/blob/test/lib/util.ml
<discocaml> <Kali> oh, i mean that it seems like you left out the custom error messages from before and are just directly printing the error message in `Msg
<discocaml> <Kali> `" Sdl.set_render_draw_color: %s"`, `" Sdl.render_clear: %s"` and so forth
<twobitsprite> Kali: yeah, that's true... I like your solution, but I don't really understand it, so I don't want to use it until I get to learning that part of the language better. I'm definitely saving it in my notes file though
bartholin has quit [Quit: Leaving]
<discocaml> <Kali> although, come to think of it, mine is almost certainly too complicated for the job since you don't depend on any values of Ok
<discocaml> <Kali> it's just Ok () -> ()
<discocaml> <Kali> so you don't even need anything fancy
<discocaml> <Kali> actually, just ignore mine, haha
<discocaml> <Kali> instead, do ```ocaml
<discocaml> <Kali> let check_err fmt res = match res with
<discocaml> <Kali> | Error (`Msg e) -> log_err (" " ^^ fmt) e; exit 1
<discocaml> <Kali> | Ok r -> ()
<discocaml> <Kali> ```
<discocaml> <Kali> then you can just call it like `check_err "Sdl.set_render_draw_color: %s" @@ Sdl.set_render_draw_color rend 0 0 0 255;`
<twobitsprite> Kali: actually, I am using the Ok value in window.ml: https://github.com/memotype/olarn/blob/test/lib/window.ml
<twobitsprite> but it seems to work this way too
<discocaml> <Kali> oh, oops, then change the `Ok r -> ()` to `Ok r -> r`
<twobitsprite> that's what I have
<discocaml> <Kali> yeah, but that's what i had done by mistake
<twobitsprite> ahh, np
<dh`> what's the precedence of that comma in your let*?
<discocaml> <Kali> comma has lowest precedence of pretty much anything
<discocaml> <Kali> `f a, b` is `(f a, b)`, in this case
<discocaml> <Kali> only things with lower presedence are <-/:=, if, and ;
<dh`> you wrote: let* () = op args, message in
<discocaml> <Kali> yes? that is intentional
<dh`> so that groups as let* ( ( () = op args ) , message)
<dh`> ?
<dh`> and the message gets transported to the second element of the tuple in the let* declaration?
<discocaml> <Kali> no, that groups as let* () = ((op args), message)
<discocaml> <Kali> `let* x = v in expr` is syntax for `( let* ) v (fun x -> expr)`
<discocaml> <Kali> v here is `((op args), message)`
<discocaml> <Kali> `x` is `()`
<discocaml> <Kali> `expr` is whatever's after `in`
<discocaml> <Kali> now note the definition of `let*`
<dh`> ah, I see, so the () or whatever pattern is actually injected as a lambda around the body
<dh`> which makes sense I suppose, just strange to look at
cr1901 has joined #ocaml
<dh`> as it is it looks like either a type error or binding the result of the whole thing including the body, but both are obviously incorrect readings
<dh`> I'm wondering if there's a way to stuff in cleanup code that isn't excessively ugly
<twobitsprite> what's a better work-flow than: dune build; ./_build/default/bin/main.exe ? is there a single command to byte-compile and run?
<dh`> maybe let* x = op args, begin fun err -> cleanup; err end in
<dh`> still kinda ugly, wants more magic syntax
<twobitsprite> the magic syntax I want is pipes...
<dh`> there's |>
<twobitsprite> like, in my case, turning << check_err (Sdl.render_clear rend); >> into << Sdl.render_clear rend |> check_err >> ?
<dh`> yes
<twobitsprite> ooooh
<dh`> but beware, it doesn't increase legibility as much as you might think
<twobitsprite> Sdl.set_render_draw_color rend 0 0 0 255 |> check_err;
<twobitsprite> Sdl.render_clear rend |> check_err;
<twobitsprite> Sdl.render_present rend;
<discocaml> <Kali> f @@ x = f x
<discocaml> <Kali> x |> f = f x
<twobitsprite> looks much better to me XD
<dh`> for that, yes it does
<twobitsprite> what is @@?
<dh`> like $ in haskell
<discocaml> <Kali> exactly what i said
<dh`> has no effect but changes the binding
<discocaml> <Kali> yes like $
<dh`> that is, foo x @@ bar y is the same as foo x (bar y)
<twobitsprite> so, like "apply" in other langs?
<twobitsprite> oh
<dh`> s/binding/precedence/
<discocaml> <Kali> it's for losing parentheses
<discocaml> <Kali> g x @@ f x = g x (f x)
<twobitsprite> I see
<twobitsprite> Seems like that would have even more readability problems than |>
<dh`> with $ in haskell you get used to it eventually
<dh`> but haskell has its own readability problems :-)
<discocaml> <Kali> it is right associative, so f @@ g @@ h x is f (g (h x))
<dh`> haven't much experience with the ocaml manifestation, tend to not use it myself
<twobitsprite> yeah, weird associativity issues abound in Haskell
<twobitsprite> point-free form sounds great until you end up n-levels deep and start drawing parameter diagrams :P
<dh`> the conclusion I came to long ago is: never write in point-free style
<twobitsprite> unless you're trying to impress the review board on your academic paper *eyeroll.gif*
<dh`> (with a few exceptions maybe for certain kinds of combinator libraries that maybe themselves aren't great ideas)
<discocaml> <Kali> i have heard it sometimes called "pointless style"
<twobitsprite> (b-b-but, muh lambda calculus theories!)
<dh`> I have more or less settled into writing compiler code in a somewhat verbose but very explicit dialect of ocaml and I think it's better that way
<dh`> hee
<twobitsprite> sometimes I get an error when quitting... should I just add a 0.1 sec sleep after destroying the window? https://termbin.com/t4jt
<twobitsprite> or maybe make the Sdl.quit an atexit thing?
<dh`> that looks like you're exiting while other threads are running and doing graphics ops
<dh`> doesn't really matter if you're crashing but for an orderly exit you really want to shut down everything first
Serpent7776 has quit [Ping timeout: 265 seconds]
<twobitsprite> dh`: I have no threads, just a basic event loop that prints the mouse and keyboard events
<twobitsprite> and I tried adding a sleep between destroying the window and exiting, and I still get the error about half the time.
<twobitsprite> all I'm doing is clicking the X in the window controls
<dh`> hmm
<dh`> oh wait, you're closing the window from the window manager?
<twobitsprite> yeah
<dh`> then the window goes away on you asynchronously and you may not be able to avoid generating the warning
<dh`> or if you can it might require hacking SDL
<dh`> I wouldn't worry about it
<twobitsprite> ok, as long as it's not leaving video hardware in some weird state
<twobitsprite> it hasn't caused any problems yet, but since I am interfacing with a C library that does hardware stuff, I'm just a bit paranoid
<dh`> even on linux sdl shouldn't be able to mess up the video hardware
<dh`> especially if it's not running fullscreen
mjs22 has joined #ocaml
<dh`> (and fullscreen the worst you're likely to get is your program crashing and leaving the console in the wrong video mode, which as long as you're using "kernel mode setting" you can fix without needing to reboot)
TCZ has quit []
<twobitsprite> I'm not using fullscreen yet, but that's kind of what I'm worried about in the future. I guess I'll see how it goes.