<neiluj>
if a type is wrapped in a polymorphic type with an alias: type 'a t = ty, is 'a t does this bring an extra memory overhead?
<discocaml>
<Kali> phantom type variables do not carry memory overhead because types are erased during compilation
<neiluj>
nice! thanks again
<discocaml>
<Kali> assuming it's phantom type variables you're referring to, anyway
<neiluj>
yes, phantom types
<discocaml>
<Kali> such as the 'a in `type 'a t = unit`
azimut has quit [Remote host closed the connection]
azimut has joined #ocaml
azimut has quit [Ping timeout: 252 seconds]
waleee has quit [Ping timeout: 258 seconds]
chrisz has quit [Ping timeout: 255 seconds]
chrisz has joined #ocaml
alphacentauri has joined #ocaml
<discocaml>
<omnisci3nt> I've started writing some basic gameplay scripts in OCaml that get executed from a C game engine main loop. I'm curious how hard on a scale of 1-10 is compiling ocaml for android/ios since I plan on supporting them as platforms in the future
<discocaml>
<omnisci3nt> A few discussion posts on the forum pop up but the story seems rather cryptic / incomplete. Is that still the state of things?
<discocaml>
<omnisci3nt> I've started writing some basic gameplay scripts in OCaml that get executed from a C game engine main loop. I'm curious how hard on a scale of 1-10 is compiling ocaml for android/ios and linking against them since I plan on supporting them as platforms in the future
<discocaml>
<omnisci3nt> (not 100% sure if this is the right channel or whether that was too vague so sorry in advance if so)
<discocaml>
<omnisci3nt> I've started writing some basic gameplay scripts in OCaml that get executed from a C game engine main loop (I init the ocaml runtime with `ocaml_main()` and then run a Ocaml function that is the entryway for doing some game player state machine stuff which itself can call C functions via FFI to do raycasts etc) I'm curious how hard on a scale of 1-10 is compiling ocaml for android/ios and linking against them since I plan on supporting them
dnh has joined #ocaml
dnh has quit [Ping timeout: 255 seconds]
famubu has quit [Ping timeout: 264 seconds]
azimut has joined #ocaml
<discocaml>
<cswine> why does `build` treat warnings as errors by default?
Tuplanolla has joined #ocaml
Serpent7776 has joined #ocaml
waleee has joined #ocaml
Anarchos has joined #ocaml
<discocaml>
<sim642> Not sure if this is the real reason but otherwise warnings wouldn't be very visible. If a module compiles without errors but with warnings, then they would only be shown on the first build. If something changes but not that module, dune doesn't rebuild, so no warnings are printed
<discocaml>
<sim642> In that case, you have to build everything from scratch to see all the warnings
waleee has quit [Ping timeout: 258 seconds]
<Anarchos>
is it a way to tell opam to install the latest github version of a package ?
dnh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dnh has joined #ocaml
alphacentauri has quit [Quit: WeeChat 4.0.5]
waleee has joined #ocaml
alphacentauri has joined #ocaml
waleee has quit [Ping timeout: 240 seconds]
waleee has joined #ocaml
<discocaml>
<froyo> @struktured you can prove that `map f ∘ filter g` is equivalent to `filter_map (λ x. if g x then Some (f x) else None)` forall f g. They're always equivalent
<discocaml>
<froyo> ```coq
<discocaml>
<froyo> Goal forall a b (f : a -> b) (g : a -> bool) xs,
<discocaml>
<froyo> map f (filter g xs) = filter_map (fun x => if g x then Some (f x) else None) xs.
<discocaml>
<froyo> Proof.
<discocaml>
<froyo> induction xs as [|x xs]. reflexivity.
<discocaml>
<froyo> cbn; destruct (g x); cbn; now rewrite IHxs.
<discocaml>
<froyo> Qed.
<discocaml>
<froyo> ```
<discocaml>
<._null._> Actually, if `f` is effectful and `g` fails, it won't be equivalent. Coq doesn't have either, so it is true there
<discocaml>
<._null._> Actually, if `f` is effectful and `g` fails, it won't be equivalent. Coq doesn't have either side-effects or exceptions, so it is true there
<discocaml>
<froyo> i mean generally speaking, such transformations more complex to reason about when you factor in side-effects
<discocaml>
<froyo> but im not really sure if they matter here
<discocaml>
<froyo> f's evaluation is always guarded by g's evaluation in both cases
<discocaml>
<froyo> wdym by g fails
<discocaml>
<._null._> If `g` fails at the second call, the effect of `f` will happen only with `filter_map`
<discocaml>
<froyo> returns false?
<discocaml>
<._null._> No, raises an exception
<discocaml>
<froyo> right, i see what you mean
<discocaml>
<froyo> fusion changing the order of applications for f and g
<discocaml>
<._null._> Basically yes
<discocaml>
<froyo> from g,g,g,g,... f,f,f,f,f,.... to g,f,g,f,...
<discocaml>
<._null._> (modulo g not being called for every call of f since filter)
<discocaml>
<froyo> of course of course
<discocaml>
<._null._> So if f and g commute (which is basically always if you're not doing crazy stuff), then filter_map (f ∘g) and map f∘ filter g are equivalent
<discocaml>
<._null._> calls to f and g*
alphacentauri has quit [Quit: WeeChat 4.0.5]
<discocaml>
<akhilindurti> huh, i didn't realize you can have regular constructors and gadt constructors in the same type definition
<discocaml>
<akhilindurti> ```ocaml
<discocaml>
<akhilindurti> type expr =
<discocaml>
<akhilindurti> | A: bool -> expr
<discocaml>
<akhilindurti> | B of int
<discocaml>
<akhilindurti> ```
alphacentauri has joined #ocaml
<discocaml>
<struktured> I was implying in a pure context, but sure, side effects add all sorts of exceptional considerations 🙂
greaser|q is now known as GreaseMonkey
Anarchos has joined #ocaml
dnh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dnh has joined #ocaml
Anarchos has quit [Ping timeout: 258 seconds]
<discocaml>
<Et7f3 (@me on reply)> Excel has let and lambda now (was happy to use it) they still suffer from restrictions. One day excel formula might have gadt
Serpent7776 has quit [Ping timeout: 255 seconds]
<discocaml>
<omnisci3nt> cheers ill take a squizz
bartholin has quit [Quit: Leaving]
aljazmc has quit [Remote host closed the connection]
Tuplanolla has quit [Quit: Leaving.]
alphacentauri has quit [Quit: WeeChat 4.0.5]
alphacentauri has joined #ocaml
<src>
I have two type constructors constructing trees, one using only a recurisve variant, the other making use of records
<src>
they seem similar enough (especially due to the names `Leaf` `Node`) to trip up OCaml's type inference
<src>
is there a way to make `tv` be of type `treevar`, as one would with `let tv : treevar` if it was a type (and not a type constructor)
<src>
(of course I could simply rename `Leaf` `Node` to be differently named for my two different trees, that's a solution but not my question)
<discocaml>
<._null._> `let tv : 'a treevar = ...` ?
<discocaml>
<._null._> It's also usually a bad idea to introduce to types with overlapping constructors in a single namespace, you can put them in different modules to have each available
<discocaml>
<._null._> two types*
<discocaml>
<Kali> or `let tv : _ treevar = ...`
<discocaml>
<Kali> but yes, you want to separate them
<discocaml>
<._null._> (You can also have `type 'a tree = Leaf | Node of { value : 'a; left: 'a tree; right: 'a tree }` if you only really want record syntax)