companion_cube changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml 4.11 release notes: https://caml.inria.fr/pub/distrib/ocaml-4.11/notes/Changes | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml
mxns has quit [Ping timeout: 240 seconds]
mxns has joined #ocaml
mxns has quit [Ping timeout: 260 seconds]
shawnw has joined #ocaml
mxns has joined #ocaml
mxns has quit [Ping timeout: 252 seconds]
mxns has joined #ocaml
mxns has quit [Ping timeout: 258 seconds]
mxns has joined #ocaml
mxns has quit [Ping timeout: 260 seconds]
mxns_ has joined #ocaml
mxns has joined #ocaml
mxns_ has quit [Ping timeout: 258 seconds]
mxns_ has joined #ocaml
mxns has quit [Ping timeout: 260 seconds]
mxns has joined #ocaml
mxns_ has quit [Ping timeout: 258 seconds]
<sleepydog> Zach5050: don't ask to ask, just ask
mxns_ has joined #ocaml
mxns has quit [Ping timeout: 250 seconds]
mxns- has joined #ocaml
mxns_ has quit [Ping timeout: 260 seconds]
mxns has joined #ocaml
mxns- has quit [Ping timeout: 260 seconds]
mxns has quit [Ping timeout: 240 seconds]
mxns has joined #ocaml
mxns has quit [Ping timeout: 268 seconds]
Haudegen has quit [Ping timeout: 240 seconds]
mfp has quit [Ping timeout: 252 seconds]
curtosis has joined #ocaml
curtosis is now known as curtosis[away]
mxns has joined #ocaml
mxns has quit [Ping timeout: 250 seconds]
curtosis[away] has quit [Quit: My Mac Mini has gone to sleep. ZZZzzz…]
mbuf has joined #ocaml
<d_bot> <darrenldl> astronavt: it seems like leap seconds are not published until a few weeks before they are needed, so accepting rollover whatever the date might be best we can do i guess
ansiwen has quit [Quit: ZNC 1.7.1 - https://znc.in]
ansiwen has joined #ocaml
waleee-cl has quit [Quit: Connection closed for inactivity]
vicfred has joined #ocaml
landonf has quit [Excess Flood]
landonf has joined #ocaml
drakonis has quit [Quit: ZNC 1.8.2 - https://znc.in]
drakonis has joined #ocaml
vicfred has quit [Quit: Leaving]
wonko7 has joined #ocaml
<d_bot> <darrenldl> astronavt: sorry some more questions if you don't mind: is "time zone abbreviation" commonly used in your experience? say instead of writing "+01:00" you write "CET" or "MET" in the timestamp (not allowed in the ISO8601 standard, but seems to be common enough in practice for my friend to bring up the issue with handling these abbreviations)
<astronavt> @darrenldl yes, in a lot of "real world" data you get time zone abbreviations if you're lucky to get a time zone at all
<astronavt> although if you get no time zone at all usually its all the same time zone so you can enter it after the fact - that said, i dont like entering offsets manually because of DST; i'd much prefer to use the tz database if possible (e.g. America/Chicago)
mxns has joined #ocaml
<d_bot> <darrenldl> if only that's standardised
mxns has quit [Ping timeout: 240 seconds]
<astronavt> in the data processing work ive done id rather have a not-entirely-accurate tz database than trying to compute it myself. in a server application or something it'd be different, usually there's either a single time zone for everything or the user has to select it - but even then it still has to contend with when do add the +1 for dst
mxns has joined #ocaml
<d_bot> <darrenldl> astronavt: we have a natural language parsing component, timere-parse, in case you aren't aware btw. demo: https://daypack-dev.github.io/timere-parse-demo/
<astronavt> i saw it mentioned, that's a handy feature
<astronavt> very useful for data cleanup
<astronavt> its a pain in the butt to write routines like that manually, missing an edge case and going back to re-do, etc.
<d_bot> <darrenldl> : D
wonko7 has quit [Ping timeout: 246 seconds]
wonko7 has joined #ocaml
mxns has quit [Ping timeout: 240 seconds]
Tuplanolla has joined #ocaml
robmyers has quit [Ping timeout: 240 seconds]
robmyers has joined #ocaml
mxns has joined #ocaml
mxns has quit [Ping timeout: 258 seconds]
alexey has quit [Quit: leaving]
alexey has joined #ocaml
olle has joined #ocaml
ananya has joined #ocaml
ananya has quit [Client Quit]
SquidDev5 has joined #ocaml
SquidDev has quit [Read error: Connection reset by peer]
SquidDev5 is now known as SquidDev
wonko7 has quit [Ping timeout: 252 seconds]
ananya has joined #ocaml
ananya19 has joined #ocaml
ananya19 has quit [Client Quit]
ananya has quit [Quit: Connection closed]
mxns has joined #ocaml
mxns has quit [Ping timeout: 260 seconds]
pouellet has quit [Ping timeout: 265 seconds]
Haudegen has joined #ocaml
mfp has joined #ocaml
<Serpent7776> When I define a type in mli file, like `type Foo = A | B` do I have to repeat it in the ml file? I'm getting "Unbound constructor" error if I don't.
<Armael> yes yo do
<Armael> you*
<Serpent7776> thanks, why is it so?
bjorkintosh has quit [Remote host closed the connection]
<d_bot> <darrenldl> afaik basically .mli can only restrict the interface/surface of the module, and cannot add anything to or expand the module defined by .ml
<d_bot> <darrenldl>
<d_bot> <darrenldl> not sure what's reason behind the design decision exactly, but the alternative seems messy (allowing bidirectional propagation of information between .mli and .ml)
<Serpent7776> hmm, ok. Do you often need to copy paste type definitions is such way or is it more common to only provide abstract types in mli files?
<olle> No mli file --> everything's public, right?
<olle> But you can still create submodules to hide stuff?
<steenuil> if you use dune anything that's not exposed in the module with the same name as the library is wrapped
<octachron> You can use submodule with an explicit signature to abstract part of the submodule
<d_bot> <EduardoRFS> In lay terms, you can do include with signature to hide things without an mli
<octachron> Generally, I switch to an explicit mli once the interface of a module is stabilized, and modifying the interface of the module means updating all its clients anyway.
doelie has joined #ocaml
<Serpent7776> I guess I need to do some reading on submodules then
<steenuil> octachron: you mean like `module M : sig ... end = struct ... end;; include M`?
<olle> steenuil: and without dune?
<steenuil> I dunno, I just use dune
<octachron> Just the submodule "module M: sig ... end = struct ... end". With the include, another option is "open (struct ... end : sig ... end)"
<Serpent7776> definitions from `include` and `open` are not auto exported?
<octachron> The components included are part of the signature.
<octachron> This is not the case for `open`s: `open List` does not include the component of List.
<octachron> And it might be better to reason in term of inferred signature and signature constraint rather than "auto-export".
<Serpent7776> I'm not yet familiar with constraints
mxns has joined #ocaml
mxns has quit [Ping timeout: 260 seconds]
mxns has joined #ocaml
<d_bot> <EduardoRFS> ```ocaml
<d_bot> <EduardoRFS> module type S = sig
<d_bot> <EduardoRFS> type t
<d_bot> <EduardoRFS> end
<d_bot> <EduardoRFS> type ('M, 'a) t = (module S with type t = 'a * 'a)
<d_bot> <EduardoRFS> type x = ((module S with type t = x), unit) t
<d_bot> <EduardoRFS> ```
<d_bot> <EduardoRFS> is this a bug? This types, with `x` being `((module S with type t = unit) * unit)`
<d_bot> <EduardoRFS> but I'm saying that the left one should be recursive, I'm not expecting it to work, but it does
<d_bot> <EduardoRFS> OH seems like a merlin bug
<d_bot> <EduardoRFS> ops it's not, was able to reproduce it with normal OCaml
<d_bot> <octachron> I don' see any bugs? Since `type ('a,'b) t = 'b r`, with `type 'a r = (module S with type t = 'a * 'a`, the definition of `x` can be simplified to `type x = unit r`?
malc_ has joined #ocaml
<malc_> i have this auto-generated interface https://repo.or.cz/llpp.git/blob/cb00647159cb79f8ccbe8d151e8328e49f56c935:/uiutils.mli#l67 it looks as if the argument to coe and setuioh can be shared somehow, but my attempts were unsuccessful, any would appreciate help, thanks.
<octachron> Do you want to share the type of the argument?
<d_bot> <EduardoRFS> you're right, I forgot, this case is incomplete there is an additional alias
vicfred has joined #ocaml
<malc_> octachron: yes
<malc_> octachron: not sure if the question was for me though
<octachron> malc_, yes, sorry. If you don't need to support old OCaml versions, you could use a local type substitution "type arg := < alwaysscrolly: bool; ... >".
<octachron> The advantage of the local type substitution is that you don't need to mirror the type definition on the implementation side, and you can use it in the interface as local type-level variable.
<d_bot> <EduardoRFS> My case should be
<d_bot> <EduardoRFS>
<d_bot> <EduardoRFS> ```ocaml
<d_bot> <EduardoRFS> module type S = sig
<d_bot> <EduardoRFS> type t
<d_bot> <EduardoRFS> end
<d_bot> <EduardoRFS> type ('M, 'a) t = (((module S with type t = 'a) as 'M) * 'a)
<d_bot> <EduardoRFS> type x = ((module S with type t = x), unit) t
<d_bot> <EduardoRFS> ```
<d_bot> <EduardoRFS> but yeah this fails as expected
<malc_> octachron: thanks, old versions are not an issue, not sure how to go about this local type substitution, you have any example handy?
<octachron> Ah, looking at the code better, your issue was the unbounded type parameter errors on #Config.uioh?
<malc_> octachron: iirc it complained about an 'a type and the diagnostic was dependent on #Conf... indeed
<malc_> octachron: wow.... not sure i'm brave enough to use that, but thank you!
<octachron> The issue is that in a type definition all the implicit "for all possible subtype of" implied by #class_typ and `< .. >` needs to be explicit.
<malc_> octachron: why as 'f though... 'f is not used anywhere afaics
<octachron> It is used on the last line of the type definition for the < .. > part
mxns has quit [Ping timeout: 260 seconds]
mxns has joined #ocaml
<malc_> octachron: yes. i'm confused cause it's the only usage
<octachron> The " .. " hides a type variables that need to be bound in a type definition. In other words, < ct; .. > as 'f means "for any subtype 'f of ct"
mxns has quit [Ping timeout: 268 seconds]
<octachron> Hm, but it can be simplified here. Using < _ arg; .. > is a tad simpler.
<d_bot> <EduardoRFS> @octachron there would be anything unsafe in allowing this? A patch to allow this is really small(if mutability is used is less than 10loc), but I wonder if it would allow anything unsafe
<d_bot> <EduardoRFS>
<d_bot> <EduardoRFS> ```ocaml
<d_bot> <EduardoRFS> module type S = sig type t end
<d_bot> <EduardoRFS> type 'M t = ((module S with type t = 'a) as 'M) * 'a
<d_bot> <EduardoRFS> type x = (module S with type t = int) t
<d_bot> <EduardoRFS> ```
<d_bot> <octachron> It is already allowed with `type 'M t = 'M * 'a constraint 'M = (module S with type t = 'a)`
<d_bot> <EduardoRFS> OH, that's really interesting
mxns has joined #ocaml
mbuf has quit [Quit: Leaving]
Nahra has quit [Ping timeout: 252 seconds]
clockish has quit [Ping timeout: 240 seconds]
clockish has joined #ocaml
mxns has quit [Ping timeout: 260 seconds]
waleee-cl has joined #ocaml
mxns has joined #ocaml
wonko7 has joined #ocaml
olle has quit [Ping timeout: 260 seconds]
mxns has quit [Ping timeout: 268 seconds]
bartholin has joined #ocaml
mxns has joined #ocaml
mxns has quit [Ping timeout: 260 seconds]
CptCaptain has joined #ocaml
pouellet has joined #ocaml
webshinra has quit [Remote host closed the connection]
webshinra has joined #ocaml
jbrown has quit [Ping timeout: 265 seconds]
mxns has joined #ocaml
jbrown has joined #ocaml
mxns has quit [Ping timeout: 248 seconds]
CptCaptain has quit [Quit: WeeChat 2.9]
toppler` has joined #ocaml
<toppler`> I'm trying to play with the native toplevel. I've found that if my code goes into an infinite loop, then I'm pretty much stuck, and can't even interrupt the process. Am I doing something wrong and is there a way around this?
mxns has joined #ocaml
mxns has quit [Ping timeout: 260 seconds]
mxns has joined #ocaml
<malc_> toppler`: what's "native" toplevel?
<toppler`> malc_: ocamlnat
<malc_> toppler`: gotcha, thanks
<companion_cube> sadly it's not in official releases
<toppler`> Yeah, and the manual says it's experimental (https://ocaml.org/manual/toplevel.html#s%3Aocamlnat). Not sure how it's viewed by the ocaml team. I saw some posts last month from Jane Street folk saying they were interested in it.
<companion_cube> I'd be interested in it
<companion_cube> oh well
mxns has quit [Ping timeout: 268 seconds]
mxns has joined #ocaml
mxns has quit [Ping timeout: 250 seconds]
mxns has joined #ocaml
<toppler`> I was doing pretty well with it on a smallish project. I couldn't get the usual topfind stuff to work, but I managed to get Omod to load my project's dependencies instead. Looking at the code, it appears to be emitting every toplevel phrase as a dll, linking and then treating it as a callback from a C primitive to Ocaml. And I think the problem of interrupting is the same one I would have if I wrote a user defined C primitive which goes
<toppler`> into an infinite loop.
<toppler`> companion_cube: Have you got a use case? It seems it would be obviously cool for people doing LCF style theorem proving at the toplevel (e.g. HOL Light)
<malc_> toppler`: just tried it
mxns has quit [Ping timeout: 250 seconds]
<malc_> where it a let rec f () = f ();;
<malc_> which compiles to (basically); label: mov reg, 1; jmp label
<toppler`> Can you C-c C-c it if you do "f ()"?
<malc_> toppler`: no
<companion_cube> toppler`: LCF theorem proving, yes :p
<companion_cube> well not really LCF, but still
<malc_> toppler`: because sigint has no chance of being caught here
<malc_> C-z OTOH "works"
<malc_> because it's being caught by a shell where ocamlnat was started
vicfred has quit [Quit: Leaving]
<toppler`> malc_: That's SIGSTOP isn't it? I expect that to work for all processes.
<companion_cube> if the program allocates, it should eventually check the interrupt handler
<malc_> companion_cube: the program is at this point 2 instructions, as i described earlier
<malc_> toppler`: c-z?
mxns has joined #ocaml
<toppler`> If you do this in a compiled exe, installing a handler to throw an exception, doesn't the signal get caught an exception thrown?
<toppler`> malc_: Doesn't c-z send SIGSTOP or SIGTSTP?
<malc_> toppler`: it does
mxns has quit [Ping timeout: 268 seconds]
<toppler`> malc_: Sorry, I'm not hugely familiar with the behaviour of the Ocaml runtime here, but compiling this with ocamlc.opt gives me something that I can interrupt: https://pastebin.com/1Ntnd50h. I'd have hoped I could do the same thing at the native toplevel.
<malc_> toppler`: looking
<malc_> toppler`: your example (when built with ocamlopt) is not c-c-able here, bytecode compiled version is interruptible
<malc_> toppler`: my guess would be that real signal handler just sets a flag that there are signals pending and bytecode version checks this (periodically), native one has no such luxory
<malc_> just a conjecture
<toppler`> Crap, you're right!
<toppler`> But I think companion_code had it that it can check for pending signals when it does stuff like allocation. If I have that loop build a list, I can C-c.
<malc_> yep
mxns has joined #ocaml
<toppler`> Hmm...that might be good enough for me.
<toppler`> Thanks both for your help!
mxns has quit [Ping timeout: 250 seconds]
drakonis has quit [Quit: ZNC 1.8.2 - https://znc.in]
drakonis has joined #ocaml
drakonis has quit [Quit: ZNC 1.8.2 - https://znc.in]
sz0 has joined #ocaml
mxns has joined #ocaml
mxns has quit [Ping timeout: 258 seconds]
drakonis has joined #ocaml
landonf has quit [Excess Flood]
wonko7 has quit [Ping timeout: 240 seconds]
landonf has joined #ocaml
olle has joined #ocaml
<olle> Having more than one pass for one abstract syntax-tree type makes it important to enforce a certain order. Which way would be best for this? Phantom types? Type alias?
<olle> (Double posting to forum)
<olle> Hm
<olle> Is there a short-hand to make sig = struct?
malc_ has quit [Ping timeout: 260 seconds]
<olle> Or, when I do module Foo = struct ... end, is there an implicit sig with some name?
<octachron> olle, there is `module type of Foo`
bartholin has quit [Quit: Leaving]
<olle> Yeah?
* olle testing
<olle> syntax error
<olle> missing let?
<olle> Yeah, just saw that entry, thanks.
<olle> It can't refer to itself tho
<olle> module Ast : module type of Ast = struct ... end
<d_bot> <TheBloodlessMan> Why would you want to do that though?
<d_bot> <TheBloodlessMan> Why not explicitly define the signature?
<olle> Because I want everything to be public. So maybe `open Ast` is enough, then.
drakonis has quit [Quit: WeeChat 3.1]
mxns has joined #ocaml
<octachron> Everything is public by default, you don't need to do anything.
mxns has quit [Ping timeout: 260 seconds]
mxns has joined #ocaml
<olle> octachron: not if all modules are in the same file
mxns has quit [Ping timeout: 260 seconds]
<olle> it's actually hidden by default when doing "module Foo = struct .. end"
<olle> no fold_left with index? I want to apply no "," on the first run
<olle> maybe if carry = ""?
<d_bot> <TheBloodlessMan> `let fold_lefti f acc xs = List.fold_left (fun (i, acc) x -> (i + 1, f i acc x)) (0, acc) xs`
<olle> :d
<d_bot> <TheBloodlessMan> 😉 tbh should be added to std lib / base
shawnw has quit [Quit: Leaving]
<olle> Gonna have to copy that
shawnw has joined #ocaml
Tuplanolla has quit [Quit: Leaving.]
drakonis has joined #ocaml
Serpent7776 has quit [Quit: leaving]
sz0 has quit [Quit: Connection closed for inactivity]
olle has quit [Ping timeout: 252 seconds]
mxns has joined #ocaml
mxns has quit [Ping timeout: 258 seconds]
<d_bot> <Anurag> FWIW `base` has a `List.foldi`
<d_bot> <Anurag> `'a list -> init:'b -> f:(int -> 'b -> 'a -> 'b) -> 'b`
Nahra has joined #ocaml
mro_name has joined #ocaml
mro_name has quit [Client Quit]
mxns has joined #ocaml
wssad has joined #ocaml
<wssad> There is a famous trading powerhouse Jane Street which uses OCaml exclusively. If someone has knowledge about this industry, why did Jane Street Capital choose OCaml over other functional programming languages (ex: Haskell)? Why functional programming language in the first place? Why not a language like python with lots of mature libraries?
<dh`> are you looking for a serious answer or are you trolling?
<d_bot> <EduardoRFS> wssad: I remember Ron talking about something performance being predictable on this
mxns has quit [Ping timeout: 240 seconds]
<wssad> dh`: not trolling, certainly. My knowledge is zero on OCaml. Sorry if my questions come across as stupid.
<wssad> my knowledge of FP is limited. I use python because it's easy to get answers on stackoverflow
<dh`> not stupid so much as striding across several political minefields
<wssad> hmm ... didn't know the political part. I would like to hear objective answers.
<dh`> objectivity is difficult in topics governed by ideology
<dh`> anyway, as far as I know their primary motivation was to show that they could do it in a functional language
<dh`> and only ocaml had a remote chance of being viable for serious production use