adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | Current MOOC: https://huit.re/ocamlmooc | OCaml 4.04.0 release notes: http://ocaml.org/releases/4.04.html | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml
infinity0 has quit [Ping timeout: 260 seconds]
freusque has quit [Ping timeout: 240 seconds]
infinity0 has joined #ocaml
nomicflux has joined #ocaml
infinity0 has quit [Remote host closed the connection]
sepp2k has quit [Quit: Leaving.]
infinity0 has joined #ocaml
orbifx has joined #ocaml
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
haesbaer1 has quit [Quit: leaving]
pigeonv has quit [Ping timeout: 240 seconds]
haesbaert has joined #ocaml
<orbifx> companion_cube: thanks for the answer.. couldn't keep any focus on the channel today
<reynir> companion_cube: I've ported dns resolutoin and geoip(4,6)
<reynir> they're pretty simple...
sh0t has quit [Remote host closed the connection]
zv has quit [Quit: WeeChat 1.6]
ryanartecona has quit [Quit: ryanartecona]
manizzle has joined #ocaml
P4Titan` has joined #ocaml
nilof_ has quit [Quit: Going offline, see ya! (www.adiirc.com)]
P4Titan has quit [Ping timeout: 252 seconds]
P4Titan`` has joined #ocaml
P4Titan` has quit [Ping timeout: 276 seconds]
fraggle_ has quit [Ping timeout: 255 seconds]
fluter has quit [Ping timeout: 245 seconds]
fraggle_ has joined #ocaml
yomimono has quit [Ping timeout: 240 seconds]
fluter has joined #ocaml
P4Titan`` has quit [Ping timeout: 276 seconds]
silver has quit [Read error: Connection reset by peer]
kolko_ has quit [Quit: ZNC - http://znc.in]
mengu has quit [Quit: Leaving...]
kolko has joined #ocaml
orbifx has quit [Ping timeout: 264 seconds]
FreeBirdLjj has joined #ocaml
noddy has quit [Ping timeout: 240 seconds]
mfp has quit [Ping timeout: 240 seconds]
FreeBird_ has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 240 seconds]
noddy has joined #ocaml
yomimono has joined #ocaml
lopex has quit [Quit: Connection closed for inactivity]
yomimono has quit [Ping timeout: 245 seconds]
fraggle_ has quit [Ping timeout: 255 seconds]
ryanartecona has joined #ocaml
fraggle_ has joined #ocaml
govg has quit [Ping timeout: 260 seconds]
zv has joined #ocaml
zv has quit [Changing host]
zv has joined #ocaml
fraggle_ has quit [Ping timeout: 255 seconds]
ygrek has quit [Ping timeout: 264 seconds]
nomicflux has quit [Quit: nomicflux]
fraggle_ has joined #ocaml
nomicflux has joined #ocaml
govg has joined #ocaml
ryanartecona has quit [Quit: ryanartecona]
nomicflux has quit [Quit: nomicflux]
Algebr has joined #ocaml
FreeBird_ has quit [Remote host closed the connection]
Muzer has quit [Ping timeout: 256 seconds]
Muzer has joined #ocaml
johnelse_ has joined #ocaml
johnelse has quit [Ping timeout: 264 seconds]
FreeBirdLjj has joined #ocaml
MercurialAlchemi has joined #ocaml
copy` has quit [Quit: Connection closed for inactivity]
justicef_ has quit [Quit: Textual IRC Client: www.textualapp.com]
fre has quit [Ping timeout: 255 seconds]
fre has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 240 seconds]
philtor has quit [Ping timeout: 240 seconds]
freusque has joined #ocaml
MercurialAlchemi has joined #ocaml
Simn has joined #ocaml
jao has quit [Ping timeout: 240 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
kolko has quit [Ping timeout: 240 seconds]
kolko has joined #ocaml
FreeBirdLjj has joined #ocaml
freusque has quit [Ping timeout: 256 seconds]
jnavila has joined #ocaml
jnavila has quit [Client Quit]
jnavila has joined #ocaml
Algebr has quit [Ping timeout: 240 seconds]
nilof_ has joined #ocaml
larhat has joined #ocaml
<companion_cube> so you can ask where someone on the chan is from?
AltGr has joined #ocaml
kakadu has joined #ocaml
ygrek has joined #ocaml
zwild has joined #ocaml
zwild has left #ocaml [#ocaml]
zpe has joined #ocaml
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
mfp has joined #ocaml
<companion_cube> reynir: don't hesitate to make a PR anyway
<companion_cube> or to ask for the commit rights
johnelse_ is now known as johnelse
mengu has joined #ocaml
pigeonv has joined #ocaml
balod has quit [Remote host closed the connection]
balod has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
mengu has quit [Remote host closed the connection]
mengu has joined #ocaml
pigeonv has quit [Ping timeout: 256 seconds]
orbifx-m has joined #ocaml
<orbifx-m> is it possible to define 'constraints' in generic function parameters?
<orbifx-m> because I want to constraint two or more parameters, relative to others
octachron has joined #ocaml
<zozozo> how so ?
<companion_cube> the only constraints you can have are: 1/ same type (use the same type variable) 2/ subtyping constraints
<companion_cube> type 'a t constraints a = [< `A | `B]
<companion_cube> this kind of stuff
<orbifx-m> companion_cube: I could use modules maybe to achieve that
<orbifx-m> but what I'd like is a fun a b where b is depends on the type of a
<orbifx-m> s/is//
<companion_cube> that's going to be tough
<companion_cube> `val f : 'a -> (module S with type foo='a) -> …` is possible though
<companion_cube> but only for the type variables, not for parametrized types
<orbifx-m> why not?
<companion_cube> because OCaml doesn't allow it.
<companion_cube> you can not abstract over parametrized types
<companion_cube> (except with functors)
_andre has joined #ocaml
<octachron> orbifx-m, it might be useful to precise what you are trying to do, you could be asking a question that is much harder than the problem that you are trying to solve
<orbifx-m> OK, I think I understand why. by type variables, are you referring to the so phantom types?
frefity has quit [Ping timeout: 264 seconds]
<companion_cube> just the 'a
<orbifx-m> octachron: I want to know if I can have a generic function with one parameter constraint by some information of the other (a set of permitted polymorphic variants maybe)
<orbifx-m> constrained ^
<freehck> hello people. is it possible it specify bind-name for a labeled argument and its type at the same time? I mean `~password:pass` specify that the value of argumend "password" will be bound with the symbol pass inside the function. And `~(password:string)` says that labeled argument "password" has type "string. How to say both these things simultaneously?
<octachron> orbifx-m, "let f (x : [< `A|`B] as 'a) (y:'a) = … " ?
<octachron> freehck, "let f ~x:(x:int) = x"
<freehck> octachron: thx!
<companion_cube> `let f ~(x:int) = …` shorter
<freehck> companion_cube: it was about syntax :)
<freehck> ~password:(pass:string)
<companion_cube> ah
<companion_cube> because octachron's answer didn't rename x :p
<orbifx-m> octachron: there you have specified A | B, I want it to depend on y
<octachron> companion_cube, yes, my example was bad. Here is a better one: "let f ~x:(y:int) = y"
<orbifx-m> say if y was a record or module
<companion_cube> yes, better :p
<orbifx-m> or maybe by the type of y itself if it's a phantom type
<octachron> orbifx-m, try to write what you want in your prefered fantasy syntax, it would be easier to see if it can be mapped to a possible ocaml construction
frefity has joined #ocaml
sz0 has joined #ocaml
<octachron> orbifx-m, silly example: in "let f (x:'a) (y:'a) = ()", the type of x and y are constrained relatively to each other.
<orbifx-m> let f x y constraint x = y.permitted
<companion_cube> would permitted be a field?
<orbifx-m> where x, y are the types
<orbifx-m> companion_cube: could be. I suspect it could be a module, but that would be more verbose
<companion_cube> .permitted will only work for a record or module, yes
<companion_cube> `val f : 'a -> (module Foo with type permitted = 'a) -> …`
<companion_cube> this would work
silver has joined #ocaml
<companion_cube> I think you should probably use a functor
<orbifx-m> why so?
smondet` has joined #ocaml
smondet has quit [Remote host closed the connection]
<companion_cube> because this is going to be painful with mere polymorphism (read: lots of first-class modules)
<companion_cube> and if you only manipulate modules, why not use a functor?
<octachron> orbifx-m, your y.permitted constraint is essentially a type-level function, depending on the required complexity of this function, functors can be the easiest path
<octachron> orbifx-m, then if you are still working on your typed filepath example, a simpler solution might exists
<orbifx-m> octachron: I am yes.brainstorming. it's an overkill for what I need but I'm interested in the problem
<orbifx-m> in my case I can abstract three types and be done with it.
<octachron> a possibility is to make the phantom type y carries around the permitted types, for instance
<octachron> "let f (x:'a t) (y:('b * 'a) t) = … "
snowcrshd has joined #ocaml
ocalm has quit [Read error: Connection reset by peer]
<orbifx-m> octachron: yes. that's the sort of solution I wanted
ocalm has joined #ocaml
<orbifx-m> if I can make this concise enough to use instead of defining a functor and module or just abstracting three types..
<orbifx-m> I could use it in this case too
malc_ has joined #ocaml
<octachron> orbifx-m, honestly you should write down precisely which functions you are trying to write
<octachron> and then see how much complexity do you really need
<octachron> otherwise you may pay a very step price for trying to solve a too generic problem without need
frefity has quit [Ping timeout: 255 seconds]
<orbifx-m> it's for fun, but you are right
<orbifx-m> I only need one function. but it's a nice problem to learn more about Ocaml's type system
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 240 seconds]
FreeBirdLjj has joined #ocaml
frefity has joined #ocaml
<reynir> companion_cube: No, it's very simple. »!drill reyn.ir« and you get back »37.139.20.143«, etc :-) I will take a look at adding it to calculon when I get time
sepp2k has joined #ocaml
<companion_cube> ^^
digiorgi has joined #ocaml
<digiorgi> in the office i have windows only pcs, can i develop there ocaml? i mean, will tuareg and the other tooling still work on windows? (i'm a windows noob)
<companion_cube> with cygwin it should work, I think
govg has quit [Ping timeout: 255 seconds]
<dmbaturin> There's ongoing effort to make opam actually work on windows.
<orbifx-m> digiorgi: there are always virtual machines. also kick up some fuss and ask for a Linux machine
freechips has joined #ocaml
FreeBirdLjj has quit [Read error: Connection reset by peer]
fraggle_ has quit [Ping timeout: 255 seconds]
FreeBirdLjj has joined #ocaml
frefity has quit [Ping timeout: 240 seconds]
frefity has joined #ocaml
<freehck> I found that I usually create .mli files only when I want to hide type/function from module interface. Is there a way to not create .mli files? I know there's `private` keyword for types. Is there something similar for let bindings?
<companion_cube> no, sorry
<companion_cube> and private doesn't mean what you think it does
<companion_cube> freehck: in general, .mli files are nice
<freehck> it hides type definition, isn't it?
<freehck> *doesn't it
fraggle_ has joined #ocaml
<freehck> Ah... I see. private keyword enables destructing for pattern matching.
<companion_cube> yes
<octachron> freehck, more precisely private creates a private subtype, so you can convert between the subtype to the main type, but conversion in the reverse sense is not possible
<companion_cube> octachron: that's for private aliases, but you also have private type definitions
<companion_cube> which are read-only from the outside
<octachron> companion_cube, ah right, I erroneously unified the two behaviors.
malina has joined #ocaml
mengu has quit [Remote host closed the connection]
sz0 has quit [Quit: Connection closed for inactivity]
FreeBirdLjj has quit [Remote host closed the connection]
<freehck> octachron: btw, I still don't know why and how can I use this conversions.
<freehck> It's of course interesting that I can do for x of type (Abstr.t = int) list list something like this (x :> int list list), but I've never seen the case.
<freehck> And the keyword to hide some definitions while autogenerating its interface would be a great stuff.
<Drup> freehck: honestly, just write your mli, it provides documentation.
nomicflux has joined #ocaml
mengu has joined #ocaml
frefity has quit [Quit: Ex-Chat]
frefity has joined #ocaml
mengu has quit [Ping timeout: 258 seconds]
noddy has quit [Ping timeout: 255 seconds]
<Simn> I feel stupid, why does `let rec test (x : 'a) = test "foo" in test 12` not compile?
<Drup> 'a in (oca)ml are unification variables, not universally quantified type variables
<Drup> if you want a function of type forall 'a -> _, you need to write it like that :
<Drup> let rec test : 'a . 'a -> _ = fun x -> test "foo" in test 12 ;;
<companion_cube> freehck: `type t = private int` is sometimes convenient
<companion_cube> basically, these values can only be constructed by functions in this module
<companion_cube> which can enforce invariants (e.g. only accepting positive integers)
<companion_cube> if you want to, say, print a `t` you can just `Format.printf "%d@." (x:>int)`
<Simn> Drup, thanks! Can't say I fully understand it yet, but it works fine.
noddy has joined #ocaml
nomicflux has quit [Quit: nomicflux]
al-damiri has joined #ocaml
fraggle_ has quit [Remote host closed the connection]
lopex has joined #ocaml
Denommus has joined #ocaml
noddy has quit [Ping timeout: 260 seconds]
MercurialAlchemi has quit [Ping timeout: 240 seconds]
<orbifx-m> octachron, Drupe, companion_cube, I got a solution with phantom types and one module for abstraction
silver_ has joined #ocaml
silver has quit [Ping timeout: 255 seconds]
silver_ is now known as silver
<freehck> companion_cube: well I can't see the difference between (x:>int) and (Positive.to_int x)
<freehck> I think there's more information in the 2nd case
<Drup> freehck: there is little difference, "private" is a memory layout optimisation that breaks abstraction boundary, there is little reason to use it in practice, exposing a to_int function is cleaner
<companion_cube> freehck: no real difference
<companion_cube> except, well, `[x;y]:> int list` is totally free at runtime
<zozozo> Drup: well, for sum types on which you want to match, private types are useful
<Drup> zozozo: yes, I meant private aliases
average has quit [Ping timeout: 245 seconds]
<zozozo> in that case, sure, ^^
kakadu has quit [Quit: Konversation terminated!]
kakadu has joined #ocaml
kakadu has quit [Client Quit]
yomimono has joined #ocaml
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
sh0t has joined #ocaml
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
zpe_ has joined #ocaml
zpe has quit [Read error: Connection reset by peer]
tobiasBora has quit [Quit: Kthxbye]
shinnya has joined #ocaml
_y has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
ocalm has quit [Quit: Leaving]
unbalancedparen has joined #ocaml
fraggle-boate has quit [Remote host closed the connection]
ryanartecona has joined #ocaml
yomimono has quit [Ping timeout: 255 seconds]
fraggle-boate has joined #ocaml
slash^ has joined #ocaml
MercurialAlchemi has joined #ocaml
digiorgi has quit [Quit: Leaving]
unbalancedparen has quit [Ping timeout: 264 seconds]
noddy has joined #ocaml
jnavila has quit [Quit: It was time]
noddy has quit [Ping timeout: 256 seconds]
unbalancedparen has joined #ocaml
zpe_ has quit [Remote host closed the connection]
yomimono has joined #ocaml
noddy has joined #ocaml
philtor has joined #ocaml
malc_ has quit [Ping timeout: 240 seconds]
tane has joined #ocaml
rwmjones has quit [Ping timeout: 240 seconds]
rwmjones has joined #ocaml
AltGr has left #ocaml [#ocaml]
jnavila has joined #ocaml
lopex has quit [Quit: Connection closed for inactivity]
average has joined #ocaml
shinnya has quit [Ping timeout: 240 seconds]
ryanartecona has quit [Quit: ryanartecona]
slash^ has quit [Read error: Connection reset by peer]
orbifx-m has quit [Ping timeout: 260 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 240 seconds]
Simn has quit [Ping timeout: 264 seconds]
Algebr has joined #ocaml
ryanartecona has joined #ocaml
noddy has quit [Quit: WeeChat 1.7]
_y has joined #ocaml
ygrek has quit [Ping timeout: 260 seconds]
<flux> "We are please to announce that the beta of Opam 2.0.0 is out!"
<flux> +d ;-)
<Drup> (and it's great)
<theblatte> \o/
<flux> so what will I break after switching to 2.0?
<Leonidas> probably everything ;-)
copy` has joined #ocaml
yomimono has quit [Ping timeout: 260 seconds]
<Leonidas> it seems to support local switches, so that's by far my most anticipated feature
<Leonidas> if it could automatically switch depending on project folder, that'd be awesome
ygrek has joined #ocaml
freusque has joined #ocaml
<Drup> Leonidas: "opam build" will use the locally available switch. The traditional command will not, but you can use "eval $(opam env --switch path/to∕my/local/switch)" to switch locally to your shell
<Drup> traditional shell commands*
rpg has joined #ocaml
ryanartecona has quit [Quit: ryanartecona]
snowcrshd has quit [Remote host closed the connection]
<Leonidas> Drup: thanks, looks like opam build will become my new best friend :)
<companion_cube> yayay
mengu has joined #ocaml
mengu has quit [Ping timeout: 252 seconds]
emilymhorsman has joined #ocaml
_andre has quit [Quit: leaving]
ryanartecona has joined #ocaml
TheLemonMan has joined #ocaml
fraggle_ has joined #ocaml
Algebr has quit [Ping timeout: 264 seconds]
cdidd has quit [Ping timeout: 257 seconds]
kakadu has joined #ocaml
cdidd has joined #ocaml
ryanartecona has quit [Quit: ryanartecona]
ryanartecona has joined #ocaml
average has quit [Remote host closed the connection]
Guest63925 has joined #ocaml
<octachron> Drup, might I suggest to be a tad more explicit when looping around the typechecker? :p
<Drup> octachron: well, no, that was the point :D
<Drup> (it's even funnier because, with merlin, you only have to open a file, paste it, and save, and it'll loop! :D)
Denommus has quit [Ping timeout: 252 seconds]
yomimono has joined #ocaml
mengu has joined #ocaml
ryanartecona has quit [Quit: ryanartecona]
fraggle_ has quit [Ping timeout: 255 seconds]
fraggle_ has joined #ocaml
<Leonidas> https://gist.github.com/Leonidas-from-XIV/98efb6bb6fea7c8a8b33cfa55c6f5f4c do I see this correctly that I need the `with` to expose t despite the Mapper type leaving t abstract?
<octachron> Leonidas, yes: with "type … = …" adds the type equality to the signature, exposing the abstract type.
larhat has quit [Ping timeout: 252 seconds]
<Leonidas> octachron: thanks
<lobo> just read about "with type" in "developing applications with objective caml" today :-) almost an ancient book, but the examples were simple/understandable
<Leonidas> I have printed the book on university printers once, its on my shelf :D
<Leonidas> https://gist.github.com/Leonidas-from-XIV/26c30b70f2626c1d526f8eaaaa3419ec came up with this example to illustrate the effect (adapted and stolen from some blog)
tane has quit [Quit: Leaving]
Algebr has joined #ocaml
jnavila has quit [Read error: Connection reset by peer]
sepp2k has quit [Quit: Leaving.]
Simn has joined #ocaml
ryanartecona has joined #ocaml
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
jao has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 255 seconds]
Simn has quit [Quit: Leaving]
octachron has quit [Quit: Leaving]
kakadu has quit [Remote host closed the connection]
al-damiri has quit [Quit: Connection closed for inactivity]
freusque has quit [Ping timeout: 258 seconds]