companion_cube changed the topic of #ocaml to: Discussion about the OCaml programming language | http://www.ocaml.org | OCaml 5.0 released(!!1!): https://ocaml.org/releases/5.0.0.html | Try OCaml in your browser: https://try.ocamlpro.com | Public channel logs at https://libera.irclog.whitequark.org/ocaml/
Tuplanolla has quit [Quit: Leaving.]
azimut has quit [Ping timeout: 240 seconds]
waleee has quit [Ping timeout: 255 seconds]
chrisz has quit [Ping timeout: 240 seconds]
chrisz has joined #ocaml
_whitelogger has joined #ocaml
<discocaml> <Kali> there are precious few resources about ocaml online
terrorjack has quit [Quit: The Lounge - https://thelounge.chat]
terrorjack has joined #ocaml
spip has quit [Quit: Konversation terminated!]
jsoo_ has quit [Quit: ZNC 1.8.2 - https://znc.in]
jsoo has joined #ocaml
<discocaml> <sim642> It's too small to make any difference at this point in one day
bartholin has joined #ocaml
bgs has joined #ocaml
bartholin has quit [Quit: Leaving]
bgs has quit [Remote host closed the connection]
wingsorc has quit [Ping timeout: 255 seconds]
<discocaml> <RegularSpatula> Anyone seen this message when running inline_tests under javascript before? "Warning: overriding the purity of the primitive Base_am_testing: pure -> mutator"
Serpent7776 has joined #ocaml
spip has joined #ocaml
kakadu has joined #ocaml
kakadu has quit [Quit: Konversation terminated!]
<discocaml> <kakadu18> Folks, do we have PPX-based preprocessor that allows to define something from command line? ppx_optcomp doesn't...
sllk has quit [Quit: leaving]
azimut has joined #ocaml
Anarchos has joined #ocaml
gareppa has joined #ocaml
Anarchos has quit [Ping timeout: 240 seconds]
jyc has quit [Server closed connection]
jyc has joined #ocaml
greenbagels has quit [Server closed connection]
greenbagels has joined #ocaml
<discocaml> <xavierm02> Hi. I'm still on my idea of having two versions of an inductive: the normal one and another with some constructors disabled. My latest attempt defines the inductive in a functor and wraps arguments of inductive type in polymorphic types given as arguments to the functor. The full inductive is recovered by passing a module with all types equal to type 'a t = 'a, and some constructors can be disabled by defining the corresponding polymorphic t
<discocaml> <xavierm02> The only drawback I can see is that the restricted inductive is not a subtype of the full inductive, but this is only a problem when considering functions between the two types (because everything else can be placed in a functor to define it on both at once), and for my use case where the inductive represents an AST, the only such function simplifies the AST from the "full syntax" to the "core syntax", and would make no use of a subtyping r
<discocaml> <xavierm02> Did I miss an obvious drawback ?
jyc has quit [Ping timeout: 240 seconds]
jyc has joined #ocaml
<discocaml> <xavierm02> Nevermind, this does not work, not all functions can be written in similarly parameterized functors.
<discocaml> <octachron> @xavierm02 , you are aware that your GADT version works, if you use correctly GADTs?
<discocaml> <octachron> For the functor version you also probably want to lift the type definition outside of the functor to keep type equalities: https://gist.github.com/Octachron/dea0ed81b2884546da239aa00bf159cb .
<discocaml> <xavierm02> @octachron In the last version with GADT ( https://pastebin.com/38ZSnUxy ), I could not get a polymorphic-enough type for replace_A_by_C so I kind of gave up
<discocaml> <octachron> You are not using GADTs.
<companion_cube> my_type seems ilike it does?
<companion_cube> -i
<discocaml> <octachron> GADTs can only refine abstract types, and you are using unification variables rather than can never be refined (because they are global variables)
<discocaml> <octachron> GADTs can only refine abstract types, and you are using unification variables that cannot be refined (because they are global variables)
<companion_cube> but the recursive function most like needs a type annotation like `let rec replace_A_by_C : type a b c f. …`
<discocaml> <octachron> Indeed, and without those type annotations, GADTs are equivalent to normal variants + type constraints.
energizer has quit [Server closed connection]
<discocaml> <xavierm02> It works! replace_A_by_C has type "type a b c f. < a: a; b: b; c: c; f: f > my_type -> < a: no; b: b; c: yes; f: f > my_type". Thanks!
energizer has joined #ocaml
<discocaml> <xavierm02> (The c:yes would ideally be "a or c", but that's most likely impossible. And for the real use case, I won't record whether the "core" constructors are there or not, so it's not a problem)
<discocaml> <octachron> If you really *really* want to suffer rather than a "yes" tag, the field could carry a proof term for `a or b`.
<discocaml> <xavierm02> I had tried "let rec replace_A_by_C (type a b c f) (x : < a: a; b: b; c: c; f: f > my_type) : < a: no; b: b; c: yes; f: f > my_type = match x with", and had gotten an error that "b escapes its scope". I was so close >_<
<discocaml> <octachron> Ah yes, you often need recursive polymorphism with recursive functions + GADTS. Overall, my recommendation is to always start with `let f : type a b c . .... ` when using GADTs. This tends to avoid a lot of troubles.
waleee has joined #ocaml
deadmarshal_ has quit [Quit: IRCNow and Forever!]
deadmarshal_ has joined #ocaml
pgiarrusso has quit [Server closed connection]
pgiarrusso has joined #ocaml
gareppa has quit [Quit: Leaving]
waleee has quit [Ping timeout: 240 seconds]
curium has quit [Server closed connection]
gareppa has joined #ocaml
dhil has joined #ocaml
ridcully_ has quit [Ping timeout: 250 seconds]
ridcully_ has joined #ocaml
ridcully_ has quit [Ping timeout: 240 seconds]
ridcully_ has joined #ocaml
bartholin has joined #ocaml
bartholin has quit [Ping timeout: 240 seconds]
bartholin has joined #ocaml
bartholin has quit [Ping timeout: 255 seconds]
<discocaml> <psychokitty> Is it possible to `./configure` the OCaml compiler in such a way that it uses a different `asmcomp/{arch}` folder than the host? Even if it's to the extent of the `ocamlopt` invocations being to actually assemble and link anything (like, say I don't have a cross compiler and merely want to see `-dsel` etc.).
<discocaml> <psychokitty> Is it possible to `./configure` the OCaml compiler in such a way that it uses a different `asmcomp/{arch}` folder than the host? Even if it's _not_ to the extent of the `ocamlopt` invocations being to actually assemble and link anything (like, say I don't have a cross compiler and merely want to see `-dsel` etc.).
bartholin has joined #ocaml
bartholin has quit [Ping timeout: 240 seconds]
bartholin has joined #ocaml
<hexology> is there a library to iterate over unicode codepoints and/or unicode extended grapheme clusters in text? assuming it's encoded in either utf-8 or utf-32
<hexology> it looks like ocaml strings are "strings of bytes". maybe i'm looking for a general "unicode strings" library?
<companion_cube> uutf can iterate on codepoints
gareppa has quit [Quit: Leaving]
grobe0ba has quit [Server closed connection]
grobe0ba has joined #ocaml
azimut has quit [Remote host closed the connection]
azimut has joined #ocaml
John_Ivan_ has quit [Quit: Disrupting the dragon's slumber one time too often shall eventually bestow upon all an empirical and indiscriminate conflagration that will last for all goddamn eternity.]
<octachron> there is `uuseg` for general segmentation
Techcable has quit [Remote host closed the connection]
Techcable has joined #ocaml
Techcable has quit [Remote host closed the connection]
dhil has quit [Ping timeout: 240 seconds]
John_Ivan has joined #ocaml
Tuplanolla has joined #ocaml
wingsorc has joined #ocaml
Serpent7776 has quit [Ping timeout: 240 seconds]
daftaupe has quit [Server closed connection]
daftaupe has joined #ocaml
bartholin has quit [Quit: Leaving]
Tuplanolla has quit [Quit: Leaving.]
<discocaml> <Et7f3 (@me on reply)> Rename your default compiler and it should work
<discocaml> <Et7f3 (@me on reply)> You will not produce a cross platform compiler but at least it should run
<discocaml> <psychokitty> can you elaborate on what you mean