zpe has quit [Read error: Connection reset by peer]
zpe has joined #ocaml
<xavierm02>
Hi. About ocamlgraph, why is the only option Concrete in Digraph? Why isn't Abstract available?
serge has quit [Remote host closed the connection]
Simn has joined #ocaml
serge has joined #ocaml
thomasga has joined #ocaml
kakadu has joined #ocaml
thomasga1 has joined #ocaml
zpe has quit [Remote host closed the connection]
c74d has quit [Remote host closed the connection]
thomasga has quit [Ping timeout: 256 seconds]
c74d has joined #ocaml
dsheets has joined #ocaml
WhatElse has joined #ocaml
WhatElse has quit [Client Quit]
sheijk has joined #ocaml
<xavierm02>
Hi. About ocamlgraph, why is the only option Concrete in Digraph for Bidirectional graphs? Why isn't Abstract available?
dav has quit [Ping timeout: 255 seconds]
c74d has quit [Read error: Connection reset by peer]
sheijk has quit [Ping timeout: 244 seconds]
dav has joined #ocaml
jgjl has joined #ocaml
c74d has joined #ocaml
siddharthv is now known as siddharthv_away
siddharthv_away is now known as siddharthv
hausdorff has quit [Remote host closed the connection]
zpe has joined #ocaml
hausdorff has joined #ocaml
arj has quit [Quit: Leaving.]
hausdorff has quit [Remote host closed the connection]
AltGr has left #ocaml [#ocaml]
ggole_ has quit [Ping timeout: 255 seconds]
_andre has joined #ocaml
lordkryss has quit [Quit: Connection closed for inactivity]
ggole_ has joined #ocaml
ggole_ is now known as ggole
sheijk has joined #ocaml
sheijk has quit [Ping timeout: 264 seconds]
ingsoc has joined #ocaml
ingsoc has left #ocaml [#ocaml]
xavierm02 has quit [Ping timeout: 246 seconds]
hausdorff has joined #ocaml
hausdorff has quit [Ping timeout: 264 seconds]
jao has joined #ocaml
jao has joined #ocaml
jao has quit [Changing host]
jonludlam has joined #ocaml
AlexRussia has joined #ocaml
jonludlam has quit [Quit: Coyote finally caught me]
jonludlam has joined #ocaml
arj has joined #ocaml
serge has quit [Remote host closed the connection]
serge has joined #ocaml
ygrek has joined #ocaml
arj has quit [Quit: Leaving.]
ysz_ has joined #ocaml
sheijk has joined #ocaml
sheijk has quit [Ping timeout: 250 seconds]
hausdorff has joined #ocaml
BitPuffin has joined #ocaml
hausdorff has quit [Ping timeout: 272 seconds]
jgjl has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Arsenik has quit [Remote host closed the connection]
Thooms has joined #ocaml
siddharthv is now known as siddharthv_away
sheijk has joined #ocaml
sheijk has quit [Ping timeout: 244 seconds]
serge has quit [Remote host closed the connection]
serge has joined #ocaml
arj has joined #ocaml
mort___ has joined #ocaml
claudiuc has quit [Remote host closed the connection]
Thooms has quit [Quit: WeeChat 1.0.1]
jgjl has joined #ocaml
larhat has joined #ocaml
BitPuffin has quit [Ping timeout: 256 seconds]
sheijk has joined #ocaml
<companion_cube>
how can I /disable/ a warning in ocamlbuild's _tags file?
<whitequark>
true: warn(-7)
<companion_cube>
oh, parenthesis. thanks.
samrat has quit [Quit: Computer has gone to sleep.]
ygrek has quit [Ping timeout: 264 seconds]
hausdorff has joined #ocaml
nojb has quit [Quit: nojb]
hausdorff has quit [Ping timeout: 244 seconds]
shinnya has joined #ocaml
jao has quit [Ping timeout: 265 seconds]
govg has joined #ocaml
nojb has joined #ocaml
ysz_ has quit [Quit: Leaving]
Thooms has joined #ocaml
hugomg has joined #ocaml
<companion_cube>
gasche: it works so much better with the new implementation
lordkryss has joined #ocaml
badkins has joined #ocaml
ollehar has joined #ocaml
sepp2k has quit [Quit: Konversation terminated!]
hausdorff has joined #ocaml
samrat has joined #ocaml
hausdorff has quit [Ping timeout: 260 seconds]
<hugomg>
question: if I have a "type t = private int", I can coerce from t to int using (x :> int) but is there a way to coerce from int to t without needing to do a function call?
<nojb>
hugomg: no
<hugomg>
ok then... thanks
<nojb>
hugomg: type t = private int declares a *subtype* of int and you would need runtime type information to cast the other way
<whitequark>
hugomg: that's the point of "private"
<flux>
for example: type even_integer = private int
<flux>
because there is no way to cast a regular integer into an even_integer, you can guarantee the property with your functions.
<MercurialAlchemi>
is it wildly used?
<flux>
probably not
<flux>
but at some places it fits great
<MercurialAlchemi>
mm, yeah
<ggole>
private is nice to allow matching while still requiring using the invariant-preserving interface
<flux>
apparently it's used more than I thought
<flux>
grepping random ocaml sources
<MercurialAlchemi>
I'd use phantom types for the same thing, but that's much less burdensome
<flux>
how would you use it for the same thing?
<nojb>
sometimes it is good for efficiency: if type t = private t and, say, val x : t list then one can do (x :> int list) without any allocation
<nojb>
sorry, *type t = private int*
<hugomg>
I was thinking about the efficiency point but backwards, from (int list) to (t list). But now I see that this would only make sense if my int_to_t function is the identity and thats not the case if I want to enforce additional invariants
<MercurialAlchemi>
flux: never mind, I wasn't thinking
<MercurialAlchemi>
flux: but if you use phantom types to ensure that a data type X is validated before going through the database, you could use UnvalidatedX in part of your program, and ValidatedX = private UnvalidatedX (only available from your sanitizing function) elsewhere
shinnya has quit [Ping timeout: 264 seconds]
jonludlam has quit [Ping timeout: 272 seconds]
xavierm02 has joined #ocaml
xavierm02 has quit [Client Quit]
arj has quit [Quit: Leaving.]
arj has joined #ocaml
samuel02 has joined #ocaml
darkf has quit [Quit: Leaving]
arj has quit [Quit: Leaving.]
hausdorff has joined #ocaml
huza has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
hausdorff has quit [Ping timeout: 264 seconds]
mcclurmc has joined #ocaml
BitPuffin has joined #ocaml
BitPuffin has quit [Remote host closed the connection]
jonludlam has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
Thooms has quit [Quit: WeeChat 1.0.1]
mcclurmc has joined #ocaml
huza has quit [Quit: WeeChat 0.3.8]
BitPuffin has joined #ocaml
captain_furious has joined #ocaml
sheijk has quit [Ping timeout: 265 seconds]
samuel02 has quit [Read error: Connection reset by peer]
<captain_furious>
hi, is there a recommended plugin for eclipse or a standalone IDE that anyone could recommend for Ocaml dev
<captain_furious>
or one for IntelliJ IDEA
<nojb>
captain_furious: emacs + merlin ?
<captain_furious>
nojb: Never used Emacs, I use eclipse for python and erlang development
zpe has quit [Remote host closed the connection]
<captain_furious>
and intelliJ for web dev so either of those environments for plugins would be good
<nojb>
captain_furious: there used to be a plugin for Eclipse, I think, but I am pretty sure that is not mantained anymore …
zpe has joined #ocaml
<nojb>
other than that, I think only vim and emacs have any editor support for ocaml …
samuel02 has joined #ocaml
hausdorff has joined #ocaml
hausdorff has quit [Ping timeout: 255 seconds]
<captain_furious>
hmmm ok, looks like one is no longer maintained but there is one called Ocaml Development Tools, last update was end 2013
sheijk has joined #ocaml
samuel02 has quit []
ollehar has quit [Ping timeout: 260 seconds]
larhat has quit [Quit: Leaving.]
fraggle-boate has quit [Ping timeout: 245 seconds]
lordkryss has quit [Quit: Connection closed for inactivity]
ddosia has quit [Ping timeout: 264 seconds]
fraggle-boate has joined #ocaml
nojb has quit [Quit: nojb]
<whitequark>
sublime text has some as well
lordkryss has joined #ocaml
govg has quit [Quit: leaving]
<captain_furious>
what is the status of multicore atm ?
<captain_furious>
seems there has been some recent developments after a bit of a lull
<companion_cube>
it's like duke nukem forever
<captain_furious>
real world ocaml the current best start to learning ?
bytbox has quit [Remote host closed the connection]
hausdorff has joined #ocaml
boogie has joined #ocaml
rossberg has joined #ocaml
hausdorff has quit [Ping timeout: 255 seconds]
Hannibal_Smith has joined #ocaml
<MercurialAlchemi>
what do you do if you want a hierarchy of exceptions in OCaml?
<companion_cube>
what do you mean?
<dsheets>
probably polymorphic variant classes inside an exception constructor
<dsheets>
with MyError #sort_of_bad_stuff -> failwith "eh, i die"
bytbox has joined #ocaml
kakadu has quit [Ping timeout: 246 seconds]
bytbox has quit [Remote host closed the connection]
<ggole>
Stop wanting that? :)
zpe has joined #ocaml
<Drup>
MercurialAlchemi: "type 'a validated = unvalidated" is indeed something quite common when using phantom type
<Drup>
but it doesn't work as great as you would expect, because of various subtyping issue
<Drup>
(basically, you often need to close the phantom type in the 'a to make the coercion principal ...)
<Drup>
you're better off with a polymorphic function 'a validated -> unvalidated
<Drup>
captain_furious: merlin is our IDE-library for OCaml (and it's really awesome), it's for now compatible with emacs, vim and sublime text. It could probably be made compatible with other thing, if you are motivated :p
<rks`>
i think someone was working on an eclipse plugin using merlin.
vogler has quit [Ping timeout: 265 seconds]
jwatzman|work has joined #ocaml
govg has joined #ocaml
<captain_furious>
Drup: I am just starting to learn Ocaml today :)
<Drup>
sure :)
<MercurialAlchemi>
dsheets: right
<captain_furious>
i see ocaml has classes/objects
<MercurialAlchemi>
Drup: I'll have to experiment with that
<captain_furious>
are these hear for convenience/pragmatism or are they used often ?
<Drup>
none of the two :D
<nojb>
captain_furious: there not used much - you would do well to ignore them at first
<captain_furious>
also it has loops
<captain_furious>
I am coming to this from erlang
<captain_furious>
tail calls recursion, accumulators etc.
<whitequark>
oh, it should be pretty easy for you then
q66 has joined #ocaml
<captain_furious>
I came from imperative programming and erlang was my first functional language and liked it
<captain_furious>
:)
nojb has quit [Quit: nojb]
<captain_furious>
so is recursion better style over loop constructs ?
<captain_furious>
just wondering why there are these features in functional languyage
<captain_furious>
language*
<Drup>
because it sometimes useful
<captain_furious>
so it is just pragmatism
<Drup>
"pick the best tool for the job", all that
<Drup>
for imperative features, yes
<whitequark>
tbh I don't think the language would lose much without for or while
<whitequark>
they're so marginal
<captain_furious>
it has tail calls too (no stack limit when using recursion)
<Drup>
whitequark: I'm sure someone would have reimplemented them as a syntax extension :3
paddymahoney has joined #ocaml
MrScout has joined #ocaml
<companion_cube>
with break and continue!
BitPuffin has quit [Read error: Connection reset by peer]
kakadu has joined #ocaml
tane has joined #ocaml
jonludlam has quit [Ping timeout: 255 seconds]
<dmbaturin>
companion_cube: break, continue, please_stop, and dont_do_it_again
<MercurialAlchemi>
well, maybe you'd have a coffee_break method...
* MercurialAlchemi
ducks
<Drup>
and here you are, blaming french researchers for the pun-ness of their team name :]
<MercurialAlchemi>
guilty as charged
<MercurialAlchemi>
I'm pleading Frenchness
<whitequark>
which name?
<MercurialAlchemi>
all of them
<dmbaturin>
Which researchers?
<Drup>
all of them :D
paddymahoney has quit [Ping timeout: 255 seconds]
<MercurialAlchemi>
PHP is a fantastic language, with mutation everywhere, but it takes a special kind of programmer to mutate the timezone of your custom date type in your toString() method
<jerith>
That's pretty special.
<MercurialAlchemi>
I need a PHP-to-OCaml transpiler
sheijk_ has joined #ocaml
<jerith>
MercurialAlchemi: I'm not entirely sure it's possible to represent the badness inherent in most PHP code.
sheijk has quit [Ping timeout: 256 seconds]
<MercurialAlchemi>
well, you have these Facebook people who made this typechecker for PHP, that's a start
<Drup>
and a transpiler to C++
<Drup>
(transpiler, I found the name weird, it's just a compiler ...)
<MercurialAlchemi>
well, if it makes source code, then technically, it's a transpiler
<jwatzman|work>
the transpiler is dead, the modern runtime is a JIT. But yeah, PHP is an exciting language... I'm glad that I get to work on the *typechecker* which is in nice ocaml :)
<MercurialAlchemi>
jwatzman|work: exciting, that's the word I was looking for
<hugomg>
captain_furious: as a rule of thumb I prefer using List.iter, List.fold, etc instead of doing recursion by hand. They are the equivalents of for loops in a functional language and make the code a bit more structured (manual tail recursion is a bit like using gotos, but without the fallthrough semantics)
<MercurialAlchemi>
exciting like working in the bomb squad
<MercurialAlchemi>
hugomg: I found the OCaml style guidelines by accident, which do recommend to avoid manual recursion whenever possible
octachron has joined #ocaml
paddymahoney has joined #ocaml
dsheets has quit [Ping timeout: 245 seconds]
ggole has quit []
jao has joined #ocaml
jao has quit [Changing host]
jao has joined #ocaml
jgjl has quit [Ping timeout: 240 seconds]
bytbox has joined #ocaml
jao has quit [Ping timeout: 264 seconds]
paddymahoney has quit [Ping timeout: 272 seconds]
Thooms has joined #ocaml
manizzle has joined #ocaml
robink has quit [Ping timeout: 244 seconds]
robink has joined #ocaml
Simn has quit [Quit: Leaving]
yomimono has joined #ocaml
jonludlam has joined #ocaml
hausdorff has joined #ocaml
pyon has quit [Ping timeout: 240 seconds]
dsheets has joined #ocaml
manud has joined #ocaml
oriba has joined #ocaml
octachron has quit [Quit: Leaving]
larhat has joined #ocaml
bytbox has quit [Remote host closed the connection]
Anarchos has joined #ocaml
claudiuc has joined #ocaml
nlucaroni has quit [Quit: leaving]
slash^ has quit [Read error: Connection reset by peer]
oriba has quit [Quit: oriba]
_andre has quit [Quit: leaving]
govg has quit [Read error: Connection reset by peer]
samrat has quit [Quit: Computer has gone to sleep.]
nojb has joined #ocaml
dch has joined #ocaml
mort___ has quit [Ping timeout: 264 seconds]
BitPuffin has joined #ocaml
hausdorff has quit [Remote host closed the connection]
govg has joined #ocaml
pyon has joined #ocaml
badon has quit [Ping timeout: 244 seconds]
hausdorff has joined #ocaml
badon has joined #ocaml
yomimono has quit [Ping timeout: 260 seconds]
tinaj1234_ has joined #ocaml
bytbox has joined #ocaml
manud has quit [Quit: Be back later ...]
hhugo has joined #ocaml
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
govg has quit [Quit: leaving]
mcclurmc has quit [Remote host closed the connection]
manud has joined #ocaml
oscar_toro has joined #ocaml
mcclurmc has joined #ocaml
BitPuffin has quit [Ping timeout: 272 seconds]
nojb has quit [Quit: nojb]
BitPuffin has joined #ocaml
nojb has joined #ocaml
Submarine has quit [Ping timeout: 265 seconds]
dsheets has quit [Ping timeout: 265 seconds]
nojb has quit [Quit: nojb]
nojb has joined #ocaml
Submarine has joined #ocaml
srcerer_ has joined #ocaml
srcerer has quit [Ping timeout: 245 seconds]
hausdorff has quit [Remote host closed the connection]
hooplahoops has joined #ocaml
tane has quit [Quit: Verlassend]
hugomg has quit [Ping timeout: 244 seconds]
hugomg has joined #ocaml
ontologiae has joined #ocaml
<hooplahoops>
Hi, I'm wondering how to solve the following problem. I would like a simple signature for a Set-like data structure with some operations on it. One operation is 'contains' which checks whether an element is in the set, another is 'map' which maps a function over the set, building a new set
kakadu has quit [Quit: Konversation terminated!]
<hooplahoops>
The problem is now with implementing a module for this, where the module needs a comparison function. I could write a functor accepting a module Compare or somesuch, but the trouble is that the mapping function has the following type: map: ('a -> 'b) -> 'a set -> 'b set
<hooplahoops>
So how do I build a set of 'b from the map function, that has the right comparison?
<Drup>
you obviously need more information to build the destination set
<companion_cube>
there is no simple answer to this
<Drup>
so, a solution would be to have a SetMap functor that takes two modules C1 and C2
<companion_cube>
you might want to write a functor(S1 : Set)(S2 : Set) : sig val map : S1.t -> S2.t end
<nojb>
hooplahoops: as you observe you need to provide the comparison function; I would define a functor MakeMap (S : Set) (T:Set) : sig val map : (S.elem -> T.elem) -> S.t -> T.t end
<companion_cube>
there's some echo around here
<Drup>
I see a consensus emerge :D
<hooplahoops>
Heh, cool, thanks guys :)
captain_furious has quit [Ping timeout: 264 seconds]
<hooplahoops>
This is what I thought, but does it not mean that the map type is no longer compatible with the signature ('a -> 'b) -> 'a set -> 'b set
<hooplahoops>
?
<hooplahoops>
Because now for every 'a and 'b I wanted to use, I'd have to instantiate a functor
<Drup>
You can't have ('a -> 'b) -> 'a set -> 'b set
<Drup>
yes
hausdorff has joined #ocaml
<Drup>
hooplahoops: "'a set" doesn't make sense to begin with, in fact
<hooplahoops>
Drup: why is that?
<Drup>
well, who is 'a ?
<Drup>
it can only be one thing, it's the type Compare.t
<Drup>
since you need knowledge about it, it's not polymorphic
<hooplahoops>
Right, but isn't Compare.t orthogonal to my original signature?
nlucaroni has joined #ocaml
lordkryss has quit [Quit: Connection closed for inactivity]
<hooplahoops>
My trouble is that in my signature I don't want to assume sets are implemented in terms of a Comparison function
<mrvn>
hooplahoops: but they are
<hooplahoops>
I can imagine different implementations
<mrvn>
not with the given functionality
<nojb>
mrvn: not necessarily: one could polymorphic compare …
<mrvn>
nojb: that is a comparison function
<mrvn>
And yes, why not have an 'a set with the polymorphic compare?
<nojb>
yes, sorry, I meant that in that case it does not have to be given as extra data
<mrvn>
Too bad you can have a function with type t = 'a M.t
<mrvn>
s/function/functor/
<hooplahoops>
So I guess the problem is as follows: I can write a polymorphic map with the above signature for lists, but not for sets that have constraints (such as needing a comparison function)
<hooplahoops>
So if I wanted a separate signature Mappable, containing only map, then I couldn't implement that for any modules created through functors
<Drup>
yes
<hooplahoops>
That's interesting, because one could argue that the constraints are perhaps induced by orthogonal functionality
<Drup>
you can't have "constraind polymorphism" in ocaml
<hooplahoops>
Right
<hooplahoops>
I guess one thing you could do is separate out all the stuff that does need the comparison function into a separate (nested) signature
<hooplahoops>
and implement it through a functor
<hooplahoops>
but then the trouble is that I could instantiate that functor multiple times
<hooplahoops>
for the same abstract 'set' type
<hooplahoops>
So I suppose that type classes are able to escape this is through the invariant that an instance is (globally) unique for a given data type
jonludlam has quit [Ping timeout: 256 seconds]
ontologiae has quit [Ping timeout: 264 seconds]
<hooplahoops>
(but they have other issues)
<Drup>
but they have other issues, indeed :)
<hooplahoops>
It's interesting though, given that we think we can encode one in the other and vice versa
<hooplahoops>
But the above problem feels like a limitation that may affect modularity in a way that isn't obvious
govg has joined #ocaml
<hooplahoops>
So maybe I can specify all the signatures and make it look right, but one of several implementations might have some requirement (constraint) that makes it impossible to implement some interface
<Drup>
or you can think the other way
Hannibal_Smith has quit [Quit: Sto andando via]
<Drup>
that's it, assume no polymorphism is possible
<hooplahoops>
That means no parameterized types?
<hooplahoops>
Just use functors instead you mean?
<Drup>
what's your exact goal by the way ? create a "collection" interface and try to make everything (list, set, ...) fit it ?
<hooplahoops>
Yes, basically, though it's only an excercise
jonludlam has joined #ocaml
<nojb>
hooplahoops: by the way you don’t need the functor to define the map function; if you have two sets S and T then you define: let map f s = S.fold (fun e t -> T.add (f e) t) s T.empty. You still need to define a different `map’ for each choice of pair of set types S and T.
<hooplahoops>
I'm trying to work out a new module system
<Drup>
work out a new module system ? :)
<hooplahoops>
nojb: yeah that's the trouble :)
<hooplahoops>
Drup: A module system where you can specify backwards compatibility, and one where you can import modules by specifying a list of constraints (signatures)
<hooplahoops>
Which means you can have as many different versions active and installed simulteneously as you like
<hooplahoops>
And don't have to worry about version constraints on dependencies etc, it's checked by the compiler automatically
<whitequark>
I think you can do this with first class modules already
<Drup>
I think it's not the modules' job to handle that.
<whitequark>
that too
<hooplahoops>
You think there should be a layer on top, or your package manager should handle it?
sheijk has joined #ocaml
<hooplahoops>
The thing is that right now implementations dependent on implementations
<hooplahoops>
and compatiblity is not verified, it's approximated through version constraints
<Drup>
you could have the package layer much closer to the module layer than it is currently
<Drup>
but module boundary is too fine grain for dependency checking
MercurialAlchemi has quit [Ping timeout: 255 seconds]
<Drup>
You don't need crazy dependency stuff between the modules of your own library, for example.
<hooplahoops>
Yeah, possible, I'm seeing how far this can be pushed
<hooplahoops>
yes, precisely
<hooplahoops>
Within a project you can depend on implementations more than for external projects
<Drup>
also, your remark has more to do with the way the ocaml ecosystem was developed
sheijk_ has quit [Ping timeout: 258 seconds]
<Drup>
We don't have any central "signature repository" where everyone agree on what a module implementing Compare is.
sheijk has quit [Client Quit]
<hooplahoops>
The remark pertains mostly to existing package systems, I have most experience with haskell in this regard
<Drup>
I can see that, yes
<hooplahoops>
Yes, precisely, but that's what I want
<hooplahoops>
Where you publish interface packages, which are hashed
<hooplahoops>
And referenced explicitly through version numbers
<hooplahoops>
(If a user has a different notion of the same name there's a compile error, the signatures are hashed)
<Drup>
anyway, I invite you to learn more about OCaml's module system before trying to invent your own, because you clearly don't know it well enough just yet ;)
<hooplahoops>
Yes, fair enough :)
<Drup>
(and Haskell's modules system .. pffr what the hell I'm saying, there is no such thing)
<hooplahoops>
I certainly will, it seems quite powerful
<Drup>
whitequark: I have an issue with custom local llvm
<Drup>
I did the export and all that
<hooplahoops>
yeah, they've been working on backpack, which fixes that
<Drup>
and I have "/usr/bin/ld: can't find -lLLVM-3.6svn"
<Drup>
hooplahoops: they can't really fix it while keeping type classes's uniqueness
mcclurmc has quit [Remote host closed the connection]
<Drup>
backpack is just a bandage, and they have ton's of issue with it
mcclurmc has joined #ocaml
<Drup>
tons*
<hooplahoops>
Yeah, I'm sure that's true :)
<Drup>
whitequark: any idea ? :(
mcclurmc has quit [Read error: Connection reset by peer]
mcclurmc has joined #ocaml
bytbox has quit [Remote host closed the connection]
<Drup>
hooplahoops: you might be interested by the proposal for implicits in OCaml
<hooplahoops>
Drup: it enabled type-classy-like behaviour?