Frostillicus has quit [Remote host closed the connection]
Frostillicus has joined #ocaml
Frostillicus has quit [Ping timeout: 260 seconds]
Frostillicus has joined #ocaml
germ_ has quit [Ping timeout: 272 seconds]
<discocaml>
<bluddy5> Youre not going to be able to compete with highly optimized c++. Your best chance is to try oxcaml.
mange has joined #ocaml
Frostillicus has quit [Ping timeout: 245 seconds]
amadaluzia has joined #ocaml
humasect has quit [Quit: Leaving...]
wickedshell has quit [Ping timeout: 276 seconds]
toastal has joined #ocaml
bartholin has joined #ocaml
myrkraverk__ has joined #ocaml
myrkraverk_ has quit [Ping timeout: 255 seconds]
Frostillicus has joined #ocaml
Frostillicus has quit [Ping timeout: 244 seconds]
Haudegen has joined #ocaml
Frostillicus has joined #ocaml
Frostillicus has quit [Ping timeout: 260 seconds]
<discocaml>
<lukstafi> I just had a "brilliant" idea (quotes because either it turn out false for mundane reasons or ironic reasons) -- I add a type parameter to the main datatype of my framework so that users can attach domain-specific meaning hints that will show up in function signatures, and in some cases will get statically verified. I will not otherwise do anything with this type -- no preservation nor alternation by the framework operations. Technically, I w
luc4 has joined #ocaml
<discocaml>
<lukstafi> Ah, `mutable phantom_info : 'a list` actually, better for disjunctive types.
<discocaml>
<lukstafi> Could that have some annoyances of the sort "type variable escapes scope"?
tccq` has joined #ocaml
<discocaml>
<lukstafi> Quick, someone dissuade me
tccq has quit [Read error: Connection reset by peer]
Frostillicus has joined #ocaml
<discocaml>
<lukstafi> Ah, so if I have a binary function that disambiguates the arguments via the phantom type, one would need to write `f x (erase_phantom x)` sometimes, but that seems like a low price.
Frostillicus has quit [Ping timeout: 260 seconds]
<discocaml>
<lukstafi> These phantoms would intentionally mean no guarantee, they would just be mnemonics.
Frostillicus has joined #ocaml
YuGiOhJCJ has joined #ocaml
tremon has joined #ocaml
Anarchos has joined #ocaml
Anarchos has quit [Client Quit]
YuGiOhJCJ has quit [Quit: YuGiOhJCJ]
Frostillicus has quit [Remote host closed the connection]
Frostillicus has joined #ocaml
Frostillicus has quit [Ping timeout: 255 seconds]
olle has quit [Ping timeout: 256 seconds]
Frostillicus has joined #ocaml
Haudegen has quit [Quit: Bin weg.]
<discocaml>
<lukstafi> I'll try this out, but without the `mutable` part (which should remove the worry about escaping variables as all will be polymorphic).
johnridesabike has joined #ocaml
Frostillicus has quit [Ping timeout: 248 seconds]
Frostillicus has joined #ocaml
<discocaml>
<deepspacejohn> You mean something similar to this?
<discocaml>
<deepspacejohn> ```ocaml
<discocaml>
<deepspacejohn> module M : sig
<discocaml>
<deepspacejohn> type 'a t
<discocaml>
<deepspacejohn> val make : unit -> 'a t
<discocaml>
<deepspacejohn> val do_something : 'a t -> 'a t -> unit
<discocaml>
<deepspacejohn> end = struct
<discocaml>
<deepspacejohn> type 'a t = unit
<discocaml>
<deepspacejohn> let make () = ()
<discocaml>
<deepspacejohn> let do_something () () = ()
<discocaml>
<deepspacejohn> end
<discocaml>
<deepspacejohn>
<discocaml>
<deepspacejohn> let x : int M.t = M.make ()
<discocaml>
<deepspacejohn> let y : string M.t = M.make ()
<discocaml>
<deepspacejohn> let () = M.do_something x y (* type error *)
<discocaml>
<deepspacejohn> ```
<discocaml>
<deepspacejohn> I've used a technique like this before when writing a DSL so the user could add arbitrary types to certain values.
<discocaml>
<deepspacejohn> As far as using a phantom type goes, not the mutable option/list parts.
Frostillicus has quit [Remote host closed the connection]
Frostillicus has joined #ocaml
mange has quit [Quit: Zzz...]
Haudegen has joined #ocaml
humasect has joined #ocaml
Frostillicus has quit [Remote host closed the connection]
Frostillicus has joined #ocaml
Frostillicus has quit [Ping timeout: 248 seconds]
Frostillicus has joined #ocaml
spynx has joined #ocaml
spynxic has quit [Read error: Connection reset by peer]
<discocaml>
<lukstafi> Yes. Except the use case I have in mind is `val do_something : `source t -> `dest t -> unit` -- i.e. like argument labels (I have secret reasons to not just use labels)
<discocaml>
<lukstafi> With the `mutable` field you provide more enforcement, the values cannot be multiple types so if they get reused they need annotations that are like labels: `do_something (source x) (dest y)` where `let source x = { x with phantom_info = `source}`
<discocaml>
<lukstafi> A third option would be (without `mutable`) to generate non-polymorphic values from `make` and then all "label-using" places need to be "labeled".
spynx is now known as spynxic
Frostillicus has quit [Ping timeout: 248 seconds]
shwouchk has quit [Ping timeout: 244 seconds]
shwouchk has joined #ocaml
Haudegen has quit [Quit: Bin weg.]
Frostillicus has joined #ocaml
Frostillicus has quit [Remote host closed the connection]
<discocaml>
<myrlhex> Is there a way to pin system-wide? I made a change to dune and would like to use my copy of dune until my code gets mainlined.
polykernel has quit [Remote host closed the connection]
polykernel has joined #ocaml
<discocaml>
<deepspacejohn> If by system-wide you mean pinning on all switches, then no. Pins are per-switch.
amadaluzia has joined #ocaml
<discocaml>
<deepspacejohn> Or the alternate answer is yes, if you pin it on the global switch and just use that.
chiselfuse has quit [Ping timeout: 272 seconds]
chiselfuse has joined #ocaml
<discocaml>
<myrlhex> Right, thanks. I guess if I want to do the latter ergonomically, I'll have to add that to my `.bashrc`? Since the `default` switch's `bin` doesn't seem to exist in `PATH` after loading the local switch's env.
<discocaml>
<deepspacejohn> Yes, although that's also the default way that OPAM works, so it normally would have already updated your `.bashrc` when it was installed. I think running `opam init` might update it too.
<discocaml>
<myrlhex> Thanks lol. Turns out that I wasn't sourcing the opam init script correctly because it was in `.profile` and that doesn't play well with VS Code. And yep, I both see the local switch and the global switch in my path now. Thanks again!