<ocaml932>
What exactly does the `Unbound module` error mean? Tried running an example from github and getting it. at the top of the file I have `open Opium.Std` but get Unbound module Opium
Heasummn has joined #ocaml
sh0t has joined #ocaml
srcerer has joined #ocaml
infinity0 has joined #ocaml
jao has quit [Ping timeout: 252 seconds]
ocaml932 has quit [Quit: Page closed]
Sorella has quit [Quit: Connection closed for inactivity]
Sorella has joined #ocaml
pierpa has quit [Ping timeout: 260 seconds]
brunoro has joined #ocaml
brunoro has quit [Ping timeout: 252 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
struktured has joined #ocaml
FreeBirdLjj has joined #ocaml
struktured has quit [Ping timeout: 260 seconds]
voglerr has joined #ocaml
jg_ has joined #ocaml
voglerr has quit [Ping timeout: 244 seconds]
conrad4 has joined #ocaml
conrad4 has quit [Ping timeout: 250 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
brunoro has joined #ocaml
brunoro has quit [Ping timeout: 252 seconds]
Heasummn has quit [Remote host closed the connection]
struktured has joined #ocaml
struk|desk has joined #ocaml
sh0t has quit [Remote host closed the connection]
brunoro has joined #ocaml
brunoro has quit [Ping timeout: 260 seconds]
nomicflux has quit [Quit: nomicflux]
ggole has joined #ocaml
noddy has quit [Ping timeout: 260 seconds]
jg_ has quit [Read error: Connection reset by peer]
noddy has joined #ocaml
conrad4 has joined #ocaml
ggole_ has joined #ocaml
conrad4 has quit [Ping timeout: 245 seconds]
ggole has quit [Ping timeout: 256 seconds]
ggole__ has joined #ocaml
ggole_ has quit [Ping timeout: 260 seconds]
brunoro has joined #ocaml
ggole_ has joined #ocaml
brunoro has quit [Ping timeout: 260 seconds]
ggole__ has quit [Ping timeout: 256 seconds]
ggole__ has joined #ocaml
ggole_ has quit [Ping timeout: 276 seconds]
ggole_ has joined #ocaml
groovy3shoes has quit [Quit: Leaving]
ggole__ has quit [Ping timeout: 256 seconds]
ggole__ has joined #ocaml
ggole__ has quit [Read error: Connection reset by peer]
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has quit [Remote host closed the connection]
slash^ has joined #ocaml
conrad4 has quit [Ping timeout: 250 seconds]
FreeBirdLjj has joined #ocaml
AlexDenisov has joined #ocaml
brunoro has joined #ocaml
brunoro has quit [Ping timeout: 256 seconds]
<iyy>
i'm implementing a recursive descent parser. my tokens produced by lex are defined by one variant type. with this approach, what would be the easiest way to implement the typical "expect <variant_type>" functionality? at the moment i'm just adding "match toktype with" all over the place and it's getting pretty verbose
brunoro has joined #ocaml
TheLemonMan has joined #ocaml
brunoro has quit [Ping timeout: 260 seconds]
conrad4 has joined #ocaml
conrad4 has quit [Ping timeout: 260 seconds]
rand__ has joined #ocaml
brunoro has joined #ocaml
AlexDenisov has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
nicholasf has quit [Remote host closed the connection]
okuu has quit [Quit: Unyu~.]
brunoro has joined #ocaml
jg_ has joined #ocaml
brunoro has quit [Ping timeout: 256 seconds]
okuu has joined #ocaml
okuu has quit [Remote host closed the connection]
okuu has joined #ocaml
SpiceGuid has joined #ocaml
sh0t has quit [Remote host closed the connection]
FreeBirdLjj has quit [Remote host closed the connection]
soupault has joined #ocaml
petroav_ has quit [Ping timeout: 260 seconds]
jnavila has quit [Ping timeout: 260 seconds]
slash^ has quit [Read error: Connection reset by peer]
jg_ has quit [Ping timeout: 250 seconds]
Onemorenickname has joined #ocaml
<Onemorenickname>
hi !
<Onemorenickname>
if i have a polymorphic variant type t (like type t = [`A of string | `B of int]), how can i define tc as [t|`C of float] and ta as [t / `A of string] ?
<ggole>
You can do the first (actually, just as you wrote it), but not the second
<Onemorenickname>
ggole, the second syntax is wrong, or the possibility does not exist ?
<ggole>
There's no way to directly remove a variant.
<Onemorenickname>
hm
<ggole>
You can get a similar effect by splitting t into the parts that you want to remove and the ones that don't, and define b in terms of those.
<Onemorenickname>
Thanks for the answer :)
<ggole>
It's a bit fiddly.
<Onemorenickname>
ofc, but I like "expressive" code
<Onemorenickname>
(i don't know how to say that in english)
<ggole>
It would be nice to have various set operations on polymorphic variants, yeah
<Onemorenickname>
actually, i figured out that most of the time, polymorphic variants are what i need
<Onemorenickname>
why is the "pitfall" wrt classic variants ?
<ggole>
Some programming mistakes are not caught as conveniently
Onemorenickname_ has joined #ocaml
<ggole>
(And they aren't represented quite as efficiently, if you care about that.)
<Onemorenickname_>
Sorry, i got disconnected
<ggole>
<ggole> Some programming mistakes are not caught as conveniently
<Onemorenickname_>
such as ?
<Onemorenickname_>
(or when can i find resources detailing that ?)
<ggole>
Misspelling a variant
brunoro has joined #ocaml
pitastrudl has quit [Remote host closed the connection]
Onemorenickname has quit [Ping timeout: 260 seconds]
Onemorenickname has joined #ocaml
zpe has joined #ocaml
Onemorenickname_ has quit [Ping timeout: 250 seconds]
pitastrudl has joined #ocaml
jao has joined #ocaml
<Drup>
and you need to annotate more if you want tests about exhaustiveness and unused cases
brunoro has quit [Ping timeout: 260 seconds]
aluuu has joined #ocaml
dreadedfrog_wut has quit [Ping timeout: 245 seconds]
conrad4 has joined #ocaml
aluuu has quit [Ping timeout: 245 seconds]
petroav_ has joined #ocaml
conrad4 has quit [Ping timeout: 256 seconds]
aluuu has joined #ocaml
|jbrown| has joined #ocaml
<adrien>
in a .mli file, is it possible to only list a subset of the members of a polymorphic variant type?
<ggole>
A subset of the members in the .ml? That isn't sound.
<adrien>
I have type t = [ `A | `B ] in the .ml and I'd like to have type t = [ `A ] in the .mli
<rand__>
what is your goal?
<adrien>
feels logical to me
<adrien>
rand__: really, not export all the fields
<ggole>
It doesn't work, functions over t have to know about `B so they don't crash with an unexpected value
<adrien>
hmm, true
jnavila has joined #ocaml
<rand__>
adrien: I meant why you don't want to expose them
<adrien>
they're internal to the module and since they are of the form `A of foo, a type "foo" must also be visible (and so on)
<adrien>
but the first reason is really that they're internal
<ggole>
In that case, why are you exposing t?
<ggole>
Are there some public and some internal cases?
<adrien>
yes
<rand__>
guess the best way is to make injections/extract functions for a new exposed type returning a 'exposed_variants option' ?
AlexDenisov has joined #ocaml
<ggole>
Or use something else, like an extensible variant (which may not actually be an improvement, but does allow for public and hidden constructors.)
okuu has quit [Remote host closed the connection]
<adrien>
I'm using polymorphic variants between the fields I want to expose are used across several modules (i.e. they're a common API)
<rand__>
here the private part is not lost - just abstracted away
SpiceGuid has left #ocaml [#ocaml]
<rand__>
then one might choose to only expose functions that are composed with 'extract', and internally work with the private type
Onemorenickname has quit [Ping timeout: 260 seconds]
Onemorenickname has joined #ocaml
rgrinberg has joined #ocaml
<adrien>
rand__: I see, it's simpler than what I had in mind
<rand__>
.. and well, maybe also composed with inject so user can combine functions - but then it might get heavier
shakalaka has quit [Quit: bye.]
jg_ has quit [Read error: Connection reset by peer]
shakalaka has joined #ocaml
mehdib has quit [Remote host closed the connection]
mehdib has joined #ocaml
ygrek has joined #ocaml
ggole has quit []
mehdib has quit [Quit: No Ping reply in 180 seconds.]
mehdib has joined #ocaml
dmruiz has joined #ocaml
<dmruiz>
hello, I have 2 modules in separate files, lets call them A and B. There exist dependecies between them and when I try to compile one of them the compiler complains (Unbound type constructors)
<dmruiz>
how can I compile them ?
<dmruiz>
the current command I am using is ocamlopt -c A.mli; ocamlopt -c A.ml; ocamlopt -c B.mli; ocamlopt -c B.ml
ode has joined #ocaml
mehdib has quit [Quit: No Ping reply in 180 seconds.]
mehdib has joined #ocaml
MercurialAlchemi has quit [Quit: Lost terminal]
MercurialAlchemi has joined #ocaml
|jbrown| has joined #ocaml
MercurialAlchemi has quit [Remote host closed the connection]
MercurialAlchemi has joined #ocaml
brunoro has joined #ocaml
mehdib has quit [Ping timeout: 260 seconds]
mehdib has joined #ocaml
<rand__>
dmruiz: I would recommend using 'ocamlbuild main_module.native' instead of using ocamlopt directly - then you can make a '_tags' file that declares package dependencies etc. when you need it
brunoro has quit [Ping timeout: 256 seconds]
nomicflux has quit [Read error: Connection reset by peer]
<rand__>
.. where main_module is the module that runs the 'tree of module dependencies' - you cannot have circular module dependencies when the modules are not in the same file
diphuser has joined #ocaml
brunoro has joined #ocaml
ocaml079 has joined #ocaml
zpe has quit [Remote host closed the connection]
conrad4 has joined #ocaml
nomicflux has joined #ocaml
<dmruiz>
rand__, thanks, reading ocamlbuild doc right now :)
zpe has joined #ocaml
brunoro has quit [Ping timeout: 256 seconds]
okuu has quit [Quit: Unyu~. Fix config.]
<ocaml079>
is there flambda specialist on the channel ?
conrad4 has quit [Ping timeout: 260 seconds]
<sspi>
is it possible to have a identifier named "type" without ocamllex giving errors? (note: not using it for OCaml, but a custom syntax)
<sspi>
nevermind, it's always an issue when it's a keyword - had hoped the ordering of the rules would matter
rgrinberg has quit [Remote host closed the connection]
nomicflux has quit [Quit: nomicflux]
AlexRussia has quit [Ping timeout: 250 seconds]
Onemorenickname has quit [Ping timeout: 265 seconds]
rgrinberg has joined #ocaml
prettynice has joined #ocaml
<prettynice>
hello
<prettynice>
i need a bit of help
<prettynice>
how would i go about printing the elements of a set that is contained within an other set?
soupault has quit [Remote host closed the connection]
prettynice_ has joined #ocaml
prettynice has quit [Ping timeout: 260 seconds]
ocaml079 has quit [Ping timeout: 260 seconds]
nomicflux has joined #ocaml
<prettynice_>
anyone?
ode has quit [Ping timeout: 250 seconds]
rgrinberg has quit [Remote host closed the connection]
<aantron>
prettynic_: can you be more clear on what you have?
<aantron>
you instantiated Set.Make
<aantron>
and got a module, say, M, and you have an M.t. it has some subset you want to print?
rgrinberg has joined #ocaml
AlexRussia has joined #ocaml
Algebr has quit [Ping timeout: 260 seconds]
rgrinberg has quit [Remote host closed the connection]
<aantron>
if that's the case, and the elements have type "elt" and you have a function "print : elt -> unit", you can do something like "your_set |> M.filter predicate_that_defines_your_subset |> M.iter print
<aantron>
prettynice_: * ^
<prettynice_>
oh
<prettynice_>
i have a module CS
<prettynice_>
which is Make.Set(Char)
<prettynice_>
and an other module CSS which is Make.Set(CS)
<prettynice_>
which is a set of sets of characters
<aantron>
right, ok
<prettynice_>
now, i have a CSS set
<prettynice_>
how do i see the elements of each one of its elements
<aantron>
you could define a function for printing CS.t
<aantron>
then use that to define a function for printing CSS.t
<prettynice_>
oh, sorry
<prettynice_>
i didnt mean print
<prettynice_>
i just meant show the elements
<prettynice_>
i tried something like this
A2` has joined #ocaml
<prettynice_>
let test set = List.iter CS.elements (CSS.elements set)
sh0t has joined #ocaml
<aantron>
so you mean converting the set to a list
<prettynice_>
yeah, pretty much
<prettynice_>
or rather
<prettynice_>
to a list of lists
<prettynice_>
from a set of sets
<prettynice_>
that gives me an idea
<aantron>
you will need to use fold on the outer set for this i think
<prettynice_>
i tried that
<prettynice_>
somehow
<prettynice_>
i didnt think i did it right
<aantron>
i guess it depends on what you do first
<aantron>
you approach makes more sense if fixed actually
<aantron>
first apply CSS.elements to the outer set
<aantron>
then apply List.map CS.elements to that
<prettynice_>
hm
<prettynice_>
i tried to do
<prettynice_>
list.iter to the CSS.elements
<prettynice_>
and it didnt work
<prettynice_>
let me try
<aantron>
it should be something like "CSS.elements outer_set |> List.map CS.elements"
<aantron>
aka just replace iter by map
rgrinberg has joined #ocaml
<prettynice_>
it dont work
rgrinberg has quit [Remote host closed the connection]
<aantron>
can you be more precise?
<prettynice_>
it work
<aantron>
:p
<prettynice_>
what does the |> mean
<aantron>
"x |> f" is the same as "f x"
<aantron>
more usefully x |> f |> g is g (f x)
<aantron>
its just a way to write function composition so you read it in the order the functions are applied
<prettynice_>
so that same thing could be written as
<aantron>
its basically your code with iter replaced by map, i just spaced out for a moment when you first wrote it :p
iyy has quit [Quit: leaving]
<prettynice_>
right
<prettynice_>
thanks
<prettynice_>
it didnt work with iter and i was getting upset
<prettynice_>
i was sure it should work
<prettynice_>
guess i was thinking about map not iter
rgrinberg has joined #ocaml
<aantron>
yeah, iter does something else
<prettynice_>
bad news is, the function i needed to check with that code doesnt work :\
<prettynice_>
or rather, doesnt do what it gotta do
<aantron>
ah, the joy of programming :p
<prettynice_>
is this irc generally active?
<aantron>
yes
<prettynice_>
oh, sweet
<aantron>
generally its pretty active, but last few days have been kind of slow
<prettynice_>
i might need help from time to time with trivialities
<aantron>
just scrolling up i see several newbies asked questions and left before anyone answered :/ hate it when that happens, but it usually doesnt
<prettynice_>
im a newbie too but i needed the answer
<prettynice_>
i was pretty sure the function would work
<prettynice_>
:(
<aantron>
should use the type system to your advantage. if something evaluates to unit, it's only interesting for side effects (like output, or setting a reference)
<aantron>
so iter is for applying a side-effecting function to some "collection"
<aantron>
and it does not evaluate directly to a useful result
<prettynice_>
oh right
rgrinberg has quit [Remote host closed the connection]
<prettynice_>
i cant output elements of a list like that
<prettynice_>
silly me
<prettynice_>
i can add the elements to a new list tho
<aantron>
not sure what you mean, but sure you can output a list of characters: List.iter print_char your_list
<aantron>
and same for a char list list: List.iter (List.iter print_char) your_outer_list
zpe has quit [Remote host closed the connection]
<aantron>
or with somewhat different syntax, List.(iter (iter print_char) your_outer_list)
prettynice_ has quit [Ping timeout: 260 seconds]
rgrinberg has joined #ocaml
brunoro has joined #ocaml
ode has joined #ocaml
brunoro has quit [Ping timeout: 245 seconds]
orbifx has joined #ocaml
<orbifx>
hello all
<orbifx>
I think I asked this before here, but can't remember the discussion;
jnavila has joined #ocaml
<orbifx>
what is defacto option for unicode in OCaml?
<orbifx>
I know there are some libraries
rgrinberg has quit [Remote host closed the connection]