companion_cube changed the topic of #ocaml to: Discussion about the OCaml programming language | http://www.ocaml.org | OCaml 4.12 released: https://ocaml.org/releases/4.12.0.html | Try OCaml in your browser: https://try.ocamlpro.com | Public channel logs at https://libera.irclog.whitequark.org/ocaml/
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rgrinberg has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Tuplanolla has quit [Quit: Leaving.]
rgrinberg has joined #ocaml
adanwan has quit [Remote host closed the connection]
adanwan has joined #ocaml
waleee has quit [Ping timeout: 258 seconds]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rgrinberg has joined #ocaml
favonia has quit [Ping timeout: 255 seconds]
berberman has quit [Ping timeout: 255 seconds]
berberman has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
zebrag has quit [Remote host closed the connection]
zerotypic has quit [Ping timeout: 265 seconds]
berberman has quit [Ping timeout: 255 seconds]
berberman has joined #ocaml
rgrinberg has joined #ocaml
rgrinberg has quit [Ping timeout: 272 seconds]
gravicappa has joined #ocaml
wilfred has joined #ocaml
gravicappa has quit [Ping timeout: 252 seconds]
zerotypic has joined #ocaml
gravicappa has joined #ocaml
mro has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
Haudegen has joined #ocaml
shawn has joined #ocaml
wilfred has quit [Quit: Connection closed for inactivity]
glassofethanol has joined #ocaml
favonia has joined #ocaml
bartholin has joined #ocaml
mbuf has joined #ocaml
Tuplanolla has joined #ocaml
gravicappa has quit [Ping timeout: 258 seconds]
gravicappa has joined #ocaml
zerotypic has quit [Ping timeout: 252 seconds]
Retropikzel has joined #ocaml
gravicappa has quit [Ping timeout: 272 seconds]
waleee has joined #ocaml
<d_bot> <bikal> is type `t` still unboxed below, i.e.
<d_bot> <bikal> Is `T.t` still unboxed as `t` is an abstract type?
<d_bot> <bikal> ```
<d_bot> <bikal> module A : sig
<d_bot> <bikal> type t
<d_bot> <bikal> val of_int : int -> t
<d_bot> <bikal> val print_t : t -> unit
<d_bot> <bikal> end = struct
<d_bot> <bikal> type t = T of int [@@unboxed]
<d_bot> <bikal> let of_int i = T i
<d_bot> <bikal> let print_t (T i) = print_int i
<d_bot> <bikal> end
<d_bot> <bikal> ```
<d_bot> <octachron> Unboxed applies to the type definition. Once the memory representation has been chosen, it is fixed even if the type definition is hidden by abstraction. In this case, you can check this directly by adding an `immediate` annotation:
<d_bot> <octachron> ```ocaml
<d_bot> <octachron> module A : sig
<d_bot> <octachron> type t [@@immediate]
<d_bot> <octachron> val of_int : int -> t
<d_bot> <octachron> val print_t : t -> unit
<d_bot> <octachron> end = struct
<d_bot> <octachron> type t = T of int [@@unboxed]
<d_bot> <octachron> let of_int i = T i
<d_bot> <octachron> let print_t (T i) = print_int i
<d_bot> <octachron> end
<d_bot> <octachron> ```
<d_bot> <octachron> Here, `[@@unboxed]` changes the meomory representation of `t` to an integer, and `[@@immediate]` exposes to the rest of the world that the memory representation of the abstract type `t` is an integer.
gravicappa has joined #ocaml
gravicappa has quit [Read error: Connection reset by peer]
gravicappa has joined #ocaml
mro has quit [Remote host closed the connection]
Retropikzel has quit [Quit: Leaving]
mro has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
mro has quit [Client Quit]
<d_bot> <Alistair> okay, thanks, I think I'm understanding that part now. How does the ocamldep pass work though?
mbuf has quit [Quit: Leaving]
TakinOver has quit [Ping timeout: 255 seconds]
TakinOver has joined #ocaml
gravicappa has quit [Ping timeout: 252 seconds]
gravicappa has joined #ocaml
Haudegen has quit [Quit: Bin weg.]
zerotypic has joined #ocaml
mro has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
Haudegen has joined #ocaml
mro has quit [Ping timeout: 272 seconds]
waleee has quit [Quit: WeeChat 3.2]
waleee has joined #ocaml
mro has joined #ocaml
mro has quit [Ping timeout: 246 seconds]
Serpent7776 has joined #ocaml
mro has joined #ocaml
mro has quit [Remote host closed the connection]
elf_fortrez has joined #ocaml
mro has joined #ocaml
glassofethanol has quit [Quit: leaving]
cedric has joined #ocaml
Haudegen has quit [Quit: Bin weg.]
TakinOver has quit [Ping timeout: 252 seconds]
mro has quit [Remote host closed the connection]
mro has joined #ocaml
mro has quit [Client Quit]
eight has joined #ocaml
TakinOver has joined #ocaml
bartholin has quit [Quit: Leaving]
Haudegen has joined #ocaml
elf_fortrez has quit [Quit: Client closed]
<d_bot> <andreypopp> Does anyone know if there's a lib which implements parsers for PostgreSQL types (scalars but also arrays, row types as well).
<d_bot> <andreypopp>
<d_bot> <andreypopp> I see caqti has some parsing infra but arrays are missing.
elf_fortrez has joined #ocaml
Stumpfenstiel has joined #ocaml
rgrinberg has joined #ocaml
favonia has quit [Ping timeout: 255 seconds]
elf_fortrez has quit [Ping timeout: 246 seconds]
<d_bot> <andreypopp> Looks like pgocaml has it
Corbin has joined #ocaml
gzj has joined #ocaml
favonia has joined #ocaml
<dmbaturin> companion_cube: otoml now passes every test in the TOML test suite (except for those related to integer/float precision, but I made it a functor so people who want big numbers can plug their own). I'm preparing a release now.
<companion_cube> nice :)
<companion_cube> still not sure I like toml as a format, but well done
zebrag has joined #ocaml
<dmbaturin> companion_cube: I hate the format now and I firmly believe it needs a hard fork cleaned from the insane features no one actually wants.
<companion_cube> :D
<companion_cube> even then
<dmbaturin> The irony is that _most_ libs are non-compliant, but no one notices.
<companion_cube> why does anyone want this kind of arrays
<companion_cube> give me something nicely hierarchical with sane lexical rules
<dmbaturin> companion_cube: https://github.com/dmbaturin/otoml/blob/main/src/lib/otoml_base.ml Do you know if there's a way to split a functor like this into multiple files? Many things inside depend on the parameter modules.
<companion_cube> not that I know of
<companion_cube> you could have a functor per file
<companion_cube> and a big functor that just includes them all
<companion_cube> sucks, but there's nothing better atm
<dmbaturin> Hhm. Not sure which one is the lesser of two evils.
<dmbaturin> This is the part I hate most: https://github.com/dmbaturin/otoml/blob/main/src/lib/toml_lexer.mll#L129-L159 I wonder if another lexer would be better suited for a context-sensitive grammar.
<companion_cube> iirc the menhir grammars just take a lexer generator, you could even handwrite the lexer if you wanted to
<dmbaturin> Well, since I'm using Menhir's incremental API, I'm free to use anything indeed. I just wonder which tool would be the best (i.e. allows what I want to do with extra least effort).
<d_bot> <theangryepicbanana> can you even parse toml with menhir? I didn't think it was LR(1)
glassofethanol has joined #ocaml
<dmbaturin> theangryepicbanana: It's not even context-free, so it's a combination of Menhir and a whole bunch of lexer hacks to produce a set of tokens that is LR(k)
<companion_cube> hurray for S-exprs
<d_bot> <theangryepicbanana> dmbaturin: oof sounds like a pain
<dmbaturin> Because it is. :)
<dmbaturin> But I can't live with to.ml anymore, and just switching soupault config to S-exp isn't really an option (I would still prefer something TOML-like for configs, too).
glassofethanol has quit [Quit: leaving]
<d_bot> <Alistair> Any compiler hackers know what the `Rabsent` constructor are used for in the `row_desc` for polymorphic variants: ```ocaml
<d_bot> <Alistair> and row_field =
<d_bot> <Alistair> Rpresent of type_expr option
<d_bot> <Alistair> | Reither of bool * type_expr list * bool * row_field option ref
<d_bot> <Alistair> (* 1st true denotes a constant constructor *)
<d_bot> <Alistair> (* 2nd true denotes a tag in a pattern matching, and
<d_bot> <Alistair> is erased later *)
<d_bot> <Alistair> | Rabsent
<d_bot> <Alistair> ```
<d_bot> <Alistair> Also what this syntax denotes: ```[< `A|`B > `X `Y ]``` for polymorphic variants (haven't come across it before?)
<dmbaturin> I'm still to look into the compiler internals...
<d_bot> <Alistair> It's my first day looking into typing, improved documentation would help (although the latex manual is useful) for implementation specific details
gzj has quit [Ping timeout: 252 seconds]
gravicappa has quit [Ping timeout: 272 seconds]
<d_bot> <octachron> ``[< `A of int | `B > `A ] as 'r`` means that the row variable `'r` is bounded by `` `A (of int) | `B > 'r > `A (of int) ``.
Corbin has quit [Ping timeout: 252 seconds]
<d_bot> <Alistair> So the values of the type would be ````A, `A (some int), `B```?
<d_bot> <octachron> No. Certainly `` `A (int) ``, and maybe `` `B ``.
<d_bot> <Alistair> Oh I see, thanks 🙂
<d_bot> <octachron> For instance, ``(fun x -> let (`A _ | `B ) = x in x) (`A 0)``
<d_bot> <octachron> Otherwise, `RPresent` (only in the lower bound), `REither` (at least in the upper bound), `RAbsent` describes the state of the field. If I am not mistaken, `RAbsent` only appears by merging constraints.
elf_fortrez has joined #ocaml
Serpent7776 has quit [Quit: leaving]
elf_fortrez has quit [Ping timeout: 246 seconds]
<d_bot> <Alistair> Could you give a rough concrete version of the representation of the type using the constructors? From the parsetree docs, looks like it's representation would be `Ptyp_variant ([Rtag ("A", false, [int]); Rtag ("B", true, [])], Closed, Some ["A"])`, but I'm still not too sure about the `type_expr` representation
<d_bot> <bikal> @octachron do we need to add `[@@immediate]` attribute to `type t` in order to take advantage of the unboxed representation?
gzj has joined #ocaml
<d_bot> <Yugami> (hey), I will probably try to write some interactive terminal UI, and I need a library. I've comme across LTerm, notty and lwd+nottui, is there more alternatives ? Wich of these three would you recommend?
gzj has quit [Ping timeout: 255 seconds]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Stumpfenstiel has quit [Ping timeout: 265 seconds]
cedric has quit [Quit: Konversation terminated!]
Haudegen has quit [Ping timeout: 255 seconds]
<d_bot> <idnes> meow meow, finally here as well x3
elf_fortrez has joined #ocaml