cranmax has quit [Read error: Connection reset by peer]
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
boojinks has quit [Quit: leaving]
FreeBird_ has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 255 seconds]
ryanartecona has joined #ocaml
cggong has quit [Quit: cggong]
freusque has quit [Quit: WeeChat 1.7.1]
jbrown has joined #ocaml
freusque has joined #ocaml
jlam_ has joined #ocaml
jlam__ has quit [Ping timeout: 240 seconds]
jlam__ has joined #ocaml
jlam_ has quit [Ping timeout: 255 seconds]
ryanartecona has quit [Quit: ryanartecona]
argent_smith has joined #ocaml
ryanartecona has joined #ocaml
agravier has joined #ocaml
FreeBird_ has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 260 seconds]
tane has joined #ocaml
agravier has quit [Quit: agravier]
mengu_ has joined #ocaml
mengu has quit [Read error: Connection reset by peer]
agravier has joined #ocaml
AltGr has left #ocaml [#ocaml]
mengu_ has quit [Read error: Connection reset by peer]
AltGr has joined #ocaml
<hannes>
I've some design issue: consider a type (let's say list of strings), and an invariant on that type (all strings only contain printable characters). sometimes I have use for this type without the invariant, but usually the invariant is fulfilled
<hannes>
I could use the OCaml object system for this (to avoid code duplication), but this feels over the top
<hannes>
is it sensible to have an (abstract) sum type with two constructors, once with invariant, once without? or is there a hidden performance impact?
freusque has quit [Quit: WeeChat 1.7.1]
<zozozo>
hannes: well, using a phantom type seems reasonnable
<zozozo>
and there is absolutely no performance impact, since types are erased at compile time
<Drup>
is the invariant used internally or externally ?
<hannes>
zozozo: any link to a tutorial / example thereof?
<companion_cube>
phantom type, or private alias
<hannes>
Drup: only ever externally.. a client of that module may ask for "pls ensure this invariant when constructing such a value"
<Drup>
and there are operations that should only be applied on values that respect the invariants ?
<hannes>
Drup: no
<Drup>
Then yes, abstract sum type is fine, you pay one pointer indirection per access, which is probably meaningless
AltGr has left #ocaml [#ocaml]
<hannes>
Drup: there's (atm) an of_string : ?ensure_invariant:bool -> string -> t (etc.)
<Drup>
zozozo: this is really not a use case for phantom type
<zozozo>
Drup: how so ? the 'flag and 'attr types are phantom and used if I'm not mistaken
<Drup>
I mean hannes' use case
<zozozo>
I agree it's not the best, and is a lot more complex than an exmaple should be
jbrown has quit [Quit: Leaving]
<zozozo>
ah, right, haven't got the time to read all messages yet, :p
<hannes>
thx people!
cranmax has joined #ocaml
mengu has joined #ocaml
<companion_cube>
I'd have gone for private alias/type + smart constructors
<hannes>
companion_cube: what is "smart constructors"? (is it a technical term?)
mengu_ has joined #ocaml
<companion_cube>
not a technical term, just a pattern
mengu has quit [Read error: Connection reset by peer]
<companion_cube>
you have a `type t = private …` with some invariants
<companion_cube>
and you export some functions to build t, but that always ensure the invariant is respected
<hannes>
yes
<reynir>
I believe it's a function that ensures some property, like »let make (s : string) : t = check_printable s; s«
<companion_cube>
typically I use that in ASTs to flatten nested applications, this kind of stuff
<octachron>
this can also be useful when there are good enough default value for some fields of a record that can be mapped to optional arguments in the smart constructor
shinnya has quit [Ping timeout: 240 seconds]
jnavila has joined #ocaml
kamog has joined #ocaml
kakadu has quit [Quit: Konversation terminated!]
dhil has quit [Ping timeout: 240 seconds]
Anarchos has joined #ocaml
slash^ has quit [Read error: Connection reset by peer]
slash^ has joined #ocaml
kamog` has joined #ocaml
kamog has quit [Ping timeout: 240 seconds]
jnavila has quit [Ping timeout: 240 seconds]
govg has quit [Quit: leaving]
govg has joined #ocaml
KeyJoo has joined #ocaml
mengu_ has quit [Ping timeout: 255 seconds]
mengu has joined #ocaml
Merv_ has joined #ocaml
slash^ has quit [Read error: Connection reset by peer]
cranmax has quit [Ping timeout: 240 seconds]
<orbitz>
companion_cube: you actually played with Idris much?
<orbitz>
anyone used ppx_monadic seriously? Is it worth it if you're doing a lot of concurrent code?
kakadu has joined #ocaml
olibjerd has quit [Quit: olibjerd]
<Drup>
ppx_monadic is really rather terrible
<Drup>
it abuses the OCaml syntax in rather gross ways
<Drup>
although for concurrent code ... just use lwt's syntax extension ?
<companion_cube>
orbitz: no, not much, I don;t have the time/motivation :/
<companion_cube>
ocaml is a local optimum so far…
ryanartecona has quit [Quit: ryanartecona]
<Drup>
as far as local optimum go, it's not a terrible one :p
<companion_cube>
depends for what :p
<companion_cube>
(for what I do it's mostly fine, although I wouldn't spit on a few more lower level backdoors for performance)
gasche has joined #ocaml
<orbitz>
Drup: What if I'm no tusing lwt
<gasche>
rixed_: { e with _ } looks good, would you send a PR? (It would be easier after a Menhir move of course, more work for me...)
<companion_cube>
o/ gasche
<gasche>
(the other option is { e with } and it's a bit ugh)
Algebr has joined #ocaml
<orbitz>
I guess I'll stick with just >>=, I don't actually find it that bad.
<octachron>
gasche, speaking of the menhir move, would you need a helping hand?
<orbitz>
companion_cube: I played with Idris a bit but was challeneged a bit to leverage the dependent types (I think it requires a world-view I don't quite have)
Merv_ has quit [Ping timeout: 268 seconds]
<gasche>
octachron: in general I'm always happy to work with others
<gasche>
on the parser, I think that it's not that easy to split what remains to be done (you could take care of it, but it is tedious work and the possible result is "in fact the current state (of the PR) is better")
<gasche>
but there is one thing that is related on which I think your help would be welcome and that you may find interesting
<gasche>
Runhang "objmagic" Li has a branch where he measures code coverage of the parser and pprintast (the source pretty-printer); I wonder if it would be possible to merge some aspects of it upstream, or at least put a process in place to make sure we keep a good coverage
<gasche>
(in fact I don't even know how good our coverage is right now)
<gasche>
(the relation with my work: I validate that the menhir and ocamlyacc parser are the same, but this is limited by testsuite quality)
<gasche>
my idea, but I'm not sure maintainers would like it, would to just add a coverage-checking target in the distribution's Makefile, that (is optional of course and) depends on ppx-bisect
<gasche>
(I have previously experimented with measuring code coverage for the whole compiler codebase, and I think that would also be useful longer-term)
<gasche>
(re. menhir: what remains to be done is to find the least horrible way to get rid of the cpp-preprocessing step, and it is going to be rather horrible)
<octachron>
on the parsing side, I was wondering if having a $rangepos location as a shorthand for ($startsymbolpos,$endpos) may help
<def`>
gasche: then you would drop having a single mly working with both yacc and menhir (just by changing preprocessing)?
<octachron>
gasche: on the coverage test side, it is not really something that I am very familiar with, but it could be a learning experience :). I would keep that in mind.
<gasche>
def`: that was never the plan medium-term
<gasche>
in fact my current PR doesn't have that, because the OCaml body at the beginning differs a bit (there are extra location arguments)
<gasche>
but part of the goal is to be able to use parametrized rules, etc.
<gasche>
I'm keeping them close for as long as I need to be able to rebase the patch
<def`>
yes, but it is nice to have during transition, it seems that there is a gap of unknown size between current solution and final menhir port
<gasche>
yes
<gasche>
but because I validate the parser dynamically, I'm not too worried about changing the code
<def`>
during my work on reason, I have considered writing a code that uses menhir automaton to extract test cases covering all reductions
<gasche>
def`: btw., what did you think of my grammar-change proposal for menhir rules?
<gasche>
(are you on the menhir mailing-list?)
<def`>
gasche: yes, as François mentioned, I suggested more or less the same a few days before (directly to him)
<gasche>
octachron: I think that I would need more than that for readability, and I suspect that with some clever use of parametrized rules we could do better
<def`>
although if I remember well, your syntax is a bit nicer
<gasche>
def`: I think some form of this feature would really help for the OCaml parser
<def`>
x1 and x2 are equivalent, but in x3 the bar is just a sugar and doesn't delimit an empty case (thanks god, I am not arguing it should be the case, but it feels quite irregular)
boojinks has joined #ocaml
<gasche>
Drup: it's not higher-order I think
<gasche>
but f(foo) and f(foo bar {baz}) are allowed
<gasche>
(and you can also write foo bar=(bli bla {blu} | ...) baz { ... })
kamog` is now known as kamog
<def`>
why is not higher-order? you mean one can only write non parameterized argument that way?
<Drup>
gasche: it's the "anonymous rule" part I was not aware of
<gasche>
def`: yes, as far as I know there is no lambda?
<gasche>
ok
ontologiae_ has joined #ocaml
sillyotter has joined #ocaml
sillyotter has quit [Client Quit]
Nephe has joined #ocaml
sh0t has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
<Nephe>
Hello. I have a directed, unweighted ocamlgraph, and I want to compute if there is a path between two vertices, for every pair of vertices.
<Nephe>
Is there a better way to do it than by hand or using the Jonson's algorithm with fake weights ?
<def`>
gasche: no lambda, indeed.
Merv_ has joined #ocaml
jnavila has joined #ocaml
<octachron>
Nephe, are you looking for strongly-connected components? (i.e. sets of all vertices that are mutually connected)
<gasche>
minimal-weight algorithms would be inefficient as I don't think they can notice that the weight are trivial to avoid re-considering new paths
<gasche>
this one is quasi-linear
<gasche>
(in the union-find sense)
<Nephe>
Oh, thanks. Looking to the name of the module, I thought it was strongly connected component in directed graphs.
<Nephe>
gasche: I totaly agree that minimal-wieght algorithms would be inneficient, thats why I was looking for something else !
<rixed_>
gasche: will love to. give me a few weeks though.
<Nephe>
Wait... no. Connected component will not be enough. My input graph is directed and I want to know which vertices I can reach from every other vertex.
<Nephe>
Connected component in an undirected graph would give false results when undirected connected components are not strongly (directed) connected components.
sz0 has quit [Quit: Connection closed for inactivity]
<octachron>
Nephe, the set of vertices that are always reachable should be a strongly-connected component.
kamog has quit [Remote host closed the connection]
<Nephe>
I may have not explained myself correctly. If I have a --> b --> c, I want to know that I can reach b and c from a, and that I cannot reach a from c or b, etc..
<Nephe>
I think I found the solution. I have to compute the transitive closure, in the module Oper.
enterprisey has quit [Remote host closed the connection]
<Nephe>
Thanks for your help !
<octachron>
I agree, the transitive closure of the adjency matrix sounds like what you want
boojinks has quit [Quit: Lost terminal]
ygrek has joined #ocaml
jnavila has quit [Remote host closed the connection]
Merv_ has quit [Ping timeout: 240 seconds]
mengu has quit [Read error: Connection reset by peer]
mengu has joined #ocaml
argent_smith has quit [Quit: Leaving.]
sh0t has joined #ocaml
enterprisey has joined #ocaml
agravier has quit [Quit: agravier]
Merv_ has joined #ocaml
larhat has joined #ocaml
sgronblo has joined #ocaml
kakadu has quit [Remote host closed the connection]
sgronblo has quit [Ping timeout: 240 seconds]
larhat has quit [Quit: Leaving.]
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
Anarchos has joined #ocaml
<Anarchos>
How to debug a oUnit2 failing test ? Is ocamldebug easy to use in this case ?
Merv_ has quit [Ping timeout: 268 seconds]
ontologiae_ has quit [Ping timeout: 246 seconds]
<gasche>
Nephe: sorry, I missed the "directed" part indeed
marsam has quit [Remote host closed the connection]
Anarchos has quit [Quit: Vision[0.10.1]: i've been blurred!]
sepp2k has quit [Ping timeout: 240 seconds]
Simn has quit [Read error: Connection reset by peer]
mengu has quit [Quit: Leaving...]
Anarchos has joined #ocaml
<Anarchos>
why not replace all the floats used in source code by (float_of_int XXX) to get rid of stranges errors due to locale when compiling the compiler ?
sh0t has quit [Remote host closed the connection]
<gasche>
Anarchos: that wouldn't necessarily solve the problem if float_of_int itself uses a locale-sensitive C library
<gasche>
(also, are there floats in the OCaml sources of the compiler?)
<Anarchos>
gasche yes they are in Hashtabl if i remember
<Anarchos>
and in compact.c and other GC related files
Merv_ has joined #ocaml
<gasche>
well the C files are a different matter
<Anarchos>
sure.
<gasche>
but I just checked and there are in the OCaml sources as well indeed; bytecomp/switch uses floats for heuristic computations for examples