<dh`>
is there a clean prefab solution for maps from simple enumerations? (particularly when you know you want it to always have a value for each constructor in the enum?)
<dh`>
you can obviously use Map but it seems unnecessarily cumbersome
<dh`>
and it can't enforce completeness (a value always present for each entry)
<dh`>
it's easy enough to handroll a type using a tuple but it's a bunch of ugly boilerplate
<dh`>
and there doesn't seem to be a way to use a functor to build those types either
bgs has joined #ocaml
<discocaml>
<deepspacejohn> I don’t have a prefab solution, but “map which always has specific keys and each always holds a value” sounds like it could just be a record.
wingsorc has quit [Ping timeout: 248 seconds]
<discocaml>
<darrenldl> or just a function from enum to whatever value
bgs has quit [Remote host closed the connection]
dmbaturin has joined #ocaml
xd1le has joined #ocaml
<dh`>
neither of those can be iterated
<dh`>
in particular, the record form ends up being the same as the tuple form
<discocaml>
<deepspacejohn> Well, it can be iterated in an unrolled form: `let iter f t = f t.foo; f t.bar; f t.baz`
<discocaml>
<geoff> The deriving_fields ppx may have some of what you are looking for
<discocaml>
<geoff> The `deriving_fields` ppx may have some of what you are looking for
Haudegen has quit [Ping timeout: 256 seconds]
chrisz has quit [Ping timeout: 246 seconds]
waleee has quit [Ping timeout: 240 seconds]
chrisz has joined #ocaml
<dh`>
ideally adding a constructor to the enum would cause the build to fail if the iterator didn't get updated
<oriba>
last time when I had opam-problems, I deinstalled opam, wiped out $HOME/.opam, installed opam again, dit opam init and installed what I needed - problems were solved
<discocaml>
<geoff> The old switch stuff being visible after setting a new switch I think would be because you need to eval the env
<oriba>
opam: 415 Issues, 76 pull requests
<discocaml>
<geoff> and?
<oriba>
46 Bugs
<oriba>
hmhh
<discocaml>
<Commutative Conjecture> Any one has an example of a dune file for menhir where you can depend on an external library? I am trying to use a core data structure in my semantic actions and i struggle
<discocaml>
<Commutative Conjecture> Aaaa
<discocaml>
<Commutative Conjecture> %{lib:core} doesn't work anymore on 3.0 so I can not use it to call ocamlc -i myself
bgs has quit [Remote host closed the connection]
trillion_exabyte has quit [Ping timeout: 248 seconds]
trillion_exabyte has joined #ocaml
<discocaml>
<deepspacejohn> It should just have access to any libraries you have specified in the dune file's library/executable `(libraries ...)` stanza, unless I'm misunderstanding.
Serpent7776 has quit [Ping timeout: 248 seconds]
bartholin has quit [Quit: Leaving]
alexherbo2 has quit [Remote host closed the connection]