<rgrinberg>
so there was an attempt to fix but it's not worth breaking compatibility
shinnya has quit [Ping timeout: 260 seconds]
f[x] has joined #ocaml
Eyyub has quit [Quit: Lost terminal]
talzeus has quit [Read error: Connection reset by peer]
wolfnn has quit [Ping timeout: 272 seconds]
thomasga has quit [Quit: Leaving.]
Eyyub has joined #ocaml
mocrunsthecity has quit [Remote host closed the connection]
jao has joined #ocaml
jao has quit [Changing host]
jao has joined #ocaml
boogie has joined #ocaml
robink has quit [Quit: No Ping reply in 180 seconds.]
robink has joined #ocaml
ollehar has quit [Ping timeout: 260 seconds]
f[x] has quit [Ping timeout: 264 seconds]
talzeus has joined #ocaml
boogie has quit [Remote host closed the connection]
Guest3890 has quit [Remote host closed the connection]
nikki93 has quit [Remote host closed the connection]
f[x] has joined #ocaml
pacemkr has joined #ocaml
philtor has joined #ocaml
boogie has joined #ocaml
boogie has quit [Remote host closed the connection]
yacks has joined #ocaml
zRecursive has joined #ocaml
kyrylo has quit [Ping timeout: 272 seconds]
cesar_ has joined #ocaml
cesar_ is now known as Guest18049
Guest18049 has quit [Remote host closed the connection]
pacemkr has quit [Quit: Leaving.]
xaimus has quit [Quit: leaving]
martintrojer has quit [Ping timeout: 252 seconds]
mocrunsthecity has joined #ocaml
<rgrinberg>
is pat+ in ocamllex greedy?
xaimus has joined #ocaml
martintrojer has joined #ocaml
mmachenry has joined #ocaml
<mmachenry>
I am having trouble building a new project with Oasis and would love it if someone could tell me what I'm doing wrong. I have gotten my modules to compile but I am getting an error where a class defined in one module is not visible to a module using it now. https://github.com/dskippy/Roundstream
<rgrinberg>
mmachenry: pastebin the error?
lostcuaz has joined #ocaml
<mmachenry>
rgrinberg: Sure
<mmachenry>
It can't fine thread_list (the class) pasting now
<rgrinberg>
oh i think i know what the error is
<rgrinberg>
remove module ThreadList = struct
<rgrinberg>
and the corresponding end statement at the end of the file
<rgrinberg>
then rename the file to be threadList.ml
<mmachenry>
rgrinberg: Really? Can you walk me through the reasoning?
<mmachenry>
So the file in ocaml is an implicit top-level module then?
<rgrinberg>
right now your class is visible to outside modules as: ThreadList.ThreadList.thread_list
<rgrinberg>
yeah
<mmachenry>
Oh damn
<mmachenry>
Okay.
<mmachenry>
So why rename to threadList.ml?
<rgrinberg>
ThreadList.ml is equivalent but the convention is lowercase start of file
<mmachenry>
I'm trying to get used to following the OCaml conventions as much as possible.
<rgrinberg>
actually the most idiomatic module name would be: Thread_list
<rgrinberg>
hence thread_list.ml is appropriate
<mmachenry>
Okay. so lowercase thread_list will give it the module name Thread_list
<rgrinberg>
yep
<mmachenry>
Is it most idiomatic to have all of my internal modules just be files with no module keyword unless I want to have internal modules?
<rgrinberg>
for small projects it doesn't matter too much but bigger projects definitely tend to split modules into separate files
<rgrinberg>
the reason for this is that it speeds up compilation by a lot
<mmachenry>
Yes. Splitting files I would definitely do. But would you say that when doing that most Ocaml projects don't have a module Foo = struct or anything at their top level
<mmachenry>
?
<rgrinberg>
usually no that's right
<rgrinberg>
but some do for example big projects collect all the modules under a single module to emulate namespaces
<mmachenry>
Thanks a bunch, rgrinberg. The project builds now.
<rgrinberg>
np
mmachenry has left #ocaml []
jbrown has quit [Ping timeout: 272 seconds]
Eyyub has quit [Ping timeout: 272 seconds]
lostcuaz has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
boogie has joined #ocaml
boogie has quit [Remote host closed the connection]
boogie has joined #ocaml
divyansr has joined #ocaml
f[x] has quit [Remote host closed the connection]
zxqdms has quit [Quit: leaving]
ygrek has joined #ocaml
divyansr has quit [Remote host closed the connection]
divyansr has joined #ocaml
ygrek has quit [Ping timeout: 272 seconds]
axiles has joined #ocaml
cesar_ has joined #ocaml
cesar_ is now known as Guest59174
divyansr has quit [Remote host closed the connection]
Guest59174 has quit [Remote host closed the connection]
ggole has joined #ocaml
boogie has quit [Remote host closed the connection]
mmachenry has joined #ocaml
<mmachenry>
Could I get some input on the people's thoughts on the best command-line parser for OCaml? I see Command, Arg, ocaml-getopt, and Cmdliner. Anyone prefer any one library for this?
dant3 has joined #ocaml
divyansr has joined #ocaml
<ggole>
I'd say use whatever's in the stdlib unless it isn't good enough
philtor has quit [Ping timeout: 260 seconds]
ygrek has joined #ocaml
mmachenry has quit [Quit: Leaving.]
mmachenry has joined #ocaml
yacks has quit [Quit: Leaving]
boogie has joined #ocaml
patojo has joined #ocaml
boogie has quit [Ping timeout: 272 seconds]
patojo has quit [Ping timeout: 246 seconds]
jao has quit [Ping timeout: 260 seconds]
<adrien>
morning
<nicoo>
o/ adrien
<mmachenry>
Morning.
<mmachenry>
Anyone have a preference for Command, Getopt, Cmdliner, or Arg?
<adrien>
Arg is not really the one I like most; I find its use a bit cumbersome (but well, I'm not sure I'd fine others better)
<mmachenry>
I like the idea of using GNU standards (double dash for long names) so I think I might not use Command either.
<mmachenry>
Getopt seems very simple. I'm reading Cmdliner right now. It supports conversion of types.
mmachenry has quit [Ping timeout: 252 seconds]
divyansr has quit [Remote host closed the connection]
nikki93 has joined #ocaml
* nicoo
likes Cmdliner
ggole has quit [Read error: Connection reset by peer]
* nicoo
needs to leave. See you later.
ggole has joined #ocaml
divyansr has joined #ocaml
dant3 has quit [Remote host closed the connection]
Kakadu has joined #ocaml
boogie has joined #ocaml
dant3 has joined #ocaml
boogie has quit [Ping timeout: 248 seconds]
adrien_o1w has joined #ocaml
AltGr has joined #ocaml
zxqdms has joined #ocaml
adrien_oww has quit [Ping timeout: 252 seconds]
<flux>
yeah, cmdliner is nice, though it took a while to get any hang of it :)
<flux>
also whenever I write new cmdliner-based software I will likely use my old piece of code as a starting point..
dant3 has quit [Remote host closed the connection]
dant3 has joined #ocaml
<companion_cube>
rgrinberg: I know, I took some inspiration from Bunzli's jsonm library
divyansr has quit [Remote host closed the connection]
divyansr has joined #ocaml
zRecursive has left #ocaml []
divyansr has quit [Remote host closed the connection]
jonludlam has joined #ocaml
dant3 has quit [Remote host closed the connection]
divyansr has joined #ocaml
zpe has joined #ocaml
adrien_o1w is now known as adrien_oww
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
zpe has quit [Read error: Connection reset by peer]
Kakadu has quit [Ping timeout: 272 seconds]
zpe has joined #ocaml
boogie has joined #ocaml
boogie has quit [Read error: Connection reset by peer]
boogie has joined #ocaml
thomasga has joined #ocaml
boogie has quit [Ping timeout: 248 seconds]
thomasga has quit [Quit: Leaving.]
dant3 has joined #ocaml
dant3 has quit [Ping timeout: 252 seconds]
dant3 has joined #ocaml
Simn has joined #ocaml
dant3 has quit [Remote host closed the connection]
Yoric has joined #ocaml
thomasga has joined #ocaml
jbrown has joined #ocaml
jonludlam has quit [Remote host closed the connection]
dant3 has joined #ocaml
thomasga1 has joined #ocaml
thomasga has quit [Ping timeout: 272 seconds]
mika1 has joined #ocaml
<gasche>
I just submitted a paper to a conference
<gasche>
the two people that tried to proofread it so far admitted they didn't understand a word of it
<gasche>
though life...
boogie has joined #ocaml
<gasche>
hopefully I'll have more time for OCaml hacking for the rest of the week
<def-lkb>
gasche: what was the subject?
<gasche>
(if people of the chan keep companion_cube busy enough to not drown us under Batteries pull requests)
<def-lkb>
or topic*
<gasche>
def-lkb: it is about a correspondence between maximal multi-focusing, a recentish concept of proof search/focusing, and an existing equivalence algorithm for lambda-terms with sum types
<gasche>
(I came at this by trying to determine whether a type, possibly with sums, has a unique inhabitant)
<def-lkb>
:D, fine
boogie has quit [Ping timeout: 264 seconds]
_andre has joined #ocaml
<murRz>
gasche, you seem fairly knowledgeable in these here territories, why are true and false not spelt uppercase seeing that they are data constructors?
skchrko has quit [Quit: Leaving]
<murRz>
(yes, I just had to pattern match them for the first time to illustrate something to someone and I got verily confused by that they were not uppercase as I expected)
<ggole>
They're magic.
<ggole>
(That is, hardwired into the compiler.)
<gasche>
it's a quirk of the syntax
<murRz>
Why is it needed.
<gasche>
it's not, people just thought it would be nicer
<murRz>
Why.
<murRz>
This decision confuses me greatly.
<gasche>
in revised syntax (an arcane alternative proposal) they use uppercase
<gasche>
I guess they are this way in Pascal (or whatever) and people were used to that
<murRz>
revised syntax seems better in about every way truth be told.
<murRz>
Hmm
<murRz>
That cannot possibly be the only reason for adding special syntax when True and False suffice as non special syntax
<gasche>
I'd disagree; it has some very nice things, but it's worse in some other ways
<gasche>
if it only had nice things I'd use it
<murRz>
Worse in what way?
ollehar has joined #ocaml
<murRz>
Maybe I should learn camlp4 and revise the revised syntax.
<murRz>
Reminds me of that XKCD comic.
<gasche>
well someone did something like that, it's called the Reloaded syntax
<gasche>
nobody ever heard of it, for the better I think, having various syntax doesn't really work in practice
<ggole>
Skinnable syntax is a horrible idea imho
FreeArtMan has joined #ocaml
<murRz>
Works fine in lisp.
<murRz>
But then again, the uniformity of syntax makes it easy to learn new macros there.
<ggole>
Macros are not skinnable syntax. Read-macros, maybe - I'd say they are a bad idea too.
<gasche>
murRz: I just checked: in Caml Light constructors had no capitalization restriction
<gasche>
so "type bool = true | false;;" was valid
<murRz>
How did you pattern match that?
FreeArtMon has joined #ocaml
<gasche>
(and "let X = 3 in ..." was as well)
<gasche>
as you would today
<ggole>
That was in ML, and apparently it was problematic.
<murRz>
How if you do match x with | True -> ... the compiler doesn't just bind x to True?
<gasche>
it's just that variables and constructors were not distinguished by (upper,lower)case, but shared a common naming environment
<gasche>
ah
<gasche>
... I don't know
<gasche>
maybe they checked first whether a constructor of this name existed
<gasche>
I don't have camllight installed on this machine to check
<murRz>
Ah yes
<murRz>
One can certainly see the benefits of keeping thme disjoinjt.
<ggole>
That's how it works in SML. And if you make a spelling mistake, it silently always matches.
<gasche>
yeah, but then if people are used to "true | false", it's hard to suddently switch to "True | False" in the next evolution of the language
<ggole>
Apparently this was a very common error.
<murRz>
I can imagine.
<companion_cube>
there is also an indentation-based syntax :D
<gasche>
several of them; I implemented two personally
<ggole>
Appel did a language critique (of SML) in which he suggests disjoint constructor and variable lexemes to solve the issue.
<gasche>
there is scheme-like syntax
<ggole>
And afaik every subsequent ML-like language does exactly that.
<murRz>
It takes you like 2 hours to learn to switch, investment that pays of for the rest of your life. Retaining backwards compatibility, especially when you have seperatetely compiled modules that don't necessarily make the RTE backwards incompatibile is overrated
<gasche>
ggole: nowadays I think that we should consider warning on identifier shadowing
<murRz>
indentation based syntax is asking for problems and subtle errors.
<ggole>
How does the investment "pay off"?
FreeArtMan has quit [Ping timeout: 272 seconds]
<gasche>
I almost wrote a language proposal for a pattern of the form (!p) that has the semantics of (p), but does not warn if one of p's binders shadows an existing variable
<murRz>
Well, I was verily surprised that matching True and False didn; t work, then tried T and F, also didn; t work, then had to look up what they were named and found out they were lowercase, then I had to ask here why they were lowercase to satisfy my curiorisity.
<murRz>
Also, in the SML case, it stops large amounts of errors from typos.
<gasche>
answering you feels like talking to a child that's not content with a "that's the way it is" answer; oddly satisfying
<ggole>
I also can't agree that backwards compat is overrated. Looking at efforts like Perl 6 and Python 3, I think it is underrated.
<murRz>
If they just switched to letting constructors and variables inhibit a different namespace.
<murRz>
The reason that perl and python were such a mess as to require python 3 and perl 6 is due to bakcwards compatibilitty.
Simn has quit [Ping timeout: 252 seconds]
<murRz>
The main issueis that Perl 6 and python 3 are only marginally better so it still isn't worth it, and pythona nd perl are in general awful, awful languages that are hard to save.
<ggole>
That's an argument for adding things very carefully, not for breaking compat.
<companion_cube>
murRz: how can you decide whether it's a constructor of variable, if it's not syntactic?
<companion_cube>
in a pattern match, that is
<murRz>
Well, as it stands to add things properly sometimes you have to break it.
<murRz>
companion_cube, if it's defined as a constructor apparently.
<murRz>
In SML, so if you make a small typo it becomes a variable again and matches everything.
<murRz>
And it can't flag you statically for that of course.
<companion_cube>
that sounds dangerous
<companion_cube>
the ocaml way is better
<murRz>
One assumes it to be terrible and th esource of many, many many, many frequent bugs.
<murRz>
Yes, it is.
<companion_cube>
but true/false is a minor wart, that would break *a lot* of code if changed
<murRz>
I have dibs on the top left spot in the circle of jerking.
FreeArtMan has joined #ocaml
FreeArtMan has quit [Remote host closed the connection]
<murRz>
Well, you can do it slowly, first depraecate, eventually remove.
<murRz>
It's not like true/false are used as literals a lot in code.
FreeArtMan has joined #ocaml
FreeArtMon has quit [Ping timeout: 272 seconds]
<gasche>
(though a surprising number of beginners will write "if (foo = true) then ...")
<companion_cube>
murRz: they are used a lot, I think
<gasche>
(it's one of the beginners mistake that is the most gratifying to correct)
<companion_cube>
as results of expressions, not only in patterns
<gasche>
companion_cube: in expressions we may "let true = True"
<murRz>
companion_cube, if you pattern match for bools, why not use a conditional?
<companion_cube>
murRz: because it can be in a more complex pattern
<murRz>
Well yeah, that is ture
<companion_cube>
gasche: awww
<murRz>
Even there, you can use when clauses though
FreeArtMon has joined #ocaml
<companion_cube>
that's ugly
<murRz>
I donb't know, I never needed to use it until yesterday where I was trying to illustrate to someone that a special conditional syntax was not strictly needed.
<murRz>
I think it's prettier than matching bools directly.
<gasche>
in fact when clauses are not always enough because they cannot be used in depth
<gasche>
so you cannot translate the or-pattern ((Foo true) | (Bar false))
FreeArtMan has quit [Ping timeout: 272 seconds]
ontologiae has joined #ocaml
Simn has joined #ocaml
skchrko has joined #ocaml
<def-lkb>
and you lose exhaustivity checking… well you lose all benefits of pattern matching
ygrek has quit [Ping timeout: 272 seconds]
divyansr has quit [Remote host closed the connection]
divyansr has joined #ocaml
boogie has joined #ocaml
divyansr has quit [Remote host closed the connection]
boogie has quit [Ping timeout: 272 seconds]
FreeArtMon has quit [Ping timeout: 264 seconds]
avsm has joined #ocaml
divyansr has joined #ocaml
arj has joined #ocaml
talzeus has quit [Remote host closed the connection]
dsheets has quit [Ping timeout: 264 seconds]
avsm has quit [Quit: Leaving.]
dant3 has quit [Remote host closed the connection]
dant3 has joined #ocaml
divyansr has quit [Remote host closed the connection]
avsm has joined #ocaml
dant3 has quit [Remote host closed the connection]
dant3 has joined #ocaml
divyansr has joined #ocaml
FreeArtMan has joined #ocaml
divyansr has quit [Remote host closed the connection]
divyansr has joined #ocaml
dant3 has quit [Remote host closed the connection]
<murRz>
def-lkb, hmm, I suppose that is true
<murRz>
you leave me convinced
<murRz>
Well, simple if also has exhausitivity chekcing
<murRz>
I just think matching for true and false looks silly.
<murRz>
or in general matching ennumerated types.
dsheets has joined #ocaml
FreeArtMan has quit [Ping timeout: 264 seconds]
thomasga1 has quit [Quit: Leaving.]
kyrylo has joined #ocaml
dant3 has joined #ocaml
divyansr has quit [Remote host closed the connection]
boogie has joined #ocaml
boogie has quit [Ping timeout: 252 seconds]
Thooms has joined #ocaml
avsm has quit [Quit: Leaving.]
wolfnn has joined #ocaml
divyansr has joined #ocaml
mye has joined #ocaml
divyansr has quit [Quit: Leaving...]
<Drup>
gasche: I don't really like to warn on shadowing by default
<Drup>
it's in haskell, and I don't like it, I use shadowing with let all the time, it's normal in a functional language (with explicit recursion) to do it and it's part of the idioms
<gasche>
you'd use let !x = ... when you're willingly shadowing something
<gasche>
(pattern !p has the semantics of p, minus the shadowing warnings on bound identifiers)
<gasche>
my own personal argument against this is that it can make copy-pasting code in an arbitrary context raise warnings
<gasche>
hm
<gasche>
let's extend the syntax to say that !e means e, but without warning when a binder inside e shadows a bound outside e
<pippijn>
pattern !p is misleading
<gasche>
(so in particular !(fun x -> p) = (fun !x -> !p))
<pippijn>
because it's not symmetric with expression !p
FreeArtMan has joined #ocaml
divyansr has joined #ocaml
divyansr has quit [Client Quit]
<gasche>
!p and !e are just abstract syntax here, for the purpose of this experiment
<gasche>
(but (method !foo = ...) would in fact work rather well)
<pippijn>
ah okay
<Drup>
we already have "method! foo", don't we ?
avsm has joined #ocaml
<ggole>
So let! x = ... ?
<Drup>
ggole: don't work in patterns, which is what gasche want
<ggole>
Right.
thomasga has joined #ocaml
<gasche>
yeah, !p subsumes method!
<gasche>
(but not "let open!" which has a different semantics, whose irregularity has a cost)
thomasga has quit [Ping timeout: 248 seconds]
avsm has quit [Quit: Leaving.]
Simn has quit [Ping timeout: 252 seconds]
martintrojer has quit [Ping timeout: 252 seconds]
<companion_cube>
murRz: isn't the point of enumerated types, to be matched against?
<murRz>
companion_cube, I praefer to define functions like is_Foo and is_Bar and use some higher order combinator in most cases
<companion_cube>
murRz: if you have more than two variants, pattern matching is much much much more convenient
boogie has joined #ocaml
<companion_cube>
you deal with each case exactly once, have exhaustivity checking, and so on
<murRz>
companion_cube, typically the function you make which uses pattern matching can be expressed point free though.
<companion_cube>
murRz: sometimes, but not that often in my experience
<companion_cube>
is_foo is still useful, agreed
<companion_cube>
but defined... with pattern matching :)
<murRz>
Well, everything can be expressed point free.
<murRz>
Yeah
<murRz>
I define is_foo once with pattern matching and then use it in higher order functions
<Drup>
I like the "everything can be expressed FOO" argument
<murRz>
Obviously I did not need to ever define is_True, it's called identity
<pippijn>
I don't think expressing everything point-free is what you should try to achieve
<Drup>
it's the godwin point of language paradigm discussions
<murRz>
Drup, well, I'm contesting the claim of "sometimes, but not that often"
<companion_cube>
also, pattern matching wins when some variants have parameters
<murRz>
pippijn, I typically find it to be the most concise and natural style.
<Drup>
after that, you can't really say something interesting anymore, because it's such a useless argument
<pippijn>
pattern matching wins when you have nested data structures
<murRz>
I don't know, for most logic you can get away with using something like a fold and putting some anoynmous function over it
<companion_cube>
when you manipulate AST, you really need pattern matching
<companion_cube>
(but well, they're complicated variants, not mere enumerations)
boogie has quit [Ping timeout: 252 seconds]
darkf has quit [Quit: Leaving]
ocp has joined #ocaml
mocrunsthecity has quit [Ping timeout: 272 seconds]
martintrojer has joined #ocaml
Simn has joined #ocaml
_habnabit has quit [Ping timeout: 272 seconds]
rand000 has joined #ocaml
yacks has joined #ocaml
jonludlam has joined #ocaml
FreeArtMon has joined #ocaml
FreeArtMan has quit [Ping timeout: 272 seconds]
dant3 has quit [Remote host closed the connection]
FreeArtMan has joined #ocaml
dant3 has joined #ocaml
FreeArtMon has quit [Ping timeout: 272 seconds]
nikki93 has quit [Remote host closed the connection]
kyrylo has quit [Ping timeout: 246 seconds]
teethed_bird has joined #ocaml
<teethed_bird>
hello. in the official ocaml stdlib, the queue.ml module says "OCaml currently does not allow the components of a sum type to be mutable." what exactly does this mean?
<flux>
I think it means you cannot have: type foo = Int of mutabke int
<flux>
not a big deal, you can have type foo = Int of int ref
<teethed_bird>
foo there is not a sum type though, is it?
<pippijn>
for my latest project, I've used type foo_int = { value : mutable int; } type foo = Int of foo_int
<pippijn>
well
dant3 has quit [Remote host closed the connection]
<pippijn>
actually that project has no mutables
<pippijn>
but I've used the record thing
<pippijn>
because I found it to be unreadable to have a variant take 10 parameters
<flux>
teethed_bird, well, it is but it onyl has one constructor :).
<flux>
type foo = Int of mutable int | Flota of float <- now, there, fine! ;-)
dant3 has joined #ocaml
ollehar has quit [Quit: ollehar]
avsm has joined #ocaml
<teethed_bird>
flux: ah okay, thanks
<murRz>
pippijn, why did you use the singleton record instead of the ref?
<pippijn>
murRz: not really
<pippijn>
I just did that for records with multiple values
oriba has joined #ocaml
thomasga has joined #ocaml
<ggole>
teethed_bird: mutable parts of sum types would allow for some code to be slightly more efficient
<ggole>
It's not really a big deal.
<pippijn>
how would you address them?
avsm has quit [Quit: Leaving.]
<flux>
match Int a with a -> a <- 42 ?
boogie has joined #ocaml
ollehar has joined #ocaml
<ggole>
Good question. You could have, say, type x = Foo of { mutable x: int } and then match ... with Foo f -> f.x <- f.x + 1.
<ggole>
However, that would lead to thorny questions like "what is the type of f"
shinnya has joined #ocaml
<ggole>
Maybe match ... with Foo _ as f -> f.x <- f.x + 1 instead?
mocrunsthecity has joined #ocaml
<companion_cube>
f wouldn't be a proper expression, I guess
<companion_cube>
but a rvalue?
boogie has quit [Ping timeout: 265 seconds]
<ggole>
As far as I see, it could be a proper expression (presumably of type x)
<companion_cube>
yeah, I was confusing myself, but of a private type that can't escape
<companion_cube>
(otherwise you need to be able to have a pointer on the middle of a memory block)
<ggole>
Not in the second case
<companion_cube>
(in case f outlives Foo f)
<companion_cube>
ah, with "as f"
<companion_cube>
but still, type x is not accurate enough
<companion_cube>
you need to know that f is the Foo variant
<companion_cube>
(otherwise it doesn't have a .x)
<ggole>
Surely the compiler will be able to see that
<companion_cube>
type foobar = Foo of {mutable x:int} | Bar of {y:float}
<ggole>
(It will need to annotate the binding of f to indicate some "hidden" information, I guess.)
<ggole>
But you could pass f to a function taking an x OK.
<companion_cube>
well then, it's easier to keep the record itself, but with a local type
<companion_cube>
like it's done for GADTs currently
<companion_cube>
(type local to the pattern matching branch)
<ggole>
You can't have first class records without introducing the efficiency problems that this is intended to overcome, I think
dant3 has quit [Remote host closed the connection]
<ggole>
Unless I miss your point somehow.
FreeArtMon has joined #ocaml
<ggole>
Perhaps I misunderstand what you mean by "local type".
<pippijn>
type t = Foo of { mutable x : int } (match x with Foo f -> f) :
<pippijn>
: t
<pippijn>
f has type t
<pippijn>
and it's physically identical to x
<companion_cube>
ggole: an opaque type that can't escape the scope of the pattern match
<pippijn>
it just has special local semantics for f.x
<companion_cube>
but for which the compiler accepts "f.x <- y"
<ggole>
pippijn: what about type t = Foo of { mutable x: int; mutable y: int; } (match x with Foo f -> f): ??
<companion_cube>
it can even be a kind of private record type if you want
<companion_cube>
but the point is: it can't escape its scope
ontologiae has quit [Ping timeout: 272 seconds]
<pippijn>
ggole: f still has type t
FreeArtMan has quit [Ping timeout: 248 seconds]
<pippijn>
and f == x
<companion_cube>
but you need a more accurate type than "t"
<companion_cube>
because there might be other variants
<pippijn>
it's just a memory block tagged with Foo
<companion_cube>
type t = Foo of {mutable x; y} | Bar of float
<companion_cube>
match x with Foo f -> ..... (* local scope *) | Bar _ -> ....
<companion_cube>
f should exist only in the local scope
<ggole>
pippijn: that seems similar to what I was suggesting, except that it looks like stripping off the constructor
<pippijn>
yes
<ggole>
Which works, I guess, but seems a bit strange
<pippijn>
ah
<pippijn>
ggole: it looks like stripping it off
<pippijn>
but actually it's not
<pippijn>
that's bad
<pippijn>
maybe you want to allow stripping it off
<ggole>
Under this scheme you couldn't, any more than you could strip the constructor from Bar (1, 2).
<ggole>
The (1, 2) is not a tuple there.
<pippijn>
right
<ggole>
The whole thing is an annoying efficiency hack. :(
<ggole>
(But a pretty good one.)
<pippijn>
also readability
<pippijn>
type t_foo = { ... } type t_bar = { ... } ... type t = Foo of t_foo | Bar of t_bar | ...
lostcuaz has joined #ocaml
<pippijn>
having the record definitions local to the variants is good
<ggole>
Indeed.
<ggole>
Just being able to name the arguments itself would be valuable.
<pippijn>
yes
<pippijn>
that would be enough for me
<ggole>
But at the moment you take both a readability and a performance hit for that.
<ggole>
Bit of a wart really.
<pippijn>
I rarely use mutable state, and I don't think I've ever used it in sum types
<pippijn>
or even needed it in sum types
<pippijn>
usually my state is a clearly defined record with just one kind
<companion_cube>
it's pretty useful though
<companion_cube>
for efficient data structures
<companion_cube>
(just look at the queue example)
<companion_cube>
how is it done in caml-light?
wobster has joined #ocaml
<ggole>
For serious performance hacking I wouldn't mind being about to lay out types at the bit level.
<ggole>
s/about/able/
<pippijn>
I don't think you can do that with ocaml
<ggole>
No. It would need significant changes to the runtime and compiler.
<pippijn>
yes
<pippijn>
though
<pippijn>
maybe not that much
<pippijn>
having bit addressing of 31/63 bit ints would be possible without changes to the runtime
<pippijn>
records of bools could be automatically optimised for size
<ggole>
Hmm, the first word of a block has a special format, which might interfere a bit.
<pippijn>
that word doesn't matter
<companion_cube>
in the present case, the layout would remain the same as Foo 'a 'b 'c 'd
<ggole>
You might also want to be able to include floats, vector types, etc directly in records.
<companion_cube>
but you could adress it more easily
<ggole>
pippijn: I'm not sure that's true, since the first words includes the tag value in some cases.
<pippijn>
yes, but how does it interfere with the actual record layout?
<ggole>
It doesn't, but I had in mind something a bit more aggressive that just record layout.
<pippijn>
type t = { mutable cv : int[2]; mutable sign : bool[1]; mutable exncount : int[9]; ... }
<ggole>
Yes, that kind of thing would work fine.
FreeArtMan has joined #ocaml
<pippijn>
to the runtime, this would just be type t = { stuff : int }
<pippijn>
the compiler will do some math to address each value
Kakadu has joined #ocaml
<pippijn>
and to cut off values that overflow this
FreeArtMon has quit [Ping timeout: 248 seconds]
_habnabit has joined #ocaml
WraithM has joined #ocaml
Eyyub has joined #ocaml
jludlam has joined #ocaml
jonludlam has quit [Ping timeout: 248 seconds]
jludlam has quit [Client Quit]
dant3_ has joined #ocaml
jonludlam has joined #ocaml
nikki93 has joined #ocaml
WraithM has quit [Ping timeout: 248 seconds]
mocrunsthecity has quit [Remote host closed the connection]
nikki93 has quit [Read error: Operation timed out]
lostcuaz has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ontologiae has joined #ocaml
mika1 has quit [Quit: Leaving.]
avsm has joined #ocaml
kyrylo has joined #ocaml
oriba has quit [Quit: oriba]
talzeus has joined #ocaml
talzeus has quit [Remote host closed the connection]
talzeus has joined #ocaml
boogie has joined #ocaml
FreeArtMon has joined #ocaml
FreeArtMan has quit [Read error: Operation timed out]
hyperboreean has quit [Quit: leaving]
hyperboreean has joined #ocaml
hyperboreean has quit [Changing host]
hyperboreean has joined #ocaml
FreeArtMon has quit [Client Quit]
mye has quit [Quit: mye]
boogie has quit [Ping timeout: 252 seconds]
saml has joined #ocaml
avsm has quit [Quit: Leaving.]
dant3_ has quit [Ping timeout: 252 seconds]
avsm has joined #ocaml
dant3 has joined #ocaml
dant3 has quit [Remote host closed the connection]
thomasga has quit [Quit: Leaving.]
shinnya has quit [Ping timeout: 246 seconds]
thomasga has joined #ocaml
nikki93 has joined #ocaml
skchrko has quit [Quit: Leaving]
amirmc has joined #ocaml
amirmc has quit [Client Quit]
thomasga1 has joined #ocaml
amirmc has joined #ocaml
thomasga has quit [Ping timeout: 245 seconds]
boogie has joined #ocaml
boogie has quit [Ping timeout: 246 seconds]
ygrek has joined #ocaml
nikki93 has quit [Read error: Operation timed out]
wobster has quit [Ping timeout: 252 seconds]
ocp has quit [Ping timeout: 264 seconds]
orion has joined #ocaml
lostcuaz has joined #ocaml
<orion>
Why do people prefer one of Haskell or OCaml?
Kakadu has quit [Ping timeout: 272 seconds]
<companion_cube>
you mean why do they have to choose between them, or to choose one of them rather than java/python/php?
<Drup>
orion: why do people ask this question instead of trying out both ? :3
<Drup>
(I know, I know, time, but still :p)
avsm has quit [Quit: Leaving.]
<orion>
companion_cube: Between them
<companion_cube>
ah
<companion_cube>
because it's hard to write code that work in both ocaml and haskell :D
<companion_cube>
more seriously, haskell and ocaml are quite different, as are their communities and tools
<ggole>
OCaml is impure, so I can have my nice escape hatch without any fuss.
<companion_cube>
some prefer the purity of haskell, that's a matter of taste
<companion_cube>
(and lazyness)
avsm has joined #ocaml
<adrien_oww>
I like my code to compile quickly :P
<orion>
What if you want a lot of libraries to work with?
<ggole>
Neither have a lot of libraries, really
<orion>
:(
<Drup>
I would say both have the same amount, which may be a less depressing way of saying it x)
<adrien_oww>
hmmm
<ggole>
Hah.
<Drup>
(and I disagree with the "not a lot")
<adrien_oww>
there's enough libraries to do quite a lot of work
<adrien_oww>
I've rarely been annoyed by a lack of library
<ggole>
Relative to Java, or Javascript, or Python, there are not a lot.
<adrien_oww>
JS?
<adrien_oww>
Java and Python, yeah, but JS sounds surprising
<ggole>
Everybody and his dog writes JS libraries these days.
<Drup>
and js libraries are absolutely unusable because the landscape is a fucking mess.
<companion_cube>
I thought haskell/ghc had more libraries
<companion_cube>
(than ocaml)
skchrko has joined #ocaml
dant3 has joined #ocaml
dant3 has quit [Ping timeout: 246 seconds]
ontologiae has quit [Ping timeout: 272 seconds]
avsm has quit [Quit: Leaving.]
S11001001 has joined #ocaml
S11001001 has quit [Changing host]
S11001001 has joined #ocaml
Sim_n has joined #ocaml
pippijn_ has joined #ocaml
thomasga1 has quit [Quit: Leaving.]
cthuluh_ has joined #ocaml
adrien_oww has quit [Ping timeout: 260 seconds]
nk0 has quit [Ping timeout: 260 seconds]
cthuluh has quit [Ping timeout: 260 seconds]
willb2 has quit [Ping timeout: 260 seconds]
pippijn has quit [Ping timeout: 260 seconds]
Simn has quit [Ping timeout: 260 seconds]
tianon has quit [Ping timeout: 260 seconds]
tianon has joined #ocaml
tianon has quit [Changing host]
tianon has joined #ocaml
nk0_ has joined #ocaml
willb2 has joined #ocaml
adrien_oww has joined #ocaml
cthuluh_ is now known as cthuluh
Thooms has quit [Quit: WeeChat 0.3.8]
thomasga has joined #ocaml
avsm has joined #ocaml
jmsdnns has joined #ocaml
mocrunsthecity has joined #ocaml
demonimin has joined #ocaml
contempt has quit [Ping timeout: 260 seconds]
contempt has joined #ocaml
mcclurmc has joined #ocaml
Yoric has quit [Ping timeout: 252 seconds]
jwatzman|work has joined #ocaml
yacks has quit [Quit: Leaving]
nikki93 has joined #ocaml
ygrek has quit [Ping timeout: 246 seconds]
Kakadu has joined #ocaml
dant3 has joined #ocaml
mye has joined #ocaml
amirmc has quit [Quit: Leaving.]
zxqdms has quit [Quit: leaving]
jao has joined #ocaml
jao has quit [Changing host]
jao has joined #ocaml
Eyyub has quit [Ping timeout: 252 seconds]
arj has quit [Quit: Leaving.]
mcclurmc has quit [Remote host closed the connection]
mcclurmc has joined #ocaml
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
mcclurmc has joined #ocaml
zpe has quit [Ping timeout: 272 seconds]
avsm has quit [Quit: Leaving.]
avsm has joined #ocaml
dant3 has quit [Remote host closed the connection]
ggole has quit []
avsm has quit [Ping timeout: 264 seconds]
mocrunsthecity has quit [Remote host closed the connection]
Eyyub has joined #ocaml
nikki93 has quit [Ping timeout: 246 seconds]
NoNNaN has quit [Remote host closed the connection]
<nicoo>
companion_cube: You have more type definitions inspired by category theory which maskerade as libs :]
* nicoo
<~nicoo@unaffiliated/nicoo> has left #ocaml (Hit and run.)
<companion_cube>
:]
pippijn_ is now known as pippijn
Yoric has joined #ocaml
ocp has joined #ocaml
nikki93 has joined #ocaml
dant3 has joined #ocaml
Eyyub has quit [Ping timeout: 272 seconds]
mort___ has joined #ocaml
Eyyub has joined #ocaml
ocp has quit [Ping timeout: 252 seconds]
mye has quit [Quit: mye]
kyrylo has quit [Quit: Hi, Rob!]
Eyyub has quit [Ping timeout: 272 seconds]
jonludlam has quit [Remote host closed the connection]
thomasga has quit [Quit: Leaving.]
thomasga has joined #ocaml
Yoric has quit [Ping timeout: 252 seconds]
thomasga has quit [Ping timeout: 252 seconds]
AltGr has left #ocaml []
boogie has joined #ocaml
mort___ has quit [Quit: Leaving.]
murRz has left #ocaml []
zpe has joined #ocaml
manizzle has joined #ocaml
contempt has quit [Ping timeout: 260 seconds]
zpe has quit [Ping timeout: 272 seconds]
contempt has joined #ocaml
contempt has quit [Ping timeout: 252 seconds]
contempt has joined #ocaml
NoNNaN has joined #ocaml
contempt has quit [Ping timeout: 252 seconds]
contempt has joined #ocaml
NoNNaN has quit [Ping timeout: 240 seconds]
NoNNaN has joined #ocaml
lostcuaz has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ocp has joined #ocaml
kyrylo has joined #ocaml
Eyyub has joined #ocaml
boogie has quit [Remote host closed the connection]
_andre has quit [Quit: leaving]
Eyyub has quit [Read error: Operation timed out]
thomasga has joined #ocaml
Sim_n is now known as Simn
Eyyub has joined #ocaml
thomasga has quit [Client Quit]
jmsdnns has left #ocaml []
mcclurmc has quit [Remote host closed the connection]
FreeArtMan has joined #ocaml
zxqdms has joined #ocaml
dant3 has quit [Remote host closed the connection]
lostcuaz has joined #ocaml
dant3 has joined #ocaml
lostcuaz has quit [Remote host closed the connection]
Eyyub has quit [Read error: Operation timed out]
Eyyub has joined #ocaml
lostcuaz has joined #ocaml
lostcuaz has quit [Read error: Connection reset by peer]
ocp has quit [Read error: Connection reset by peer]
ocp has joined #ocaml
lostcuaz has joined #ocaml
mort___ has joined #ocaml
adr has joined #ocaml
ocp has quit [Ping timeout: 272 seconds]
FreeArtMon has joined #ocaml
FreeArtMan has quit [Read error: Operation timed out]
Yoric has joined #ocaml
boogie has joined #ocaml
mw1001 has joined #ocaml
Yoric has quit [Ping timeout: 252 seconds]
mw1001 has quit [Quit: Ex-Chat]
FreeArtMan has joined #ocaml
FreeArtMon has quit [Ping timeout: 248 seconds]
boogie has quit [Remote host closed the connection]
ocp has joined #ocaml
lostcuaz has quit [Read error: Connection reset by peer]
lostcuaz_ has joined #ocaml
lostcuaz_ has quit [Max SendQ exceeded]
lostcuaz has joined #ocaml
tnguyen1 has joined #ocaml
boogie has joined #ocaml
Kakadu has quit []
dant3 has quit [Remote host closed the connection]
FreeArtMon has joined #ocaml
<teethed_bird>
hello
<companion_cube>
hi
FreeArtMan has quit [Ping timeout: 260 seconds]
mcclurmc has joined #ocaml
dsheets has quit [Read error: Operation timed out]
thomasga has joined #ocaml
lostcuaz has quit [Remote host closed the connection]
lostcuaz has joined #ocaml
lostcuaz has quit [Remote host closed the connection]
boogie has quit [Remote host closed the connection]
thomasga has quit [Quit: Leaving.]
lostcuaz has joined #ocaml
ontologiae has joined #ocaml
FreeArtMon has quit [Ping timeout: 272 seconds]
avsm has joined #ocaml
Eyyub has quit [Quit: leaving]
jbrown has quit [Ping timeout: 260 seconds]
malo has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
jbrown has joined #ocaml
Thooms has joined #ocaml
Anarchos has joined #ocaml
adr has quit [Quit: Quitte]
thomasga has joined #ocaml
mcclurmc has joined #ocaml
mort___ has quit [Quit: Leaving.]
mreca has joined #ocaml
thomasga has quit [Quit: Leaving.]
lostcuaz has quit [Remote host closed the connection]
lostcuaz has joined #ocaml
Eyyub has joined #ocaml
malo has quit [Quit: Leaving]
lostcuaz has quit [Remote host closed the connection]
lostcuaz has joined #ocaml
axiles has quit [Remote host closed the connection]
<rgrinberg>
hello
<companion_cube>
hi
<rgrinberg>
whatchya hacking on :D
dsheets has joined #ocaml
<def-lkb>
hi
<def-lkb>
rgrinberg: thanks for travis support!
<def-lkb>
did you consider caching opam&ocaml ?
<rgrinberg>
def-lkb: what do you mean caching?
Xenasis has joined #ocaml
<def-lkb>
every time the job is run, the vm will download and install opam, build ocaml, yojson, menhir then merlin
<def-lkb>
according to the documentation, travis allows caching data accross execution
<def-lkb>
so that one can reuse opam, ocaml, and maybe menhir, to speedup the process.
<def-lkb>
dsheets: no, "currently only available for private repo"
<def-lkb>
thanks for pointing this subtle issue :D
<dsheets>
"free for open source but you have to have us pay to recompile the same base packages a million times" or "pay us and we will use a little storage to save on compute time"
rand000 has quit [Quit: leaving]
<Xenasis>
Can anyone think of some things I could do to play with the Lazy module and some potential application? I see it used a lot, and I'd like to use it a bit so I can understand why o.o
<Xenasis>
I've been playing a bit with Streams recently, and that's most of what I'd think of
<companion_cube>
Xenasis: it's useful if you don't want to pay the cost of some computation, but still cache its result
<Xenasis>
right, memoization
<companion_cube>
say you have a big computation, the result of which you want to keep
<companion_cube>
but don't want to compute it until it's needed
jao has quit [Ping timeout: 252 seconds]
<companion_cube>
just store (lazy (the computation))
<Xenasis>
right
<rgrinberg>
def-lkb: that's the travis config i copy pasted from avsm it's true that it's probably inefficient in some way
<Xenasis>
alright, that makes a bit more sense, especially with expensive computations o.o
<def-lkb>
rgrinberg: well, it works fine… I never used that kind of service before
<rgrinberg>
def-lkb: i only test my own stuff on 4.01.0 so i got rid of that section anyway
<def-lkb>
did you definitely switched from vim to emacs?
<Xenasis>
I'm sort of just trying to expand my horizons at the moment o.o
<Xenasis>
Streams were fun to play with
<rgrinberg>
yep :) yep for good
<rgrinberg>
althought i must say that merlin works much better on vim when you work on multiple projects
<def-lkb>
:(, are you making use of the "PRJ" directive in .merlin or not ?
<def-lkb>
(not that you should use it, but it is handled differently in vim and emacs mode)
<rgrinberg>
i do not, haven't heard of it either
<def-lkb>
ok. It was an experiment when we were trying to find a nice way to handle different projects.
<rgrinberg>
how does it work? Ideally i'd like to have a merlin instance per project
saml has quit [Quit: Leaving]
<def-lkb>
(A big update is expected in a few weeks solving those design issues, but probably with a bunch of regressions at the same time :/)
ocp has quit [Ping timeout: 264 seconds]
<def-lkb>
The purpose of the "PRJ <key>" line in a .merlin was to give a name to the merlin process
<Anarchos>
def-lkb update in which project ?
<def-lkb>
merlin
<def-lkb>
So that you would have one instance of merlin per <key>
Eyyub has quit [Ping timeout: 272 seconds]
Eyyub has joined #ocaml
Anarchos has quit [Quit: Vision[0.9.7-H-20131020]: i've been blurred!]
orion has left #ocaml []
<rgrinberg>
def-lkb: how about giving merlin a command to type check a whole project?
<rgrinberg>
my idea is that it could be useful for travis testing
<rgrinberg>
run merlin against popular ocaml pakages see if there's any smoke
<def-lkb>
how would that be different from just compiling that package ?
darkf has joined #ocaml
<rgrinberg>
well when we compile the package we test the package
<rgrinberg>
when we run merlin against the package, we test merlin
avsm has quit [Quit: Leaving.]
Eyyub has quit [Ping timeout: 252 seconds]
lostcuaz has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Eyyub has joined #ocaml
Thooms has quit [Ping timeout: 260 seconds]
cthuluh has quit [Quit: leaving]
cthuluh has joined #ocaml
nikki93 has quit [Remote host closed the connection]
baldandgoateed has joined #ocaml
thomasga has joined #ocaml
thomasga has quit [Client Quit]
Eyyub has quit [Quit: leaving]
mcclurmc has quit [Remote host closed the connection]
Eyyub has joined #ocaml
teethed_bird has quit [Quit: Page closed]
sillyotter has joined #ocaml
Simn has quit [Quit: Leaving]
wolfnn has quit [Read error: Operation timed out]
S11001001 has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]