<discocaml>
<speeddart> What would be the best libraries to assist in writing a sever that uses both websocket connections and good ol http requests (with either html or json response)?
<companion_cube>
dream I guess?
ehrt74 has joined #ocaml
azimut has joined #ocaml
ehrt74 has quit [Remote host closed the connection]
azimut has quit [Ping timeout: 240 seconds]
azimut has joined #ocaml
andrzejku has joined #ocaml
<greenbagels>
mmmmm
<andrzejku>
hello
<andrzejku>
:)
<greenbagels>
so im writing a function to take a list and make a list of all pair-wise combinations of elements of the list
<greenbagels>
so like [1; 2; 3] -> [(1, 2); (2, 3); (1, 3)]
<greenbagels>
the first solution that comes to mind is just to like, map each element to a list like [1; 2; 3] ↦ [[(1, 2); (1, 3)]; [(2, 3)]; []]
<greenbagels>
and then flatten
<greenbagels>
would this be... bad for long lists?
<greenbagels>
since it would take linear stack space
<greenbagels>
(but it has a very simple implementation so its tempting)
<greenbagels>
sorry not linear stack space, quadratic stack space*
<greenbagels>
i guess the solution is just to define a tail recursive flatten myself
andrzejku has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
andrzejku has joined #ocaml
alexherbo2 has joined #ocaml
Tuplanolla has joined #ocaml
<greenbagels>
and... it turns out that i didnt need to do that anyway :)
bartholin has joined #ocaml
andrzejku has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rgrinberg has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
alexherbo2 has quit [Remote host closed the connection]
rgrinberg has joined #ocaml
<discocaml>
<commutativeconjecture> for type systems, you can often be "macro based" or "symbolic". like, if you think of polymorphism: you can implement it in the OCaml way, where type parameters in type polymorphic expressions are treated symbolically. this lets typecheck a fully abstract / non-instantiated polymorphic expression. but you could also do it C++ template / C macros style, where you only type check ground terms, once polymorphic expressions have bee
<discocaml>
<commutativeconjecture> i'd like to have a systematic study of those two approaches. typically, i'd like to go for a lang with a rich and strong type system on ground terms, but macro-based approach for its polymorphism, row polymorphism, static evaluation, etc.
<discocaml>
<commutativeconjecture> any idea of things i should look for to find out more about these?
<discocaml>
<commutativeconjecture> (i'm also interested in mixture of these. like, you already perform some checks on polymorphic expressions, but can find out more errors when applying types to them)
average has joined #ocaml
waleee has joined #ocaml
waleee has quit [Ping timeout: 240 seconds]
waleee has joined #ocaml
alexherbo2 has joined #ocaml
<discocaml>
<froyo> re runtime in c: another good advantage of having it in c is being able to run ocaml on platforms it doesn't target natively, like plan9
<discocaml>
<froyo> you could maintain two separate runtime codebases but why
alexherbo2 has quit [Ping timeout: 250 seconds]
alexherbo2 has joined #ocaml
alexherbo2 has quit [Remote host closed the connection]
alexherbo2 has joined #ocaml
alexherbo2 has quit [Remote host closed the connection]
alexherbo2 has joined #ocaml
alexherbo2 has quit [Remote host closed the connection]
<discocaml>
<speeddart> Does dream have websockets extension? Couldn’t find
<discocaml>
<speeddart> Looks like it’s the sort of thing that would be in a different package anyways
<discocaml>
<speeddart> Websocket-lwt-Unix?
waleee has quit [Ping timeout: 252 seconds]
<greenbagels>
hmm
<greenbagels>
is it better to profile bytecode first instead of native code? or is it a kind of apples to oranges kinda comparison
<greenbagels>
the example perf output on https://ocaml.org/docs/profiling seems to indicate a large portion of output lines might just be internal gc functions
<greenbagels>
oh
<greenbagels>
i guess that page is out-of-date
cedric has joined #ocaml
cedric has quit [Quit: Konversation terminated!]
<companion_cube>
Don't profile bytecode, it's slow and non optimized anyway
<companion_cube>
If you care about perf, profile the native version, compiled in release mode
<greenbagels>
companion_cube: ok so question: im using ocamloptp to generate profiling data; but is there a tool that prints not just execution counts for code paths, but samples time spent in each path?
<greenbagels>
i see that the -p flag no longer exists (i think i read a message saying after 4.08?)
<companion_cube>
Hmm for paths in the code I don't know
<companion_cube>
Just use perf
<companion_cube>
If you're on Linux :)
<discocaml>
<froyo> honestly perf kinda sucks with ocaml... like I know we got demangling support upstream and all that and tried to make it work nicely but... it still sucks and misleads a bit especially with higher order functions involved and the like
<discocaml>
<froyo> imagine a world where we have a first-class native ocaml profiler & debugger
<discocaml>
<froyo> perf would be what I'd use today though yeah
<discocaml>
<froyo> for gc stuff I think olly looks cool but haven't tried it personally
<greenbagels>
demangling with perf? does perf show internal symbol names, not just external ones?
<discocaml>
<commutativeconjecture> in the same vein, what is the recommended way to debug code in ocaml end-of-2023?
<discocaml>
<froyo> greenbagels: demangling as in `camlExample.function_name_421_332` becomes `Example.function_name`
<discocaml>
<froyo> runtime names do show in the report yes
<discocaml>
<froyo> if that's what you mean by internal
<companion_cube>
Debugging is still hard
<discocaml>
<commutativeconjecture> sad, but thx for update
<companion_cube>
I use tracing tools and instrumentation but it's a personal preference
<discocaml>
<commutativeconjecture> i do ppx show + printf every where + git reset --hard
<discocaml>
<froyo> hahaha classic git reset hard
* discocaml
<commutativeconjecture> -10 engineer
oriba has joined #ocaml
<discocaml>
<bluddy5> IMO this is OCaml's biggest weakness in 2023
<companion_cube>
Lack of debugger? Perhaps, yes
<companion_cube>
That, or the really complex tooling
<discocaml>
<bluddy5> The tooling is ok. Lack of debugger is painful. I'm so much more efficient in python just because I can step to a particular place in the code and examine exactly what's going on.
<discocaml>
<bluddy5> or in c++ etc
<companion_cube>
Tbh when I write rust I still don't use a debugger... Probably because I'm not used to it
wingsorc has joined #ocaml
andrzejku has joined #ocaml
<discocaml>
<._null._> One can use ocamldebug on Coq, and I am very grateful for that
<discocaml>
<._null._> It's also the only reason I use emacs
andrzejku has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
andrzejku has joined #ocaml
andrzejku has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
andrzejku has joined #ocaml
andrzejku has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
andrzejku has joined #ocaml
andrzejku has quit [Client Quit]
andrzejku has joined #ocaml
andrzejku has quit [Client Quit]
justache is now known as justResolute
justResolute is now known as justIrresolute
<discocaml>
<functionalprogramming> i dont think the the C++ template parameter-substitution is very interesting
<discocaml>
<functionalprogramming> i would not call it "macro-based"; it is just monomorphization. I think Golang (used to?, before Go generics were a thing) have a similar thing where its just a codegen tool
<discocaml>
<functionalprogramming> why
<discocaml>
<functionalprogramming> why wouldnt you want all the checks so that there is no "substitution failure" and no chance of finding more errors if specializing
neiluj has quit [Remote host closed the connection]
duncan has joined #ocaml
<discocaml>
<commutativeconjecture> because the world is made of trade-offs. the more powerful i want the static things to be, the _even more_ powerful a type system that covers them needs to be. it becomes less of a type system, and more of a general automatic theorem prover about the behaviours of codegen programs.
neiluj has joined #ocaml
trillion_exabyte has quit [Ping timeout: 252 seconds]
trillion_exabyte has joined #ocaml
<companion_cube>
Also see how rust is not fully caught up to C++'s templates
<discocaml>
<functionalprogramming> ah
<discocaml>
<functionalprogramming> idk what u want but sounds fun
<discocaml>
<contificate> let's hope it doesn't catch up
<discocaml>
<commutativeconjecture> ~~fundamentally, all i want is coc + type:type~~
<companion_cube>
Not trying to rain on your parade but doesn't coc mean you need both compile time evaluation, and some notion of erasure?
trev has quit [Quit: trev]
cocomo has joined #ocaml
neiluj has quit [Quit: neiluj]
rgrinberg has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
neiluj has joined #ocaml
bartholin has quit [Quit: Leaving]
neiluj has quit [Quit: neiluj]
dnh has joined #ocaml
<discocaml>
<speeddart> I am new to OCaml, are there absolutely no debuggers? Or no hood ones?
<discocaml>
<speeddart> I am new to OCaml, are there absolutely no debuggers? Or no good ones?
EmoSpice has joined #ocaml
<discocaml>
<._null._> There is ocamldebug which comes with the compiler, but it doesn't have support in VSCode
<discocaml>
<._null._> It has a gdb-like interface
<EmoSpice>
Good evening - I have a dune project I am building with nix. It is failing because I dont have git in the install phase ("Error: program git not found in the tree or in PATH"). Can someone explain to me why dune is looking for git?
<discocaml>
<speeddart> Ah ok
<discocaml>
<speeddart> At the very least, I would think you need a debugger less often in a functional language
<EmoSpice>
(Google/DDG has been particularly unhelpful here, but I can confirm that the command run immediately before failure is a `dune install` invocation)
<greenbagels>
are List.rev_merge and List.rev_merge_rev child functions of List.rev
<greenbagels>
oh no, its in stable_sort
EmoSpice has quit [Ping timeout: 256 seconds]
cocomo has quit [Ping timeout: 255 seconds]
cocomo has joined #ocaml
dnh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
azimut has quit [Ping timeout: 240 seconds]
mal`` has quit [Quit: Leaving]
dnh has joined #ocaml
<discocaml>
<leostera> when using `Effect.Shallow.discontinue_with`, it seems like I can't match on the exception and continue executing with the same effect handlers 🤔
<discocaml>
<leostera> maybe that's not right, the effects I'm performing aren't failing with "unhandled"
<discocaml>
<leostera> but they don't seem to be doing anything
dnh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]