<shon>
There's a probably a better way to do this. I'll follow it if presented (^_^)
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
shinnya has quit [Ping timeout: 240 seconds]
govg has quit [Ping timeout: 276 seconds]
ziyourenxiang has joined #ocaml
FreeBirdLjj has joined #ocaml
govg has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 248 seconds]
MercurialAlchemi has joined #ocaml
fre3 has quit [Ping timeout: 252 seconds]
fre3 has joined #ocaml
slash^ has joined #ocaml
bungoman has joined #ocaml
bungoman has quit [Client Quit]
bungoman has joined #ocaml
snhmib has joined #ocaml
ygrek has quit [Ping timeout: 240 seconds]
govg has quit [Ping timeout: 255 seconds]
ocabot_ has quit [Remote host closed the connection]
ocabot_ has joined #ocaml
ocabot_ has quit [Remote host closed the connection]
ocabot_ has joined #ocaml
sk_ has joined #ocaml
sk_ is now known as Guest49201
Guest49201 is now known as Seidakey
ocabot_ has quit [Remote host closed the connection]
ocabot_ has joined #ocaml
ocalm_ has joined #ocaml
ocabot_ has quit [Remote host closed the connection]
ocabot_ has joined #ocaml
ocabot_ has quit [Remote host closed the connection]
ocabot_ has joined #ocaml
ocabot_ has quit [Remote host closed the connection]
ocabot_ has joined #ocaml
ocabot_ has quit [Remote host closed the connection]
ocabot_ has joined #ocaml
ocabot_ has quit [Remote host closed the connection]
ocabot_ has joined #ocaml
ocabot_ has quit [Remote host closed the connection]
ocabot_ has joined #ocaml
ocabot_ has quit [Remote host closed the connection]
ocabot_ has joined #ocaml
snhmib has quit [Ping timeout: 240 seconds]
orbifx has joined #ocaml
ocabot_ has quit [Remote host closed the connection]
ocabot_ has joined #ocaml
ocabot_ has quit [Remote host closed the connection]
ocabot_ has joined #ocaml
ocabot_ has quit [Remote host closed the connection]
ocabot_ has joined #ocaml
fre3 has quit [Ping timeout: 240 seconds]
snhmib has joined #ocaml
ocabot_ has quit [Remote host closed the connection]
ocabot_ has joined #ocaml
sepp2k has joined #ocaml
ocabot_ has quit [Remote host closed the connection]
ocabot_ has joined #ocaml
ocabot_ has quit [Remote host closed the connection]
ocabot_ has joined #ocaml
ocabot_ has quit [Remote host closed the connection]
ocabot_ has joined #ocaml
ocabot_ has quit [Remote host closed the connection]
ocabot_ has joined #ocaml
ocabot_ has quit [Remote host closed the connection]
ocabot_ has joined #ocaml
mfp has joined #ocaml
ocabot_ has quit [Remote host closed the connection]
ocabot_ has joined #ocaml
jnavila has joined #ocaml
orbifx1 has joined #ocaml
ocabot_ has quit [Remote host closed the connection]
ocabot_ has joined #ocaml
ocabot_ has quit [Remote host closed the connection]
ocabot_ has joined #ocaml
ocabot_ has quit [Remote host closed the connection]
ocabot_ has joined #ocaml
<jerith>
Aww, /act
<jerith>
Oops.
ocabot_ has quit [Remote host closed the connection]
<jerith>
Aww, ocaml-travis-coveralls doesn't work after a recent change to ocaml-ci-scripts.
ocabot_ has joined #ocaml
FreeBirdLjj has joined #ocaml
ocabot_ has quit [Remote host closed the connection]
ocabot_ has joined #ocaml
Simn has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 252 seconds]
ocabot_ has quit [Remote host closed the connection]
ocabot_ has joined #ocaml
malc_ has joined #ocaml
ocabot_ has quit [Remote host closed the connection]
ocabot_ has joined #ocaml
ocabot_ has quit [Remote host closed the connection]
ocabot_ has joined #ocaml
ocabot_ has quit [Remote host closed the connection]
ocabot_ has joined #ocaml
ocabot_ has quit [Remote host closed the connection]
ocabot_ has joined #ocaml
ocabot_ has quit [Remote host closed the connection]
ocabot_ has joined #ocaml
ocabot_ has quit [Remote host closed the connection]
ocabot_ has joined #ocaml
orbifx1 has quit [Ping timeout: 240 seconds]
ocabot_ has quit [Remote host closed the connection]
ocabot_ has joined #ocaml
zpe has joined #ocaml
ocabot_ has quit [Remote host closed the connection]
ocabot_ has joined #ocaml
shinnya has joined #ocaml
ocabot_ has quit [Remote host closed the connection]
ocabot_ has joined #ocaml
ocabot_ has quit [Remote host closed the connection]
ocabot_ has joined #ocaml
ocabot_ has quit [Remote host closed the connection]
ocabot_ has joined #ocaml
ocabot_ has quit [Remote host closed the connection]
ocabot_ has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 240 seconds]
orbifx has quit [Ping timeout: 255 seconds]
orbifx1 has joined #ocaml
ocabot_ has quit [Remote host closed the connection]
sepp2k has quit [Ping timeout: 240 seconds]
ocabot_ has joined #ocaml
ocabot_ has quit [Remote host closed the connection]
ocabot_ has joined #ocaml
<Leonidas>
maybe it should just be included in ci scripts tbh
ocabot_ has quit [Remote host closed the connection]
ocabot_ has joined #ocaml
ocabot_ has quit [Remote host closed the connection]
ocabot_ has joined #ocaml
sepp2k has joined #ocaml
ocabot_ has quit [Remote host closed the connection]
ocabot_ has joined #ocaml
tane has joined #ocaml
ocabot_ has quit [Remote host closed the connection]
ocabot_ has joined #ocaml
ocabot_ has quit [Remote host closed the connection]
ocabot_ has joined #ocaml
MercurialAlchemi has joined #ocaml
Seidakey has quit [Remote host closed the connection]
ocabot_ has quit [Remote host closed the connection]
ChristopheT has joined #ocaml
ocabot_ has joined #ocaml
Sim_n has joined #ocaml
ocabot_ has quit [Remote host closed the connection]
ocabot_ has joined #ocaml
Simn has quit [Ping timeout: 252 seconds]
MercurialAlchemi has quit [Ping timeout: 256 seconds]
ocabot_ has quit [Remote host closed the connection]
ocabot_ has joined #ocaml
shinnya has quit [Ping timeout: 258 seconds]
FreeBirdLjj has joined #ocaml
ziyourenxiang has quit [Quit: Leaving]
FreeBirdLjj has quit [Ping timeout: 240 seconds]
slash^ has quit [Read error: Connection reset by peer]
<jeroud>
Probably.
<jeroud>
I don't really understand what the CI scripts are really doing.
<jeroud>
Thinking about it, having the coveralls script run the tests a second time seems a bit silly.
slash^ has joined #ocaml
<jeroud>
I also want to figure out how to send coverage information to codecov.io, because that has some useful features that coveralls.io doesn't have.
<jeroud>
Leonidas: Do you think it's okay to only run tests one ocaml version?
<jeroud>
Because we can probably cut the build time in half by having the existing builds not run tests and adding a new build that runs tests but not the initial install.
jao has quit [Ping timeout: 240 seconds]
govg has joined #ocaml
nylar has joined #ocaml
nylar has quit [Client Quit]
MercurialAlchemi has joined #ocaml
orbifx1 has quit [Ping timeout: 255 seconds]
nomicflux has joined #ocaml
sh0t has joined #ocaml
fraggle-boate has joined #ocaml
infinity0_ has joined #ocaml
infinity0_ has joined #ocaml
infinity0 is now known as Guest54123
Guest54123 has quit [Killed (hobana.freenode.net (Nickname regained by services))]
infinity0_ is now known as infinity0
infinity0 has quit [Remote host closed the connection]
<Onemorenickname>
i am trying to make some big functor
<Onemorenickname>
inside, i have a big bloc of type declarations
<Onemorenickname>
and then, i have an other bloc of functions converting the previous types to strings
<Onemorenickname>
and then, an other bloc of functions doing some things with those types
<Onemorenickname>
i'm trying to move those blocs into other files
<zozozo>
well, seems like you want to split your functor into smaller ones ?
<Onemorenickname>
yep
<Onemorenickname>
So I made 3 small functors
<Onemorenickname>
(this sounds cute, btw)
<zozozo>
^^
<zozozo>
so what's the problem ?
<Onemorenickname>
I have type_functor, string_functor, and stuff_functor
<Onemorenickname>
string_functor and stuff_functor both includes type_functor
<Onemorenickname>
the problem when comes i want to include type_functor, string_functor and stuff_functor in the big_functor, as type_functor gets included 3 times
<Onemorenickname>
what is the good-way to do that ?
<zozozo>
well I usually try and have a single type per functor, which allows to avoid that mess
<zozozo>
are all your type mutually recursive/dependant on each other ?
<Onemorenickname>
the types defined in type_functor ? yes, indeed
<Onemorenickname>
(if they weren't, i would have splitted big_functor into independant functors)
<zozozo>
you could have module aliases in the signatures of your functors
octachron has joined #ocaml
<Onemorenickname>
what is it ?
<zozozo>
well, since 4.03 (I think), you can have module A = B in signatures, so that the equality between modules is visible at the type system
<Onemorenickname>
hm, i guess that's the kind of things i need
<Onemorenickname>
can i express things like type_functor included in big_functor is the same as type_functor included in big_functor via string_functor ?
<zozozo>
that said, I'm interested in what your functor does that need many mutually recursive types
<Onemorenickname>
(general earley parsing)
<zozozo>
probably, though it would be sufficient to have a single chain of inclusion
<zozozo>
i.e type_functor includeed in string_functor included in big_functor
<Onemorenickname>
problem is, i also have stuff_functor
<Onemorenickname>
so, even if i remove type_functor from big_functor, i can not include both string_functor and stuff_functor
<Onemorenickname>
(and i think the chain of inclusion is not a good idea even if i could do so : it's not the responsability of string_functor to bring types to big_functor)
<zozozo>
ah, sorry when I said "includeé, I meant have in their signature a link to the other module
<zozozo>
give me a minute to show you an example
<Onemorenickname>
ooooh
<octachron>
Onemorenickname, it sounds strange that type_functor itself is included inside string_functor? Are you sure that you need the functor itself and not only the resulting types?
<Onemorenickname>
octachron, that's what i was wondering
<Onemorenickname>
i only need the resulting types
<Onemorenickname>
does a functor define a type ?
<Onemorenickname>
i mean, type_functor takes a type MODULE_T
<Onemorenickname>
can my string_functor take a type_functor_result instead of a MODULE_T ?
<Onemorenickname>
if so, in my big_functor, i can do "Type = Type_Functor(Module_t)", and then, "String = String_Functor(Type)"
<Onemorenickname>
(i don't like code duplication)
<octachron>
Onemorenickname, a functor is a well typed object with signature "(functor M:s) -> signature"
<zozozo>
Onemorenickname: when I have to do things like that, I usually make it so that the later functors take all previous needed functor: so for instance String would take both Module_t and Type as arguments (with adequate type qualities)
<Onemorenickname>
perfect
<Onemorenickname>
thank you both :)
<Onemorenickname>
i will fiddle with the syntax to find the right one
<zozozo>
if you want an example of concrete code using quite a lot of functors you can take a look at https://github.com/Gbury/mSAT
<zozozo>
Onemorenickname: ^
<Onemorenickname>
(thanks for the hl)
<Onemorenickname>
i have a hard time looking at other ppl code
<Onemorenickname>
when a "struct end" module can be useful ?
<zozozo>
it is used to ensure generativity of the functor
<zozozo>
the Solver functor creates a module with a quite important mutable state
<zozozo>
so if you want two instances of a solver over the same structure of terms, you can do module S1 = Solver.Make (Expr_smt.Atom)(Th)(struct end) module S2 = Solver.Mak(..)(struct end)
<zozozo>
and S1 and S2 will be two differents modules with distinct internal mutable states
<Onemorenickname>
oh, i wondered how to do that once
<Onemorenickname>
that's how it's done haha
<zozozo>
^^
<Onemorenickname>
i thought you had to take that additional argument with you everywhere
<octachron>
zozozo, I imagine the code does not use "Solver.Make(…)() for compatibility reason with OCaml < 4.02 ?
<zozozo>
octachron: exactly
<zozozo>
some people using the lib have to support ocaml 4.00.1 iirc (i.e companion_cube )
<octachron>
Onemorenickname, if you do not have this constraint, you can use "module F() = struct end" and "module M = F()" to obtain the same behavior
<Onemorenickname>
nice
<Onemorenickname>
thanks !
<Onemorenickname>
"There is no equivalent to functors at the level of signature: it is not possible to build a signature by application of a ``functorial signature'' to other signatures."
<Onemorenickname>
:(
fre3 has joined #ocaml
<octachron>
Onemorenickname, this just means that you have to write the resulting signature yourself
Onemorenickname_ has joined #ocaml
<Onemorenickname_>
hello back
<Onemorenickname_>
octachron, i think i did not figure the solution :
<Onemorenickname_>
"There is no equivalent to functors at the level of signature: it is not possible to build a signature by application of a ``functorial signature'' to other signatures."
<Onemorenickname_>
so i cant pass the result of Type_functor
<Onemorenickname_>
also
<Onemorenickname_>
"The module Type_functor is a functor, not a structure", so I can't pass Type_functor, and then apply it to Elt
Onemorenickname has quit [Ping timeout: 240 seconds]
<zozozo>
are you trying to make a functor taking another functor as argument ?
<Onemorenickname_>
zozozo, when you've written "functors take all previous needed functor", you meant, "take as an include", not "take as an argument" ?
<octachron>
Onemorenickname_, you can simply write the resulting signature of the functor yourself
<zozozo>
I meant actually, take as argument the application of previous functors
<Onemorenickname_>
octachron, is there an other way, so i don't have to rewrite the whole signature ?
<octachron>
Onemorenickname_, generally it is possible to write a generic signature and then constraint the generic signature with "with" constraint
<octachron>
something like "F(X: s)(Y: r with type t = X.t … ) = … "
<Onemorenickname_>
i see :'(
<zozozo>
Onemorenickname_: btw, could you share the code in question ? maybe that could help us suggest solutions
<Onemorenickname_>
those are the files i'm struggling with
<zozozo>
are these the actual files, or some simplified version ?
<Onemorenickname_>
the actual files
<Onemorenickname_>
i have other complicated files
<Onemorenickname_>
but i'm trying with the simpler one first
<zozozo>
because as fas as actual code go, it doesn't seem very long so I would'nt see any drawback in putting everything in a single functor if it makes sense
shinnya has quit [Ping timeout: 258 seconds]
<Onemorenickname_>
but i have other functionnality code, and Earley_conversion will actually be in an other folder
<zozozo>
have you tried the following: taking a second argument in Earley_conversion, that second argument begin typically Earley_type(Elt) ?
<Onemorenickname_>
zozozo, i don't know how to do that
<Onemorenickname_>
when i've written that, i got a syntax error at the second parenthesis
<Onemorenickname_>
when i looked into the doc, i got "<Onemorenickname_> "There is no equivalent to functors at the level of signature: it is not possible to build a signature by application of a ``functorial signature'' to other signatures.""
FreeBirdLjj has joined #ocaml
<zozozo>
right right
<zozozo>
the first thing to do would be to declare separately the expected siganture of Earley_type
<Onemorenickname_>
but if i do so, how will Earley_conversion know what are letter, rule, item and so on ?
<Onemorenickname_>
i can do so by copy-pasting everything
<Onemorenickname_>
but i'd like to code-reuse rather than duplicating
<zozozo>
the important question is: identify the set of minimum core functions required to operate on your defined type, so that all your code can use these functions and not need to know the actual type definition
FreeBirdLjj has quit [Ping timeout: 260 seconds]
ChristopheT has quit [Ping timeout: 255 seconds]
<Onemorenickname_>
maybe it'd be easier to make all my types generic
<Onemorenickname_>
and my functions too, by passing explicitely eq and t_to_string
<zozozo>
well... it can quickly become tiresome to do so
<zozozo>
also, the problem is the same than with sets: if each set keeps his own compare function, how do you create the union of two sets with different comparison functions
<Onemorenickname_>
i don't know what's more tiresome between doing that and duplicating signatures
<zozozo>
you don't need to duplicate sigantures
<Onemorenickname_>
i don't know what would be the union of sets with different comparisons functions
<zozozo>
well that's exaclty the problem, and why Set is a functor rather than a record containing a compare function
<zozozo>
that way, the type system ensures that you cannot mix sets using different comarisons
<Onemorenickname_>
well, "union (cmp: 'a comparison) (cmp2: 'a comparison) etc." and that's it ?
<Onemorenickname_>
oh, but there can be different comparisons functions of the same type haha
<zozozo>
^^
<Onemorenickname_>
i get it
<Onemorenickname_>
but i need to duplicate all my types definition in earley_type in a signature, so the other can know what it is
<zozozo>
well my advice would be: hide the type definitions in your module signatures
<zozozo>
it really helps
<Onemorenickname_>
i tend to make complex types for easy debugging and prototyping, and i need them exposed, because i operate on them
<zozozo>
the point is to confine the functions that really need access to a type's internal, so that they all live in the same module where the types are defined
<zozozo>
for debugging, what you usually need is a print function
<zozozo>
it's the same as the Map, Set and Hashtbl module in the stdlib, you do not have access to the type definitions
<Onemorenickname_>
i know, but their interfaces is rather simple, so you can do that
<Onemorenickname_>
i don't like having files of +300 lines for instance
<zozozo>
well, usually you can almost always provide a base interface that allow to build on it
<zozozo>
ow, my personnal limit is more around 1 or 2k lines
<zozozo>
still my point remans the same : try and see what base functions are really needed to operate on your types; usually there's not a lot
yomimono has joined #ocaml
Onemorenickname_ has quit [Ping timeout: 256 seconds]
rgrinberg has joined #ocaml
rgrinberg has quit [Remote host closed the connection]
rgrinberg has joined #ocaml
<Drup>
yeah, 300 lines is very little, and certainly not enough to start spliting your code
<jerith>
The ones I don't like are multi-thousand line files with multi-thousand long lines.
<jerith>
(I was digging in some xen-api code recently. It made github's webui quite sad.)
<Drup>
sure, functions shouldn't be too long, but each file .. meh, 1k to 2k lines is fine
<Drup>
oh, he's not here anymore :/
Saroupille has quit [Quit: Page closed]
<zozozo>
^^
william-s has joined #ocaml
<Leonidas>
jeroud: yeah, I think running tests only with the current stable and presuming we don't trigger compiler bugs is alright
<jerith>
Cool.
<Leonidas>
jeroud = jerith?
<jerith>
Yup. jeroud is my IRCCloud account that I use from my phone.
<jerith>
jerith is my real client that I use from a computer.
orbitz has quit [Quit: leaving]
<Leonidas>
I see
wtetzner has joined #ocaml
yomimono has quit [Ping timeout: 258 seconds]
obadz has quit [Quit: brb]
obadz has joined #ocaml
nomicflux has joined #ocaml
orbitz has joined #ocaml
sh0t has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
govg has quit [Ping timeout: 258 seconds]
FreeBirdLjj has quit [Ping timeout: 258 seconds]
govg has joined #ocaml
jnavila has quit [Ping timeout: 240 seconds]
zpe has quit [Remote host closed the connection]
obadz has quit [Ping timeout: 245 seconds]
obadz has joined #ocaml
sh0t has joined #ocaml
sh0t has quit [Client Quit]
Xadnem has joined #ocaml
P4Titan has joined #ocaml
<P4Titan>
Hi all. I have a rather long record in its own Module. However, when I create an instance of it, it says it contains fields not visible in the current scope.
<P4Titan>
What would be good practice to instantiating this record? Finding a way to use the {...} systax while finding a way to make its type known, or creating a `create` function in the Module that would act as a sort of record constructor?
<P4Titan>
I'm looking for what is good OCaml practice.
<Drup>
you can use the notation `{M. foo = 4 ; bar = 5}` to use fields of a record defined in the module M
<P4Titan>
hmm, what does the M. do?
<Drup>
it's like M.foo, it's to access things in modules
<P4Titan>
is that _the_ way to do this?
<P4Titan>
I just did it, but it looks a bit ugly
<P4Titan>
it works though
<Drup>
well, if you want to expose the record, yes, it's the usual way. You can also expose a `M.create` function, that's up to you
<P4Titan>
I feel like the latter is more applicable. Also, is there a way to open only a single function from a module
<P4Titan>
or a single type
<P4Titan>
but not everything? I'm curious.
<Drup>
the common style is to use it qualified
<P4Titan>
oo, ok
<P4Titan>
Thanks!
orbifx has joined #ocaml
<Drup>
you can rebound modules if you find them too long, "module A = AVeryLongModule.With.Submodules"
<P4Titan>
Yes
<P4Titan>
But there isn't a Python-esque: "from module import function"
<orbifx>
there is in a way
<orbifx>
let f = Module.function_name in ..
<P4Titan>
Yeah, that's what I was thinking
<Drup>
qualified access is more common (and, imho, cleaner)
<P4Titan>
ok
handlex has joined #ocaml
malc_ has quit [Remote host closed the connection]
<octachron>
it is quite a shame that qualified access does no work for binary operators
<Drup>
yeah, I tried to make that work once
<Drup>
it's very non-LR(1)
<Drup>
you could try to make it work-ish, by doing things in the lexer but ..urk
infinity0 has joined #ocaml
handlex has quit [Quit: handlex]
<orbitz>
P4Titan: I usually keep all types hidden and then have a M.View module which exposes a view of the type which may happen to be its actual representation.
orbifx1 has joined #ocaml
<orbitz>
And then I'll have an M.create or an M.of_view
slash^ has quit [Read error: Connection reset by peer]
P4Titan has quit [Ping timeout: 255 seconds]
kakadu has joined #ocaml
rgrinberg has quit [Remote host closed the connection]
rgrinberg has joined #ocaml
mengu has joined #ocaml
nomicflux has quit [Quit: nomicflux]
diphuser has joined #ocaml
nomicflux has joined #ocaml
zpe has joined #ocaml
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
ChristopheT has joined #ocaml
wtetzner has quit [Remote host closed the connection]
zpe has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 240 seconds]
MercurialAlchemi has quit [Ping timeout: 276 seconds]
kakadu has quit [Ping timeout: 258 seconds]
ocalm_ has quit [Ping timeout: 248 seconds]
kakadu has joined #ocaml
wtetzner has joined #ocaml
ocalm_ has joined #ocaml
ygrek has joined #ocaml
rgrinberg has quit [Remote host closed the connection]
Xadnem has quit [Quit: leaving]
jao has joined #ocaml
diphuser has quit [Quit: leaving]
nomicflux has quit [Quit: nomicflux]
ygrek has quit [Ping timeout: 255 seconds]
octachron has quit [Quit: Leaving]
ocalm_ has quit [Ping timeout: 248 seconds]
tane has quit [Quit: Leaving]
diphuser has joined #ocaml
kakadu has quit [Remote host closed the connection]
<cheater>
if i'm matching against a value like | Some (foo, bar) can I give (foo, bar) a name to refer to it all later?
<Drup>
Some ((foo,bar) as baz)
<cheater>
ah yeah was just going to say i found the "as" keyword
<cheater>
beat me to it Drup :))
<cheater>
thanks :)
<_y>
don't you fall into the syntax trap about constructors with 2 parameters versus constructors with one tuple parameter?
<Drup>
_y: in general yes, but with Some, you're fine :)
<_y>
oops indeed
average has quit [Ping timeout: 245 seconds]
<cheater>
what syntax trap?
<cheater>
sorry
<cheater>
i don't get it
average has joined #ocaml
<_y>
type xd = A of int * int
<_y>
type lol = B of (int * int)
<_y>
xd ≠ lol
<cheater>
what's the difference?
<cheater>
i've had another question too, if that's ok. if i have a type constructor with some fields, and then i match on it, can i skip some fields?
<_y>
A is a constructor which takes two parameters, the syntax for that is ‘A (4, 2)’. here ‘(4, 2)’ looks like a tuple but is only syntax to designate the two arguments of A, it is not a value by itself
<cheater>
what is B?
<_y>
thus ‘A ( (4,2) )’ (giving A only one parameter of type tuple) is an error
<_y>
B is a constructor which takes one parameter of type tuple, so you can write ‘B (4,2)’, or ‘B (4,2)’, or ‘B any_value_of_type_tuple’
<_y>
(my second example should be ‘B ( (4,2) )’)
orbifx1 has quit [Ping timeout: 264 seconds]
<_y>
indeed cheater, the syntax is confusing here
<cheater>
zozozo i looked at it but i got kinda confused :D
<_y>
a neater / more consistent syntax would use currification as for function calls
<_y>
ie:
<_y>
type xd = A : int -> int -> xd
<_y>
A 4 2
<_y>
type lol = B : (int * int) -> lol
<_y>
B (4,2)
FreeBirdLjj has joined #ocaml
<cheater>
that's just GADT syntax right
<zozozo>
cheater: well for instance if you have type t = A of int * int | B of (int * int), then A(1,2) is actually represented by a single block in memory (containing two fields which representes 1 and 2), while B(3,5) is represented by a block with one fiedl which points to the tuple (3,4)
<cheater>
zozozo: so it's like boxed/unboxed in Haskell?
<_y>
cheater, indeed for type definition, but the « A 4 2 » syntax doesn’t exist in current OCaml
<cheater>
aha
<zozozo>
I don't know haskell very well so I can't really answer, :p
<cheater>
that's pretty cool, thanks
<cheater>
zozozo: ok :p
<_y>
(it was the notation of the former Caml Light)
<cheater>
so guys what about matching on constructors... am i allowed to skip fields?
<_y>
_
<cheater>
no not with _
<cheater>
just leave them out
<zozozo>
well if you want to skip fields, you should consider inline records
<cheater>
i'm looking at some code and in the definition a constructor has 3 fields
<cheater>
but where it's matched against it has 2 fields
<cheater>
and i'm confused ??? :\
<_y>
if you match on (inline or not) records, you can just not name the fields you don’t use)
<_y>
-)
<cheater>
ah so it's as i suspected
<cheater>
they just skipped that stuff
FreeBirdLjj has quit [Ping timeout: 248 seconds]
ChristopheT has quit [Ping timeout: 255 seconds]
<cheater>
thanks for explaining this to me! :)
nomicflux has joined #ocaml
orbifx has quit [Ping timeout: 255 seconds]
<vramana>
Is there a way to see all the verbose log of all commands run by oasis?
<vramana>
I want to understand how the c files are being compiled and linked to the OCaml code.
<Drup>
vramana: you can just look at _build/_logs
<vramana>
Drup: Thanks
<vramana>
ocamlmklib seems to be what I am looking for.