mistermetaphor has quit [Ping timeout: 276 seconds]
dakk has quit [Ping timeout: 260 seconds]
orbifx-m has joined #ocaml
ygrek has joined #ocaml
regnat has quit [Ping timeout: 276 seconds]
orbifx has quit [Ping timeout: 244 seconds]
ygrek has quit [Ping timeout: 244 seconds]
orbifx has joined #ocaml
orbifx-m has quit [Ping timeout: 260 seconds]
dario1 has joined #ocaml
regnat has joined #ocaml
sdothum has joined #ocaml
oxcsh has joined #ocaml
oxcsh_ has joined #ocaml
<dario1>
Hi everyone! Does Cmdliner support grouping of options into categories?
Sorella has joined #ocaml
oxcsh has quit [Ping timeout: 250 seconds]
devol has joined #ocaml
orbifx has quit [Ping timeout: 276 seconds]
Bahman has joined #ocaml
<zozozo>
dario1: yes
<zozozo>
you can group options in separate Term.t in your code, and also give each option a manpage section under which it should appear in the manpage
orbifx has joined #ocaml
orbifx has quit [Read error: Connection reset by peer]
orbifx2 has joined #ocaml
Anarchos has joined #ocaml
mistermetaphor has joined #ocaml
mistermetaphor has quit [Ping timeout: 244 seconds]
copy` has joined #ocaml
dsheets has joined #ocaml
amnn has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<dario1>
zozozo: Thanks! I'll check for that in the docs...
yegods has quit [Remote host closed the connection]
yegods has joined #ocaml
pierpa has joined #ocaml
dario1 has quit [Quit: Konversation terminated!]
<struk|desk>
Algebr: the critical bits seem to be (1) adding -lc++, (2) making sure the linking pieces are at the end of the command line, after the object files, and (3) moving iostream / sstream further up in the include file, to fix a redefinition of std::ostream::flush to caml_flush
<struk|desk>
Algebr: sorry, adding -lstdc++ not -lc++
mcc has joined #ocaml
tane has joined #ocaml
<mcc>
i have not been in here for a while, so : hello
<Drup>
hello mcc :)
<struk|desk>
hi mcc
Bahman_ has joined #ocaml
jonasen has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Bahman has quit [Ping timeout: 244 seconds]
A1977494 has quit [Remote host closed the connection]
Anarchos has quit [Quit: gardening time]
troydm has quit [Ping timeout: 244 seconds]
dsheets has quit [Remote host closed the connection]
jonasen has joined #ocaml
troydm has joined #ocaml
Bahman__ has joined #ocaml
Bahman_ has quit [Ping timeout: 250 seconds]
jonasen has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<MercurialAlchemi>
how can I tell ocaml that, contrary to what it believes, a parameter is of type [> foo ] and not of type foo?
<Drup>
what's the context ?
<MercurialAlchemi>
specifying it in the signature appears to make no difference in practice
dsheets has joined #ocaml
<Drup>
well, [> foo] unifies with foo, so you have a constraint somewhere asking for foo
<MercurialAlchemi>
I have a type [ `Foo ] and a type [ `Foo | `Bar ]
<MercurialAlchemi>
I have a function which takes another function, and returns either `Foo or the result of the other function
<MercurialAlchemi>
OCaml has decided that the function in parameter has [ `Foo ] as return type, I want to tell it that it's actually [> `Foo]
<MercurialAlchemi>
but no amount of type annotation appears to make a difference, if I attempt to feed anything that returns [ `Foo | `Bar ] it has a fit and refuses to compile
<Drup>
can you show the code ?
amnn has joined #ocaml
<MercurialAlchemi>
let me make a simpler case...
A1977494 has joined #ocaml
oxcsh_ has quit [Remote host closed the connection]
oxcsh has joined #ocaml
sh0t has joined #ocaml
<MercurialAlchemi>
hmm
<MercurialAlchemi>
I think the problem is that one of the functions uses something that eats a [`Foo] and not a [>`Foo]
TheLemonMan has quit [Remote host closed the connection]
<Drup>
well, you can't possibly give a [> `Foo] to something expecting [ `Foo]
<MercurialAlchemi>
it's not quite the issue
walter|r has joined #ocaml
scarygelatin has joined #ocaml
<Enjolras_>
You can cast with :> but i'm not sure this is your problem here. It is not clear without code
<Enjolras_>
but sometimes :> is necessary to help typechecker
<Enjolras_>
let foo = `Foo in foo;;
<Enjolras_>
- : [> `Foo ] = `Foo
<Enjolras_>
let foo :> [ `Foo | `Bar ]= `Foo in foo;;
<Enjolras_>
- : [ `Bar | `Foo ] = `Foo
<Enjolras_>
but i guess we can't help without seeing the code or a more precise description of the code
<Enjolras_>
(funny toplevel reoreders variant. I had never noticed :) )
<MercurialAlchemi>
Enjolras_: I'm trying to pinpoint the issue more precisely
<MercurialAlchemi>
(and litering the code with :> and [>], indeed)
mistermetaphor has joined #ocaml
<Enjolras_>
usually, when you have a type issue with variant, i find the easiest strategy is to anotate manually all function arguments and or let bindings until you find a more precise type error
yegods has quit [Remote host closed the connection]
<Enjolras_>
because it shows you where exactly your expectation is wrong
jonasen has joined #ocaml
yegods has joined #ocaml
<MercurialAlchemi>
well, I can get it to compile by removing a call to a ppx_deriving_show function
<Enjolras_>
(i which it was a merlin feature btw)
mistermetaphor has quit [Ping timeout: 246 seconds]
<Drup>
MercurialAlchemi: what are you deriving from ?
<MercurialAlchemi>
well, in my case it would be [ `Foo ]
<Drup>
why are you not deriving on the biggest datatype ?
<Enjolras_>
pfiu. deriving on polymorphic variants looks scary
<Drup>
Enjolras_: well, it's going to be closed, that's all
<Drup>
nothing scary
TheLemonMan has joined #ocaml
<Enjolras_>
maybe i'm scared for nothing but i don't like the idea of having generated code mixed with subtyping
<Drup>
that's the point, it's not subtyping when a variant is closed
troydm has quit [Ping timeout: 244 seconds]
Mercuria1Alchemi has joined #ocaml
<Enjolras_>
Drup: but the other types you use are not always closed and then it breaks your expectations. Like you derive enum on [`Foo | `Bar], you want to store the results in ([`Foo | `Bar | `Lol ], int) Hashtbl.t. It doesn't work.
<Enjolras_>
it's not a big issue, but if the code becomes complex it can lead to some headache when it's not explicit because the code is generated
<Enjolras_>
actually i don't even know if deriving enum works on variants
dakk has joined #ocaml
troydm has joined #ocaml
<Enjolras_>
there is nothing crazy here, it would happen with a hand written function which returns a closed type and you want to upcast it to store in a collection, but with deriving you don't see the code. Maybe it's not a big deal though :)
Mercuria1Alchemi has quit [Ping timeout: 260 seconds]
<Enjolras_>
hmm. I guess this is called downcast. Whatever
dakk has quit [Ping timeout: 272 seconds]
struktured has joined #ocaml
<struktured>
so if one were to implement a map, would you adhere to Map.S 's signature, or diverge from it because it's too limiting in some way?
<MercurialAlchemi>
ocaml thinks that the signature of M.do_stuff is foo -> foo
<MercurialAlchemi>
it's not like there are type annotations to the contrary or anything
<Drup>
MercurialAlchemi: I told you, foo and [> foo] unifies, so it's perfectly valid
<Drup>
it's like "let f : 'a -> 'a = (+) 1"
<Drup>
it's valid
<MercurialAlchemi>
is "it's valid" a synonym for "you're screwed"?
<Drup>
no, let me look at it
<MercurialAlchemi>
note that removing the type annotation in do_stuff_with_foo and the use of show_foo makes ocaml caml down, but that's not really satisfactory
<Drup>
I removed the useless annotations and kept only the one that is needed
<Drup>
(the others were doing more harm than good ...)
<Drup>
So, basically, the issue is that if you put (foo' :> [> foo]), the typechecker doesn't even bother doing a coercion, since foo' is of a type compatible with [> foo] (namely: foo).
<Drup>
So you need to be a bit more forceful, and tell the typecher the exact coercion you want
<MercurialAlchemi>
ok, I didn't know you could do that
<MercurialAlchemi>
well, thanks
<Drup>
no problem, it's one of those case that is quite tricky
Anarchos has joined #ocaml
yegods_ has joined #ocaml
yegods has quit [Read error: Connection reset by peer]
unbalancedparen has joined #ocaml
struktured has quit [Ping timeout: 260 seconds]
mistermetaphor has joined #ocaml
orbifx has joined #ocaml
orbifx2 has quit [Ping timeout: 260 seconds]
mistermetaphor has quit [Remote host closed the connection]
<MercurialAlchemi>
I can live with that
copy` has quit [Quit: Connection closed for inactivity]
rgrinberg has joined #ocaml
Algebr has quit [Remote host closed the connection]
Algebr has joined #ocaml
dhil has joined #ocaml
sh0t has quit [Remote host closed the connection]
sh0t has joined #ocaml
g4143 has joined #ocaml
amnn has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
darkf has quit [Quit: Leaving]
g4143 has quit [Quit: Ex-Chat]
ygrek has joined #ocaml
amnn has joined #ocaml
yegods_ has quit []
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
copy` has joined #ocaml
amnn has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<Drup>
(there are various other printers that could be simplified too)
dsheets has joined #ocaml
<rgrinberg>
Drup: so we can get rid of the print_* functions in re_* right?
<rgrinberg>
they aren't a part of the public API
<Drup>
everything that is in Re_automaton and Re_cset is not public
<rgrinberg>
yup
<Drup>
I removed one already
<Drup>
I'll let you play with it more :p
dsheets has quit [Ping timeout: 250 seconds]
<Drup>
rgrinberg: while we're at it, could you 4.03 in CI ?
<Drup>
+add
cr4ven has joined #ocaml
bba has joined #ocaml
<cr4ven>
Hi all, I'm just getting start with ocaml and I was wondering if someone could help with (what I assume is) a trivial build issue. I have a file containing just 'open Extlib', but when I try to build it I get an error 'Unbound module Extlib'. You can see the full details here http://pastebin.com/M2HNPqKc
<cr4ven>
Assistance would be greatly appreciated so I can move on to failing at the language itself ;)
rgrinberg has quit [Ping timeout: 276 seconds]
<Drup>
cr4ven: it's "ExtLib"
<Drup>
your first ocamlbuild invocation is correct
pyon has quit [Quit: Ihnen, Herr Lasker, habe ich nur drei Worte zu sagen: Nyan und Pasu~.]
<orbifx>
I'd appreciate if anyone took the time to have a quick read
<orbifx>
Nginx knowledge would be handy
<orbifx>
Next stop is to put it in Opam, but need some core features completed.
dakk has quit [Remote host closed the connection]
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
andy has joined #ocaml
<orbifx>
seliopou: :)
<andy>
Hi, new to ocaml as of today. Was wondering the idiomatic way to output data as a string. (I don't need to be able to read it back.) I have some code here http://pastebin.com/UYK7wEed but I don't want to have to write code like that every time I define a data type!
<andy>
Would like something like c++'s `out << "(" << x << ...` but ocaml doesn't have overloading.
<orbifx>
Printf.printf "%s ..." string;
amnn has joined #ocaml
<andy>
@orbfix: problem is I may not always want to send it to stdout
<orbifx>
Look at the Pervasives and Printf module documentation.