Leonidas changed the topic of #ocaml to: Discussion about the OCaml programming language | http://www.ocaml.org | OCaml 4.13.0 released: https://ocaml.org/releases/4.13.0.html | Try OCaml in your browser: https://try.ocamlpro.com | Public channel logs at https://libera.irclog.whitequark.org/ocaml/
quartz has joined #ocaml
<quartz> Sorry for asking this again, but I have let square x = x * x;; What is the significance of val square : int -> int = <fun>
<quartz> Specifically, what is the -> used for here?
<companion_cube> Function type
<companion_cube> Int to int
<quartz> So the function accepts an int and returns an int?
<companion_cube> Yep
<quartz> So the -> has no significance in OCaml programming specifically? Like it's not an operator or anything
<olle> It does
<olle> It's the difference between type level and value level, I think
* olle zzz
<d_bot_> <NULL> It depends what you mean with "significance"
<d_bot_> <Pim> Yep -> is a function at type level
<quartz> OK thanks. I'm new obviously to OCaml
<d_bot_> <NULL> It is used as the function type operator, in type expressions, and is also part of the `fun <pat>* -> <expr>` syntactical construct for lambdas
olle has quit [Ping timeout: 240 seconds]
vicfred has quit [Quit: Leaving]
gentauro has quit [Read error: Connection reset by peer]
gentauro has joined #ocaml
humasect has joined #ocaml
humasect has quit [Read error: Connection reset by peer]
<quartz> Can someone explain this code? https://bpa.st/DSNQ
<quartz> Why are they returning first by using ->
<d_bot_> <NULL> I forgot this construction when listing off uses of `->`
<d_bot_> <NULL> I can't really tell you "why", I don't know what the function should do
<quartz> d_bot_: Why are you messages preceded by <NULL>
<d_bot_> <NULL> NULL is my name, dbot is because it's the Discord bridge
<quartz> You're communicating through IRC via Discord?
<d_bot_> <NULL> Yeah, the channels are bridged by a bot
<quartz> Oh nice. why not just use an IRC client?
<quartz> weechat is nice
<d_bot_> <NULL> Not all channels of the Discord are bridged (only one actually) plus I am on a bunch of other Discord servers but no other IRC ones
<quartz> d_bot_: OK, sorry to bother you again, but can you explain line 4 of this code? https://bpa.st/HA3A
<quartz> It's trying to add hd (the head of the list), to the tail of the list (tl) and return the head plus another call to sum?
<d_bot_> <NULL> As I said, *NULL* is my name
<d_bot_> <NULL> How much do you know about pattern matching ?
<d_bot_> <NULL> I find lists aren't really the best way to introduce them
<quartz> NULL: I'm new to pattern matching, it's something that is not seen in Java or C
<d_bot_> <NULL> I guess this https://ocaml.org/learn/tutorials/data_types_and_matching.html should be a good way to learn about it
<Corbin> quartz: In Java and C, there are switch-statements, right? We can take certain values, like unsigned ints, and compare them to see if they're 0, or 1, or 2, or etc.
<quartz> Corbin: Right.
<Corbin> In OCaml, we can switch, or "match", on other values too. In this example, we're examining a list. A list is either `x :: xs` or `[]`, and that's why those operators show up as patterns.
<Corbin> The idea is that, in an expression, something like `x :: xs` builds a list; so in a pattern, it should un-build a list somehow.
<quartz> Corbin: I don't understand how you can match 'l' with hd :: tl or what that even means.
<Corbin> quartz: Well, let's go in the other direction first. Suppose I said something like `let l = hd :: tl in ...` this means that we're taking two values `hd` and `tl`, and making a new value `l` which glues them together.
<d_bot_> <NULL> Read the link I gave and you should understand hopefully
<d_bot_> <NULL> NB: `(::)` is an infix constructor
<Corbin> Going in the other direction, `match l with | hd :: tl -> ...` means that we're starting with a value `l`, and we're going to pull it apart into two values `hd` and `tl` which were glued together before. (And maybe this fails, because not all lists have a head! Just like a switch statement, OCaml will try each of the patterns in sequence.)
<Corbin> Yes, as NULL says, the `::` operator is actually acting as a constructor. Pattern-matching proceeds by looking at how a value was constructed; it lets us see which constructor was used.
<sleepydog> quartz: if you are familiar with python, it is similar to destructuring assignment in python, where you can do a, b, c = some_list, except here it's being used conditionally
<Corbin> sleepydog: Python recently gained a pattern-matching feature: https://www.python.org/dev/peps/pep-0634/ It's good to compare apples to apples.
<quartz> Corbin: OK thanks for the explaination
<Corbin> quartz: Does it make sense how this would work with your own custom datatypes?
<quartz> So let l = hd :: tl will make l into a list [hd; tl] ?
<sleepydog> Corbin: not everyone is familiar with that, though. it's a pretty new feature.
<quartz> Corbin: My own custom datatypes? You mean the example?
<quartz> Yeah sorry not familiar wit python, just C and Java mainly.
<companion_cube> https://paste.isomorphis.me/X2x for example
<companion_cube> first, a simple switch on integers
<companion_cube> then, matching on tuples (a bit like destructuring in python)
<Corbin> quartz: NULL linked to a good tutorial page.
<companion_cube> then, your own custom type, where you have a choice
<quartz> Corbin: I'll take a look
<quartz> companion_cube: Thanks for the example.
<companion_cube> this kind of "sum type" (of which lists are an instance) is an important part of why OCaml is so powerful
<d_bot_> <NULL> If you're familiar with C, sum types are C union where the compiler is the one who manages which case we're in (through constructors)
<companion_cube> union + an enum as the tag, mostly
<companion_cube> all in a type safe way
<d_bot_> <NULL> C has enums ?
<companion_cube> sure
<sleepydog> heh
<companion_cube> they're basically ints, but yes
<d_bot_> <NULL> Didn't know, but I never went deep into C anyway
<companion_cube> (oh and also the switch falls through by default, which is hilariously bad)
<sleepydog> it doesn't have "real" enums, they're ints. so you don't get exhaustiveness checks
<companion_cube> yeah
<sleepydog> though maybe you could come up with the right combination of gcc flags to get it
<companion_cube> C++ did get proper enums I think
<sleepydog> since learning ocaml i've been annoyed when i don't have sum types or pattern matching available. so i'm very pleased that python is getting pattern matching
<d_bot_> <NULL> I know that, and the fact that other languages kept that as standard behaviour is also laughable
<d_bot_> <NULL> that: fallthrough switches
<companion_cube> it's slowly evolving, woo
<companion_cube> see: rust
<Corbin> Fallthrough was very important to assembly programmers, both for speed, and also because it's what lots of CPUs do by default. Similarly, Python didn't have pattern-matching because the semantics weren't any better than the "tower of if-statements" pattern.
<d_bot_> <NULL> They could provide fallthrough switches through an additional keyword, but it has so few uses I don't understand why they would not provide regular switch before/at the same time
<Corbin> Sum types are kind of like a design pattern; there's several different ways to implement them, even if they aren't builtin. In Java, sum types can be emulated with subclasses and the visitor pattern. OCaml (used to? still does?) have special bytecode instructions for working with sum types, to make them faster.
<companion_cube> @NULL exactly
<companion_cube> the rare case where you need fallthrough should be opt-in
<sleepydog> i guess some of the C creators would agree, since that was changed in Go
<Corbin> sleepydog: That's not unreasonable. We *did* find a construction that depends on it, but it's not common: https://en.wikipedia.org/wiki/Duff%27s_device
<companion_cube> well there's no overlap, sleepydog, afaik
<sleepydog> companion_cube: ken thompson was at least tangentially involved
<quartz> Hello. I'm having trouble understanding what this problem is asking when it says "we allow the caller to define what f describes the sum"
<quartz> Why would they want to return a function, when it should return an int?
<sleepydog> this looks like homework :)
<quartz> sleepydog: Yes it is.
<Corbin> quartz: Maybe they mean "which f". They're saying that the caller of psum should get to choose a function f, and psum should call f in order to do its summation work.
<Corbin> Er, oh, I see. That *is* confusing. They mean that psum should call f, then do a sum, then call f, then do a sum, then call f...
<sleepydog> that is my interpretation too, the language is a little awkward
<Corbin> quartz: As a first step, what's the type of psum? Figuring this out will make things a lot easier.
<Corbin> ...Oh, they gave it away at the bottom. So much for reading comprehension.
<quartz> Corbin: A function that takes two functions as a arguement?
<quartz> Yeah I saw that :)
<d_bot_> <NULL> No it doesn't, it only takes one
<quartz> Ahhh
<d_bot_> <NULL> What do you think the type of the addition operator is, and do you understand why ?
<quartz> Jeez I can't even read
<d_bot_> <NULL> Or are you familiar with how curried function types are read ?
<Corbin> quartz: A function and an int. Your TA's parentheses might be a little confusing; it's an instance of a type like `x -> y -> z` which takes two arguments, written like `x -> (y -> z)`.
<quartz> psum: (int -> int) -> (int -> int) means it takes a function that returns an int and returns a function that returns an int?
<quartz> NULL: I need to review those. This is the most confusing programming language ever, sorry.
<d_bot_> <NULL> You aren't mentioning the types of the arguments, but that's what it is
rgrinberg has joined #ocaml
<d_bot_> <NULL> This is directly inherited from λ-calculus, it doesn't fall out of nowhere
<quartz> Corbin: I'm not sure what you mean by that.
<quartz> I don't understand why you'd need two functions here. It just starts at 1, multiplys it by itself, adds 1 to it, multiplies it by itself, and repeats the process all the way up to n which is the value passed into the function.
<d_bot_> <NULL> I think you're expected to program `λf λn. Σ_{i=1}^n f(i)`
<sleepydog> it is a contrived question. of course you could solve the problem with 1 function. but they must want you to become familiar with functions that build other functions.
<sleepydog> examples where it is actually more useful could involve more code and become distracting
<d_bot_> <NULL> One such better example would be a counter (it involves references though)
<Corbin> quartz: The arrow (->) is right-associative; if you have a type like `x -> y -> z -> w` then it should be read as `x -> (y -> (z -> w))`. OCaml has ways of smoothing over these two different views of (->).
<sleepydog> Something tells me that pulling back the curtains of how "multiple" args work in ocaml is just going to confuse at this point :)
<quartz> sleepydog: I'm confused enough as it is.
<Corbin> quartz: Do you think that you could write this with just one function? It might not be the final answer, but it could help you get there.
<quartz> Corbin: I can try, but I'm getting tired and angry. I didn't think this would be this hard.
<Corbin> No worries. It's okay to take a break.
mbuf has joined #ocaml
waleee has quit [Ping timeout: 250 seconds]
<quartz> Sorry I can't get it, even with a for loop
<d_bot_> <NULL> In what languages can you do it ?
<quartz> Java, C
<quartz> But I need to do it in OCaml
<d_bot_> <NULL> What would it look like (with no newline because IRC) ?
<quartz> I'm trying
<quartz> to do it with a for loop in OCaml
<sleepydog> can you implement a simpler function that just adds the numbers 1 to n, without the `f` part?
<d_bot_> <NULL> I'm proposing you to start from another language and work your way to OCaml
<quartz> Uhhh
<quartz> I can try
<quartz> But how is this not working? https://godbolt.org/z/z4rde8cTb
<d_bot_> <NULL> Local definitions take the shape `let <lvalue> = <expr> in <expr>`
<d_bot_> <NULL> As opposed to toplevel/module-level definitions that are only `let <lvalue> = <expr>`
<quartz> So how are you suppose to declare variables in this language?
<sleepydog> if you are thinking of a variable as something you can modify, you create a reference
<d_bot_> <NULL> *mutable* variables ? You can't. The only things you can mutate are fields of structs that have been declared mutable
<d_bot_> <NULL> The most common workaround is using a reference, which behaves very close to a mutable variable
<d_bot_> <NULL> So you first give yourself a reference `let r = ref 0 in ...` (0: default value, give yours)
<d_bot_> <NULL> Then you assign to it using `r <- <expr>`
<quartz> I'm taking notes.
<d_bot_> <NULL> And you get the contents of it by prefixing a `!` (so `!r` is the contents of `r`)
<sleepydog> if it's a `ref`, assignment would be `r := ...`
<d_bot_> <NULL> You won't be able to mix up a reference with a regular int because they don't have the same type: a reference to an int has type `int ref` and not `int`
<d_bot_> <NULL> sleepydog: oops right, `<-` is field assignment; `(:=)` is the more direct assignment for references
<quartz> I think I'm going to call it a night, but thank you everyone for your help.
<quartz> Brain is shutting off, even though I want to continue.
quartz has quit [Quit: WeeChat 3.4]
terrorjack has quit [Quit: The Lounge - https://thelounge.chat]
terrorjack has joined #ocaml
azimut has quit [Remote host closed the connection]
azimut has joined #ocaml
hsw has joined #ocaml
gravicappa has joined #ocaml
zebrag has quit [Quit: Konversation terminated!]
hackinghorn has quit [Quit: Leaving]
Haudegen has joined #ocaml
mbuf has quit [Quit: Leaving]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
azimut has quit [Remote host closed the connection]
azimut has joined #ocaml
GreaseMonkey has quit [Read error: Connection reset by peer]
dextaa_ has joined #ocaml
dextaa_ has quit [Remote host closed the connection]
<d_bot_> <Bluddy> I need to parse a binary file gradually: part of it is LZW compressed, part needs to be interpreted into a record. What's the best way to do this? Currently I'm trying to create a char Seq from the file buffer. When I need to read either a byte or a 16-bit word from the file, I read 2 chars and put them into a Byte, then use get_uint16_le or get_uint8. Any other ideas?
<d_bot_> <Bluddy> I don't think @companion_cube's Iter can work for this, though I could be wrong.
<d_bot_> <Bluddy> What I want is:
<d_bot_> <Bluddy> * The ability to pull bytes out of a byte stream
<d_bot_> <Bluddy> * The ability to have stages of processing: The LZW decompression is fed to another decompression algorithm. I don't want to manage buffers for this.
<d_bot_> <Bluddy> * The ability to continue with processing the rest of the byte stream normally after the decompression area is done with
<d_bot_> <Bluddy> Also, efficiency is not a major consideration here.
<d_bot_> <orbitz> @Bluddy is the bitstring package still around?
<d_bot_> <Bluddy> That's a really good idea for parsing headers and such, but it's not a solution for doing things like decompression.
<d_bot_> <Bluddy> I guess this is where @companion_cube's suggestion to have channels be flexible would fit in
mbuf has joined #ocaml
<haesbaert> Cstruct doing shifts and so on ?
olle has joined #ocaml
<d_bot_> <tomb> What about mapping the file to a bigstring (i.e. some flavor of bigarray with char elements), and implementing combinators of type `Bigstring.t -> pos:int -> ?len:int -> {pos : int; return : 'a} Result.t` for some value of `'a`. I guess the issue might be that when you enter an LZW context, you might want to consider the stream of data that it produces lazily, which does not compose well with the above...
<d_bot_> <Bluddy> yeah I'm thinking I want to just create some kind of BufferedStream structure.
<d_bot_> <Bluddy> we really need an OOP type here
<d_bot_> <tomb> IIRC, the way cryptokit's `transform`s are modeled (using objects and classes) makes it reasonably palatable to compose transformation. It makes it possible to push / pull elements and abstract nicely the internal buffers. I guess it would be interesting to try and adapt this to your setting.
<d_bot_> <Bluddy> It's a fairly standard structure. In C++, you have streams as the base classes, and they are inherited by file streams, string streams etc. The user reads or writes to a stream not caring if it's a file or a string or anything else.
<d_bot_> <Bluddy> We can emulate it with a record of functions and pass in 'self', or we can just use objects.
<d_bot_> <glennsl> does anyone know of a convenient way to convert rescript to OCaml?
<d_bot_> <glennsl> `rescript convert` doesn't seem to accept `.res` files
<d_bot_> <glennsl> I suppose worst case I could manually convert rescript to reason, and then convert reason to OCaml.
<d_bot_> <glennsl> And while trying to do so I discover that rescript doesn't actually have a valid representation in either OCaml or Reason because it uses reserved keywords and such.
<d_bot_> <glennsl> Which I guess is a big part of the reason why it split from Reason.
<d_bot_> <glennsl> SO I guess that answers that.
Serpent7776 has quit [Read error: Connection reset by peer]
mro has joined #ocaml
Serpent7776 has joined #ocaml
olle has quit [Remote host closed the connection]
perrierjouet has quit [Ping timeout: 256 seconds]
perrierjouet has joined #ocaml
mro has quit [Remote host closed the connection]
hackinghorn has joined #ocaml
klu has quit [Ping timeout: 245 seconds]
klu has joined #ocaml
klu has joined #ocaml
klu has quit [Changing host]
mro has joined #ocaml
mro has quit [Remote host closed the connection]
adanwan has quit [Remote host closed the connection]
adanwan has joined #ocaml
Haudegen has quit [Quit: Bin weg.]
hackinghorn has quit [Remote host closed the connection]
hackinghorn has joined #ocaml
gahr has quit [Quit: Lost terminal]
mro has joined #ocaml
Haudegen has joined #ocaml
adanwan has quit [Remote host closed the connection]
adanwan has joined #ocaml
mro has quit [Remote host closed the connection]
bartholin has joined #ocaml
olle has joined #ocaml
mro has joined #ocaml
<d_bot_> <sarna> hey, I'm trying to follow "building git" in ocaml instead of ruby. I'm stuck trying to get zlib to work - is there any *simple* API for zlib in ocaml?
<d_bot_> <sarna> I tried a couple but they either look like C (camlzip, zlib) or they have a very rigidly typed API that's not documented at all (decompress, carton)
gahr has joined #ocaml
gahr has quit [Remote host closed the connection]
mro has quit [Remote host closed the connection]
gahr has joined #ocaml
mro has joined #ocaml
<d_bot_> <jchavarri> this is what I ended up doing:
<d_bot_> <jchavarri> - go to https://rescript-lang.org/try convert to Reason syntax
<d_bot_> <jchavarri> - then convert to OCaml syntax either with refmt or with https://reasonml.github.io/en/try
<d_bot_> <jchavarri> it's a bit tedious, but most of the process is automated (modulo all the rescript + reason attributes and annotations removal)
<d_bot_> <jchavarri> as you mention, sometimes you have to manually change some words to make code compile (I especially remember `Promise.then` to `then_`)
<d_bot_> <jchavarri> i am pretty sure that Melange can convert rescript to reason or OCaml syntaxes as well
<d_bot_> <glennsl> Ah, thank you! I didn't realize the rescript playground still allowed that (it's under Settings, for those who might still wonder). I think that will do fine for my needs, but great tip about melange as well!
<d_bot_> <KW78> Doesn't this answer your question
<d_bot_> <KW78> `./lib/rescript.exe -print ml test.res # show ocaml code`
<d_bot_> <KW78> in
<d_bot_> <glennsl> @KW78 Unfortunately doesn't seem to work
<d_bot_> <glennsl> I found the binary, but it doesn't accept the `-print` flag
<d_bot_> <glennsl> It also doesn't accept just the filename, or anything else I've thrown at it
<d_bot_> <glennsl> And running it without any arguments just has it complaining that it can't find `bsconfig.json`
mro has quit [Remote host closed the connection]
dalek_caan has joined #ocaml
mro has joined #ocaml
<d_bot_> <KW78> I haven't used it but they imply it is a different repo / install for *syntax developers* which compiles to a ./lib/rescript.exe
<d_bot_> <KW78> Might be worth a try to go through the full install if you have lot of files
<d_bot_> <KW78>
<d_bot_> <KW78> Also you may want to ask on the Rescript forum
<d_bot_> <KW78> (and if it is done in the playground there must be a software somewhere)
mro has quit [Remote host closed the connection]
mro has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
<d_bot_> <romachkuna> can someone help me setup ocaml in vscode? i already downloaded ocaml64,added bin folder to the path, just cant seem to setup Ocaml in vscode using OcamlPlatform extension
<companion_cube> @Bluddy I find first-class modules useful for OOP style here
<d_bot_> <NULL> Launch vscode from within OCaml64's Cygwin console ?
<d_bot_> <romachkuna> how do i do that?
<d_bot_> <NULL> `code`
<d_bot_> <Bluddy> @companion_cube Do you have an example somewhere? I find them cumbersome but I'm willing to try.
<companion_cube> and the same for OUTPUT below
mro has quit [Remote host closed the connection]
mro has joined #ocaml
mro has quit [Remote host closed the connection]
quartz has joined #ocaml
mro has joined #ocaml
<d_bot_> <Bluddy> cool. Looks almost identical to using records + explicitly passing self.
<d_bot_> <Bluddy> but maybe it's a little cleaner
<companion_cube> it's a bit easier imho
<companion_cube> less namespacing to do
<companion_cube> you can hide state inside, etc.
<companion_cube> you can have a bigger (local) module and then cast it
<d_bot_> <Bluddy> yeah
<d_bot_> <VPhantom> I think I'm misunderstanding something from the stdlib (4.13): there's a `Uchar` module but we can't get those characters from strings nor append them to buffers or set them in bytes. 🤔
<companion_cube> you can append them to buffers
mro has quit [Remote host closed the connection]
<d_bot_> <VPhantom> Ah yes, good. But I can't read them from anywhere?
<companion_cube> `Buffer.add_utf_8_uchar`
<d_bot_> <Bluddy> @companion_cube I know you have the channel proposal going, but maybe it makes more sense to create a Stream library (unrelated to stdlib.Stream) using first-class modules and use that?
<companion_cube> it's not going anymore.
<d_bot_> <Bluddy> sure it is 🙂
<companion_cube> and also, a stream library has 0 usefulness since it's not what most functions consume
<d_bot_> <Bluddy> wasn't there a positive reaction to that PR?
<d_bot_> <Bluddy> also, other languages don't change their file handles, but build stream libraries and then use that... if you make it available, it might catch on
<companion_cube> it was just a RFC, oh well
<companion_cube> what other languages did that?
<companion_cube> afaik, most modern languages actually have an extensible notion of reader/writer
<companion_cube> see: Go, rust, notably
mro has joined #ocaml
mro has quit [Remote host closed the connection]
<d_bot_> <Bluddy> hmm... well I guess c++ is my main reference point
<d_bot_> <Bluddy> for this at least
<d_bot_> <Bluddy> java too I think
<d_bot_> <Bluddy> so not modern per se
<d_bot_> <darrenldl> that would be nice
<companion_cube> well, C++ has iostreams
<companion_cube> I don't remmeber for java but of course it must be objects/interfaces, right?
<d_bot_> <Bluddy> fair point. I guess in C++ they had to retrofit it...
<d_bot_> <Bluddy> which is what we want to do...?
<d_bot_> <Bluddy> I mean it's a little odd to just take channel and have it transparently be all these different things, no?
<companion_cube> I mean, they added their own extensible layer on top of C's existing FILE*
<companion_cube> why would it be? :/
<companion_cube> why couldn't a channel be a byte stream?
<companion_cube> given it's already the abstraction for a file, a socket, …
<d_bot_> <Bluddy> what if you want a buffered one? shouldn't it have something to distinguish it?
<d_bot_> <romachkuna> can someone tell me why when i type in utop #use "test.ml";; it doesnt copy the code? (which is in test.ml)
<companion_cube> channels are buffered
<d_bot_> <Bluddy> then unbuffered
<d_bot_> <Bluddy> I dunno for a typed language you'd imagine there would be some distinguishing type
<companion_cube> 🤷
<companion_cube> we don't have easy subtyping
<companion_cube> in general that's done by having an unbuffered Read, and a BufferedRead extending it
<companion_cube> and everyone using BufferedRead as soon as they can
<companion_cube> if you want unbuffered IOs you probably want to directly interact with a Unix.file_descr or something like that
<d_bot_> <orbitz> Implicit modules FTW!
<d_bot_> <Bluddy> this is one place where I think modifying channel is a hacky solution waiting for the right language feature
<d_bot_> <Bluddy> or just more performant OOP
<d_bot_> <Bluddy> but we can solve the problem in user space with the right library
<d_bot_> <orbitz> I think one issue is sub typing adds a lot of complexity that forcing people into accepting might be undesirable
<companion_cube> we can't, since the problem is that everyone takes in_channel and out_channel as parameter
<companion_cube> if you think people will adopt a new interface that's not even in the stdlib, you haven't looked at OCamlers :D
<d_bot_> <orbitz> They'll do it...only if they made it 🙂
<companion_cube> ^
mro has joined #ocaml
<companion_cube> look at ocamlnet's IO abstractions (OOP based), and BatIO, for existing examples
<d_bot_> <darrenldl> wonder if one can create in_channel via ffi (though it's a bandaid solution)
<companion_cube> no need for that, you just need a unix pipe! or a subprocess /s
<d_bot_> <darrenldl> just use temporary files as buffers to implement in/out_channel proxies
<d_bot_> <darrenldl> /s
<companion_cube> yep, that's the sad state of things
<companion_cube> also, you can't easily read from either a socket or a TLS socket
<companion_cube> cause they obviously need to be different things 🤔
<d_bot_> <darrenldl> seeme like one cannot use a file descriptor to make a channel either, hm
<d_bot_> <darrenldl> *stares at wall pondering if temp file is worth it*
<companion_cube> maybe Unix.pipe is the way :p
mro has quit [Remote host closed the connection]
<d_bot_> <darrenldl> oh wait no Unix provides in_channel_of_descr it seems(?)
<companion_cube> it does, yes
<companion_cube> (there's a very ugly global structure underneath, btw.)
<d_bot_> <darrenldl> *horrible idea emerges from reading memfd_create and mmap*
hackinghorn has quit [Ping timeout: 256 seconds]
mbuf has quit [Quit: Leaving]
mro has joined #ocaml
<d_bot_> <darrenldl> ugh, piping is really the only way as you said without breaching into C
zebrag has joined #ocaml
<d_bot_> <Bluddy> BatIO is nice!
<d_bot_> <Bluddy> companion_cube I think the main reason it wasn't adopted is that 90% of OCaml usage in the wild is compilers, and they just don't need, or think they need, the functionality.
<d_bot_> <Bluddy> you only realize you need it when you bump into it, and until then, you write your code without it
mro has quit [Remote host closed the connection]
<companion_cube> BatIO could have been kind of ncie, but no one uses it cause it's slow and non standard
<d_bot_> <Bluddy> Well why not come up with a nice light library? You kind of have a knack for these things...
<d_bot_> <Bluddy> Though I guess it does get tangled up with async stuff
<companion_cube> then we'd have a nice library with input and output buffer streams
<companion_cube> and 0 other libraries using it
<d_bot_> <Bluddy> Not if we promote it
mro has joined #ocaml
<companion_cube> "does it work with {async,lwt,eio}? no? oh well too bad"
mro has quit [Remote host closed the connection]
<d_bot_> <Bluddy> Right the async part is the issue
<d_bot_> <orbitz> This is why we need a stdlib scheduler! 🤣
<companion_cube> good luck with that one too!
Haudegen has quit [Quit: Bin weg.]
mro has joined #ocaml
<d_bot_> <monk> is there a way to pass a flag to dune to ignore a specific warning
<d_bot_> <monk> i don't want to disable the warning as failure generally
<d_bot_> <monk> i simply want to test something before refactoring a bunch of code that may become irrelevant
vicfred has joined #ocaml
mro has quit [Remote host closed the connection]
<sleepydog> alternatively you can add an (env) clause to your dune file which lets you pass compiler flags, and use that: https://dune.readthedocs.io/en/stable/dune-files.html#env
mro has joined #ocaml
mro has quit [Remote host closed the connection]
olle has quit [Remote host closed the connection]
bartholin has quit [Ping timeout: 256 seconds]
<sleepydog> something like `(env (nowarn (flags (:standard -w -A))))` , then `dune build --profile=nowarn` works
<d_bot_> <monk> running with `--profile=nowarn` is very close to what i want, thank you
<d_bot_> <monk> a lot nicer than commenting a bunch of code out just for a test run of a binary, etc
<d_bot_> <monk> without getting lazy and setting warnings off
rgrinberg has joined #ocaml
bartholin has joined #ocaml
olle has joined #ocaml
wonko has joined #ocaml
bartholin has quit [Ping timeout: 256 seconds]
bartholin has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
quartz has quit [Quit: WeeChat 3.4]
rgrinberg has joined #ocaml
hackinghorn has joined #ocaml
Haudegen has joined #ocaml
waleee has joined #ocaml
<d_bot_> <romachkuna> ```code /cygdrive/c/Users/UserName/AppData/Local/Programs/Microsoft\ VS\ Code/Code.exe``` can someone tell me why this isnt working? i cant launch vscode from cygwin terminal
dalek_caan has quit [Quit: dalek_caan]
Anarchos has joined #ocaml
mro has joined #ocaml
mro has quit [Remote host closed the connection]
rgrinberg has quit [Ping timeout: 245 seconds]
mro has joined #ocaml
olle has quit [Ping timeout: 256 seconds]
Anarchos has quit [Quit: Vision[]: i've been blurred!]
gwizon has joined #ocaml
Anarchos has joined #ocaml
wonko has quit [Ping timeout: 260 seconds]
mro has quit [Remote host closed the connection]
Anarchos has quit [Quit: Vision[]: i've been blurred!]
rgrinberg has joined #ocaml
olle has joined #ocaml
<pgiarrusso> romachkuna that command line runs the `code` command with `Code.exe` as an argument, that seems wrong
<pgiarrusso> `/cygdrive/c/Users/UserName/AppData/Local/Programs/Microsoft\ VS\ Code/Code.exe` seems a bit better
<pgiarrusso> (maybe cygwin even lets you skip `Code`)
<pgiarrusso> the next step would be adding `/cygdrive/c/Users/UserName/AppData/Local/Programs/Microsoft\ VS\ Code/` to the `PATH`
<pgiarrusso> (then `Code.exe`, or `Code`, or maybe even `code` would work)
dextaa_ has joined #ocaml
gravicappa has quit [Ping timeout: 272 seconds]
<d_bot_> <NULL> Doesn't Cygwin's path include Windows' ?
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rgrinberg has joined #ocaml
mro has joined #ocaml
mro has quit [Remote host closed the connection]
bartholin has quit [Quit: Leaving]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rgrinberg has joined #ocaml
rgrinberg has quit [Ping timeout: 240 seconds]
greaser|q has joined #ocaml
greaser|q has quit [Changing host]
greaser|q has joined #ocaml
greaser|q is now known as GreaseMonkey
xgqt has quit [Read error: Connection reset by peer]
xgqt has joined #ocaml
rgrinberg has joined #ocaml
Haudegen has quit [Read error: Connection reset by peer]
Haudegen has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
quartz has joined #ocaml
np has quit [Quit: bye]
<quartz> Is OCaml used in the software engieering industy at all?
<olle> Yes
<olle> Hacklang type checker, Flow type checker
<quartz> What are those?
<olle> Hack? FB language. Flow lang is also from FB.
<olle> Then Jane Street, bla bla
<olle> Of course it's not used a lot
<olle> Unless you count F# as an ML/OCaml derivative
* olle zzz
<quartz> Jane Street?
<quartz> The company?
olle has quit [Ping timeout: 240 seconds]
Haudegen has quit [Ping timeout: 250 seconds]