<d_bot>
<msk> Hello fellow travelers 🙂 I'm trying move from Erlang to Ocaml, and I cant seem to find a good "timestamp" to work with... lets say I have a timeseries, and I would like a list of (timestamp, int) pairs... what would be the best timestamp to use ? if I want ns resolution?
shawnw has quit [Ping timeout: 256 seconds]
<companion_cube>
using which clock?
<companion_cube>
if you're using the standard posix clock, there's `ptime`
<companion_cube>
if using a monotonic clock (probably not, it's more for profiling within one process run) there's `mtime`
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
x88x88x has quit [Remote host closed the connection]
x88x88x has joined #ocaml
gravicappa has joined #ocaml
vicfred has joined #ocaml
vicfred has quit [Ping timeout: 256 seconds]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
andreypopp has joined #ocaml
andreypopp has quit [Quit: ZNC 1.7.2+deb3 - https://znc.in]
andreypopp has joined #ocaml
ralu1 has quit [Ping timeout: 272 seconds]
vsiles_ is now known as vsiles
dextaa4 has joined #ocaml
dextaa4 has quit [Remote host closed the connection]
Sankalp has quit [Ping timeout: 256 seconds]
Sankalp has joined #ocaml
olle has joined #ocaml
andreypopp_ has joined #ocaml
andreypopp has quit [Read error: Connection reset by peer]
gravicappa has quit [Ping timeout: 246 seconds]
gravicappa has joined #ocaml
kakadu has joined #ocaml
gravicappa has quit [Ping timeout: 256 seconds]
gravicappa has joined #ocaml
wingsorc has quit [Ping timeout: 260 seconds]
gravicappa has quit [Ping timeout: 246 seconds]
gravicappa has joined #ocaml
bobo has quit [Ping timeout: 246 seconds]
spip has joined #ocaml
ralu1 has joined #ocaml
troydm has joined #ocaml
bartholin has joined #ocaml
<d_bot>
<Alistair> Is there an idiomatic way to do private exceptions? e.g. a constructor for `exn` that can only be constructed in the defined module. I know you can do `type exn += private ...`, but seems a bit reliant on knowing internally that `exn` is an open type.
zebrag has joined #ocaml
<d_bot>
<darrenldl> @msk depends on what you want to use the timestamp for next, but ptime is a good bet
<d_bot>
<darrenldl> @msk ^
dhil has joined #ocaml
<d_bot>
<octachron> `exn` is an extensible sum type, the special exception syntax is here only because exceptions predate extensible sum.
<d_bot>
<inkbottle> I want to convert `let eval_value (type a) (v : a value) : a =` to `let eval_value = fun` syntax, but so far I can't get it accepted by the type checker. (from https://dev.realworldocaml.org/gadts.html)
<d_bot>
<bnguyenv> `let eval_value : type a. a value -> a = fun v -> ...`Â ?
<d_bot>
<glennsl> Or `let eval = fun (type a) (v: a value): a -> ...`
<d_bot>
<glennsl> I think `type a.` is slightly more restrictive
<d_bot>
<inkbottle> hum
<d_bot>
<idnes> how is the notation `type a. a t -> a` called and what does it mean? define some generic `type a` and then the signature is `a t -> a`? how is `a t` itself called? i understand that it is a type `t` with subtype `a` somehow... but where do i look for that in the manual?
<d_bot>
<octachron> `let eval_value = fun (type a) -> fun (v: a value) : a -> ....`
<d_bot>
<octachron> The `type a . a value -> a ` syntax combines the creation of fresh locally abstract type `a` with an explicit universal quantification over this type `a`. It is required if your `eval` function is recursive.
<d_bot>
<inkbottle> I'm not familiar with the `: a` part of `fun (v: a value) : a ->`
<d_bot>
<inkbottle> the latter one
<d_bot>
<octachron> `fun p : ty -> expr` is a syntactic sugar for `fun p -> (expr:ty)`
<d_bot>
<tjltjl> ...so it took me a few weeks of active use of OCaml to finally switch to the janestreet core library. But now I think I'm pretty much settled
<d_bot>
<inkbottle> @octachron `fun (type a) (v : a value) -> (match v with Int x -> x | Bool x -> x) : a`, this is not accepted, I'm missing something.
<d_bot>
<inkbottle> about the syntactic sugar from above
<d_bot>
<NULL> The brackets after the last `->`
<d_bot>
<octachron> ((match v with Int x -> x | Bool x -> x) : a)
<d_bot>
<NULL> (which include the type annotation)
<d_bot>
<inkbottle> tx, really cool.
<d_bot>
<inkbottle> `ocamlformat` doesn't want to leave it like that, but it's another story. Maybe there is a way to convince it otherwise.
<d_bot>
<Alistair> Would it not be beneficial to provide syntax e.g. `private exception of ...` though?
<d_bot>
<idnes> thanks
<d_bot>
<inkbottle> Another question: can we understand `fun (type a) v -> t`, as a function taking a type parameter like with the "polymorphic lambda calculus" (though we don't need, and can't really provide it)? (That would be `\Lambda a . \lambda v . t`)
<d_bot>
<Bluddy> any use-cases in the wild of extensible types?
<d_bot>
<Alistair> Effects
<d_bot>
<octachron> @TheBloodlessMan that would increase the duplication of syntax for the same underlying concept.
<d_bot>
<octachron> hmaps, format tags, ...
cross has joined #ocaml
<d_bot>
<octachron> @inkbottle it does introduce a fresh type variable, but like you said the parallel is limited when there is no explicit application of functions to types.
<d_bot>
<Alistair> Yes, however, it would provide more *consistent* syntax for exceptions. Also it is not immediately obvious to beginners (or intermediate) users of the language that exceptions and extensible variants are necessarily the same thing
<d_bot>
<idnes> re ocaml/ocaml repo: do i have to make an issue before i submit a pr? i got ocaml to compile using mingw+microsoft compiler, i.e. no cygwin
Haudegen has quit [Quit: Bin weg.]
<d_bot>
<octachron> @Bluddy sure, but note that my explanation answers the question asked in the body (how are extensible sums represented at runtimes) rather than the one in the title.
<d_bot>
<Bluddy> still a very good explanation
mro has joined #ocaml
mro has quit [Quit: Leaving...]
kurfen has quit [Ping timeout: 240 seconds]
Haudegen has joined #ocaml
bartholin has quit [Ping timeout: 246 seconds]
bartholin has joined #ocaml
dextaa4 has joined #ocaml
vicfred has joined #ocaml
waleee has joined #ocaml
bartholin has quit [Ping timeout: 246 seconds]
bartholin has joined #ocaml
vicfred has quit [Quit: Leaving]
waleee has quit [Quit: WeeChat 3.5]
rgrinberg has joined #ocaml
rgrinberg has quit [Remote host closed the connection]
rgrinberg has joined #ocaml
dextaa4 has quit [Remote host closed the connection]
Haudegen has quit [Quit: Bin weg.]
<d_bot>
<mbacarella> Is there a proper name for sub-libraries inside of opam? e.g. if you `opam install core` you only install the core opam package, but if you then do `ocamlfind list | grep core` you'll see a bunch of sub-libraries like `core.nano_mutex` and `core.daemon`. You simply list those in the dune `libraries` stanza if you want them.
ralu1 has quit [Read error: Connection reset by peer]
ralu1 has joined #ocaml
bartholin has quit [Quit: Leaving]
olle has quit [Ping timeout: 246 seconds]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Haudegen has joined #ocaml
olle has joined #ocaml
vicfred has joined #ocaml
mbuf has quit [Quit: Leaving]
rgrinberg has joined #ocaml
chrisz has quit [Ping timeout: 248 seconds]
chrisz has joined #ocaml
waleee has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rgrinberg has joined #ocaml
rgrinberg has quit [Ping timeout: 250 seconds]
Haudegen has quit [Quit: No Ping reply in 180 seconds.]
Haudegen has joined #ocaml
bobo has joined #ocaml
spip has quit [Ping timeout: 240 seconds]
slothby has quit [Quit: brb ... maybe]
slothby has joined #ocaml
gravicappa has quit [Ping timeout: 276 seconds]
olle has quit [Ping timeout: 246 seconds]
cedric has joined #ocaml
wingsorc has joined #ocaml
motherfsck has quit [Ping timeout: 240 seconds]
cedric has quit [Quit: Konversation terminated!]
shawnw has joined #ocaml
dhil has quit [Ping timeout: 246 seconds]
shawnw has quit [Ping timeout: 240 seconds]
kurfen has joined #ocaml
gentauro has quit [Read error: Connection reset by peer]