<dora-molly>
it is looking variant per variant for a counter example
<dora-molly>
type +'a t = X : (_ -> _ as 'a) -> 'a t is failing too
<dora-molly>
the typechecker just rejects every variance annotation not applying to a plain type variable
<dora-molly>
I guess that's a safe approximation when we have no idea of what the actual subtyping relation should be :-)
<Drup>
yeah
jwatzman|work has quit [Ping timeout: 265 seconds]
<Drup>
a simplified version of your verison is "Base : (unit -> 'r, 'r) t"
<Drup>
which I would be perfectly fine with
manizzle is now known as WeLoveCP
<dora-molly>
the typechecker should really be refined :'
<dora-molly>
at the same time, what's wrong and what's right is not clear
<Drup>
the whole "subtyping GADT" issue is really tricky
WeLoveCP is now known as manizzle
<dora-molly>
yep
<dora-molly>
gtg, good night
jeffmo has quit [Quit: jeffmo]
freling has joined #ocaml
seangrov` has joined #ocaml
javamonn has quit [Remote host closed the connection]
seangrov` has quit [Ping timeout: 240 seconds]
Hannibal_Smith has quit [Quit: Leaving]
nullcat has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
swgillespie has joined #ocaml
freling has quit [Quit: Leaving.]
freling has joined #ocaml
rgrinberg has joined #ocaml
s1n4 has joined #ocaml
Denommus has quit [Quit: going home]
The_Mad_Pirate has joined #ocaml
rgrinberg has quit [Ping timeout: 245 seconds]
robink has quit [Ping timeout: 255 seconds]
robink_ has joined #ocaml
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
palomer has joined #ocaml
<n3ss3s>
How do I use an original std lib module instead of the one overridden by Core.Std?
<n3ss3s>
(Hashtbl in this case)
<Drup>
the original stdlib in the Caml module
<Drup>
+is
<dmbaturin>
Why does Lwt_stream.is_empty block?
<Drup>
I don't think it really blocks, it will always return imediatly I think
<pippijn>
because it's fast enough
<dmbaturin>
I'm testing some stuff in the REPL, for a newly created empty stream it just hangs until I interrupt it.
<Drup>
that's weird
<Drup>
I don't know
freling has quit [Quit: Leaving.]
<dmbaturin>
If I push a None into the stream, it returns false immediately.
darkf has joined #ocaml
swgillespie has joined #ocaml
javamonn has joined #ocaml
javamonn has quit [Remote host closed the connection]
javamonn has joined #ocaml
ygrek has joined #ocaml
javamonn has quit [Ping timeout: 264 seconds]
javamonn has joined #ocaml
n3ss3s has quit [Ping timeout: 272 seconds]
milosn has joined #ocaml
palomer has quit [Quit: palomer]
psy_ has joined #ocaml
palomer has joined #ocaml
palomer has quit [Client Quit]
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
manizzle has quit [Ping timeout: 240 seconds]
badon has joined #ocaml
thomasga has quit [Quit: Leaving.]
jabesed has quit [Ping timeout: 245 seconds]
mal`` has quit [Ping timeout: 248 seconds]
ygrek has quit [Ping timeout: 272 seconds]
BitPuffin|osx has quit [Ping timeout: 246 seconds]
psy_ has quit [Quit: Leaving]
psy_ has joined #ocaml
palomer has joined #ocaml
mal`` has joined #ocaml
javamonn has quit [Remote host closed the connection]
javamonn has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 246 seconds]
idegen has quit [Quit: Leaving.]
psy_ has quit [Ping timeout: 240 seconds]
nojb has joined #ocaml
Denommus has joined #ocaml
swgillespie has joined #ocaml
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
dubosec has quit [Read error: Connection reset by peer]
ygrek has joined #ocaml
osa1 has quit [Ping timeout: 265 seconds]
dubosec has joined #ocaml
nullcat has joined #ocaml
MercurialAlchemi has joined #ocaml
nojb has quit [Quit: nojb]
rgrinberg has joined #ocaml
palomer has quit [Quit: palomer]
javamonn has quit [Remote host closed the connection]
palomer has joined #ocaml
_whitelogger has joined #ocaml
avsm has joined #ocaml
manizzle has joined #ocaml
_whitelogger has joined #ocaml
nullcat has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
avsm has quit [Quit: Leaving.]
nullcat_ has joined #ocaml
avsm has joined #ocaml
badon has quit [Disconnected by services]
badon_ has joined #ocaml
palomer has quit [Quit: palomer]
kushal has joined #ocaml
badon_ is now known as badon
rgrinberg has quit [Ping timeout: 240 seconds]
nullcat_ has quit [Ping timeout: 256 seconds]
nullcat has joined #ocaml
palomer has joined #ocaml
ygrek has quit [Ping timeout: 256 seconds]
keen________ has joined #ocaml
wildsebastian has joined #ocaml
keen_______ has quit [Ping timeout: 272 seconds]
kushal has quit [Quit: Leaving]
nullcat has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
kushal has joined #ocaml
nullcat has joined #ocaml
Haudegen has quit [Ping timeout: 272 seconds]
nullcat has quit [Ping timeout: 272 seconds]
MercurialAlchemi has quit [Ping timeout: 272 seconds]
nullcat has joined #ocaml
MercurialAlchemi has joined #ocaml
<struktured>
I forgot how to define a polymorphic function inside a rec..
<dora-molly>
let rec f : 'a. … = fun _ -> _
<struktured>
I meant record
<struktured>
type my_rec ={foo : 'a -> unit}
<struktured>
where 'a universal
jonludlam has quit [Ping timeout: 240 seconds]
pobivan has joined #ocaml
Haudegen has joined #ocaml
jonludlam has joined #ocaml
ollehar has quit [Read error: Connection reset by peer]
<flux>
so {foo : 'a. 'a -> unit}
rgrinberg has joined #ocaml
ollehar has joined #ocaml
rgrinberg has quit [Ping timeout: 272 seconds]
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<struktured>
thanks, found a way around it though. next time
seako has joined #ocaml
jonludlam has quit [Ping timeout: 255 seconds]
govg has quit [Quit: leaving]
nojb has joined #ocaml
nullcat__ has joined #ocaml
nullcat has quit [Ping timeout: 256 seconds]
nojb has quit [Quit: nojb]
matason has joined #ocaml
dav- has joined #ocaml
larhat has joined #ocaml
palomer has quit [Quit: palomer]
dav has quit [Ping timeout: 255 seconds]
rgrinberg has joined #ocaml
thomasga has joined #ocaml
rgrinberg has quit [Ping timeout: 240 seconds]
palomer has joined #ocaml
asQuirreL has joined #ocaml
nullcat__ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
octachron has joined #ocaml
pyon has quit [Quit: fix config]
pyon has joined #ocaml
asQuirreL has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
dav- is now known as dav
kushal has quit [Ping timeout: 255 seconds]
lordkryss has joined #ocaml
avsm has quit [Quit: Leaving.]
nojb has joined #ocaml
jonludlam has joined #ocaml
<apache2>
is it possible to have 'when' guards when pattern matching records? I can't seem to get the syntax right
<nojb>
of course
<apache2>
should the when be before or after the new bind-name ?
<nojb>
maybe easier if you post some code
<apache2>
type name = {first : string; last : string }
<flux>
| { first = "hello"; last = lastname } when lastname = "bar" -> ..
<apache2>
match my_name with { first = bob when (String.equals first "bob"); _ } -> ...
<apache2>
ahhh thanks, flux
<flux>
shortcut: | { first = "hello"; last } when last = "bar" -> ..
<apache2>
how about matching options ?
<flux>
you mean | { first = "hello"; last = Some lastname } -> ..
<apache2>
when the type is {first : string option; last : string }
<apache2>
I'd like to have it fall through to the next pattern if first is None
freling has joined #ocaml
<flux>
well, you cannot, you must match, not "non-match"
<flux>
so it would be like { first = Some firstname } -> ..
<flux>
then it falls through if it's None
<apache2>
ok, great!
<apache2>
thanks for the help, really appreciate it
<flux>
no problem. happy matching :)
palomer has quit [Quit: palomer]
mal`` has quit [Ping timeout: 248 seconds]
rgrinberg has joined #ocaml
rgrinberg has quit [Ping timeout: 276 seconds]
s1n4 has quit [Quit: leaving]
nojb has quit [Quit: nojb]
nojb has joined #ocaml
mv has joined #ocaml
Haudegen has quit [Ping timeout: 244 seconds]
nojb has quit [Quit: nojb]
mv has quit [Ping timeout: 246 seconds]
mal`` has joined #ocaml
Haudegen has joined #ocaml
mal`` has quit [Ping timeout: 248 seconds]
larhat has quit [Quit: Leaving.]
mv has joined #ocaml
mal`` has joined #ocaml
rgrinberg has joined #ocaml
palomer has joined #ocaml
freling has quit [Quit: Leaving.]
rgrinberg has quit [Ping timeout: 240 seconds]
sdothum has joined #ocaml
Submarine has joined #ocaml
larhat has joined #ocaml
octachron has quit [Ping timeout: 252 seconds]
yomimono has joined #ocaml
yomimono has quit [Ping timeout: 245 seconds]
TheLemonMan has joined #ocaml
TheLemonMan has quit [Changing host]
TheLemonMan has joined #ocaml
mal`` has quit [Ping timeout: 248 seconds]
palomer has quit [Quit: palomer]
_andre has joined #ocaml
yomimono has joined #ocaml
dav has quit [Ping timeout: 272 seconds]
dav has joined #ocaml
thomasga has quit [Quit: Leaving.]
palomer has joined #ocaml
palomer has quit [Client Quit]
thomasga has joined #ocaml
rgrinberg has joined #ocaml
mal`` has joined #ocaml
thomasga has quit [Client Quit]
rgrinberg has quit [Ping timeout: 244 seconds]
mal`` has quit [Ping timeout: 248 seconds]
mal`` has joined #ocaml
Hannibal_Smith has joined #ocaml
milosn has quit [Quit: leaving]
palomer has joined #ocaml
osa1 has joined #ocaml
larhat has quit [Quit: Leaving.]
thomasga has joined #ocaml
larhat has joined #ocaml
osa1 has quit [Ping timeout: 256 seconds]
jabesed has joined #ocaml
Haudegen has quit [Ping timeout: 245 seconds]
darkf has quit [Read error: Connection reset by peer]
darkf has joined #ocaml
osa1 has joined #ocaml
ggole has joined #ocaml
palomer has quit [Quit: palomer]
cdidd has quit [Ping timeout: 252 seconds]
raboof has joined #ocaml
<raboof>
hi! i'm new to ocaml and just did 'opam install utop'.
<quaranterieur>
congrats!
<raboof>
the docs say 'to use utop, simply run 'utop'', but it's not on my PATH. I found it in ~/.opam/system/bin, so added that - but now it can't find .opam/system/lib/stublibs/dlllambda-term_stubs.so
<raboof>
i feel like i missed a step in the docs :)
<quaranterieur>
eval `opam config env` ?
<Hannibal_Smith>
raboof, when you did opam init, at the end it told to you what to add to your .profile/.bash_profile/.bashrc
<raboof>
'opam install cow' fails while compiling ulex (http://paste.debian.net/171556) - seems 'camlp4orf' is not found. what can I do to fix that?
avsm has joined #ocaml
rgrinberg has quit [Ping timeout: 276 seconds]
mv has quit [Ping timeout: 246 seconds]
freling has quit [Quit: Leaving.]
<companion_cube>
I wonder whether the system switch is responsible for the error
<companion_cube>
try within `opam switch 4.02.1`
bobfang has joined #ocaml
<bobfang>
hi
<bobfang>
quick question
<bobfang>
so if I declare a reference cell inside a function
<bobfang>
is this reference cell, in c term, static?
<ggole>
No
<bobfang>
or I have to declare it outside the function to make it static..
<ggole>
Each call to the ref function allocates a new cell
<bobfang>
so what if I want some reference cell, but this reference is only used by a single function, what would you do?
<ggole>
There's two reasonable options. One is to use a simple global binding, let r = ref ... let f x = ...
<bobfang>
yeah i am using this one...
<bobfang>
is there any better way to do it?
<ggole>
Another is to hide the ref in a let: let f = let r = ref .. in (fun x -> ...)
<ggole>
Either way you can make the ref invisible to the outside world with a signature
osa1 has quit [Quit: Konversation terminated!]
osa1 has joined #ocaml
<ggole>
A possible downside of the latter is that it will not be generalized
osa1 has quit [Ping timeout: 255 seconds]
<xificurC>
don't you guys find the Hashtbl API a bit, clumsy? I was expecting a get of return type 'b option but got find of return type 'b that can throw a runtime exception
<adrien_znc>
the stlib always throws Not_found when something isn't found
<haesbaert>
xificurC: that is the case with most "find" like functinons in the stdlib
<xificurC>
if we have option, why not use it?
<xificurC>
(I mean the type option)
<companion_cube>
the stdlib is *old*, that might explain it
<adrien_znc>
it wasn't made that way 20 years ago
<companion_cube>
people tend to use a more functional style those days
<companion_cube>
happily, containers provides a "get" function 0:-)
<companion_cube>
(batteries and core too, of course)
<xificurC>
still haven't decided what to use :S
<ggole>
Hashtbl is quite clumsy, yes
<ggole>
You can't update values nicely either
lewis1711 has joined #ocaml
BitPuffin has joined #ocaml
<xificurC>
yeah, when they say replace is functionally equivalent to remove and add, does it actually do that or is it coded in a more performant way?
<ggole>
Eg, try to maintain a table of counts: you have to do a silly dance to bump the int or put 1 in if it isn't there is
<ggole>
It only does the one lookup
<xificurC>
ggole: that's what I'm doing right now :)
<lewis1711>
is there anything like a "fold map"? like something that folds successive elements based on some condition, like maybe go over a list of numbers, and sum all the 0's together
<xificurC>
also, no of_list and list_of
<ggole>
lewis1711: not really. You can chain filter/map/fold etc, though.
<xificurC>
by the way, the function I just posted, would a match catching the exception perform better? Now I'm doing 2 lookups
<ggole>
I don't think you can avoid two lookups: that's why modify_or should be part of Hashtbl
<xificurC>
ggole: actually I'm doing 3 no? replace, mem and find
<ggole>
Yeah, you can do it with two
<ggole>
By catching Not_found
dav has quit [Ping timeout: 244 seconds]
<xificurC>
just match find with | normal -> normal | Not_found -> 1?
<ggole>
Pretty much
<ggole>
| exception Not_found -> 1
<xificurC>
thanks
<lewis1711>
yeah I'll write a map in turns of a right fold, then go from there.
dav has joined #ocaml
<ggole>
let modify_or tbl key modify initial = Hashtbl.add tbl key (match Hashtbl.find tbl key with | x -> modify x | exception Not_found -> initial)
<ggole>
And then it's just modify_or tbl key ((+) 1) 1
<xificurC>
there could really just be a val update : ('a, 'b) t -> 'a -> ('b -> 'b) -> unit
<ggole>
That only works if the entry is already present
rgrinberg has joined #ocaml
mal`` has joined #ocaml
<ggole>
Oh, I should have used replace and not add
<xificurC>
ggole: indeed, yours is more general
<ggole>
You could have both
<ggole>
Of course when faced with API design questions like this the stdlib tends to take the 'neither' path
<companion_cube>
xificurC: your function isn't very efficient: mem, find, replace
<xificurC>
ggole: yeah, it seems to be the ML way. Haskell has some *nice* functions in prelude as well
<companion_cube>
could be: find, replace
<xificurC>
companion_cube: indeed, that's what we just discussed with ggole
<companion_cube>
yeah, sorry, didn't read as low yet
* xificurC
spams too much
<companion_cube>
nah, that's fine
javamonn_ has joined #ocaml
<companion_cube>
I agree a function update_or : hashtbl -> key -> (key option -> value option) -> unit
<companion_cube>
would be nice
<companion_cube>
but it's more work
avsm has quit [Quit: Leaving.]
<ggole>
value option -> value?
<ggole>
Or does this leave open the possibility of removing the key?
<companion_cube>
could remove
<ggole>
Actually I like the function more than passing it as an argument
javamonn has quit [Ping timeout: 240 seconds]
<ggole>
Less annoying if computing the initial value is expensive
bobfang has quit []
<companion_cube>
well, the power of first-class functions :)
pyon has joined #ocaml
<ggole>
Or the weakness of strict evaluation, if you want to view it that way
<Algebr`>
When doing a match and seeing a #, I understand that that means for things that inherit from some object, etc, but does that also include subtyping for polymorphic variants?
<Drup>
yes
kushal has joined #ocaml
kushal has quit [Changing host]
kushal has joined #ocaml
avsm has joined #ocaml
larhat has quit [Quit: Leaving.]
wildsebastian has quit [Remote host closed the connection]
jeffmo has quit [Read error: Connection reset by peer]
jeffmo has joined #ocaml
<Algebr`>
I like short answers.
jeffmo has quit [Read error: Connection reset by peer]
rgrinberg has quit [Ping timeout: 264 seconds]
Snark has quit [Remote host closed the connection]
Snark has joined #ocaml
thomasga has quit [Quit: Leaving.]
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
ldopa has joined #ocaml
thomasga has joined #ocaml
ldopa has quit [Ping timeout: 244 seconds]
palomer has quit [Quit: palomer]
<Algebr`>
How do I say that a labeled argument should be a function, I tried ~f:(string -> string) but that doesn't work
<Algebr`>
in a .ml
<Drup>
in a type signature ?
<Drup>
remove the ~
jeffmo has joined #ocaml
<octachron>
~f:(f:(string->string))
<ggole>
Algebr`: you can answer this easily enough in the toplevel
<ggole>
eg, let f ~g = g 0
<ggole>
Or did you mean ascription for a function argument?
<reynir>
why is it not ~f:(string -> string) ?
<Drup>
because ~f:foo is for name alias
<Drup>
let f ~x:badabum = badabum
<ggole>
Named typed args are ~(name: type)
<ggole>
So let f ~(g:int -> int) = g 0
<reynir>
ah right
octachron has quit [Quit: Leaving]
* ggole
remembers struggling for a while with the argument syntax
<Algebr`>
its for a function, I want something like let foo arg1 ~f:(string -> string)
palomer has joined #ocaml
rgrinberg has joined #ocaml
<apache2>
when I have two union types with identical (is it called variant?) names, how do I specify which one I'm referring to?
<apache2>
type a = B of int | C ;; type x = B | Y of int ;;
<apache2>
getting errors that B takes an int argument as constructor, I'm trying to make a new x
<ggole>
You can ascribe types to select in a recent OCaml
<ggole>
Usually though, you avoid using the same names
<apache2>
ggole: do you remember the syntax?
<ggole>
(B 1 : a)
<ggole>
By the way they are called constructors, so "constructor names"
<apache2>
thanks
robink_ has quit [Ping timeout: 248 seconds]
<Algebr`>
oh derp, I just realized how silly my question was.
robink_ has joined #ocaml
ollehar has quit [Remote host closed the connection]
BitPuffin has quit [Ping timeout: 276 seconds]
shinnya has joined #ocaml
robink_ is now known as robink
palomer has quit [Quit: palomer]
avsm has quit [Quit: Leaving.]
GeorgeHahn has joined #ocaml
GeorgeHahn has quit [Client Quit]
GeorgeHahn has joined #ocaml
jwatzman|work has joined #ocaml
palomer has joined #ocaml
Submarine has quit [Quit: Leaving]
larhat has joined #ocaml
palomer has quit [Quit: palomer]
slash^ has joined #ocaml
palomer has joined #ocaml
palomer has quit [Client Quit]
martintrojer has quit [Ping timeout: 265 seconds]
psy_ has joined #ocaml
martintrojer has joined #ocaml
tane has joined #ocaml
bjorkintosh has quit [Quit: Leaving]
bjorkintosh has joined #ocaml
osa1 has quit [Ping timeout: 255 seconds]
s1n4 has joined #ocaml
Haudegen has quit [Ping timeout: 265 seconds]
nojb has joined #ocaml
javamonn_ has quit [Read error: Connection reset by peer]
Hannibal_Smith has joined #ocaml
javamonn has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
MrScout has joined #ocaml
Haudegen has joined #ocaml
javamonn has quit [Read error: Connection reset by peer]
javamonn has joined #ocaml
larhat has quit [Quit: Leaving.]
mal`` has quit [Ping timeout: 246 seconds]
mal`` has joined #ocaml
osa1 has joined #ocaml
nullcat has joined #ocaml
hugomg has joined #ocaml
<Algebr`>
Its kind of annoying that labeled arguments need to be given in parenthesis if they are expressions
shinnya has quit [Ping timeout: 264 seconds]
kushal has quit [Quit: Leaving]
mort___ has joined #ocaml
n3ss3s has joined #ocaml
mcclurmc has joined #ocaml
<ggole>
It's no different to ordinary arguments...
Haudegen has quit [Ping timeout: 245 seconds]
kakadu has joined #ocaml
<flux>
foo ~bar:42 + 5, how would that work?-)
<Algebr`>
I guess, but this is annoying foo ~bar:(`Thing some_value)
Anarchos has joined #ocaml
<flux>
if only ocaml understood that lack of whitespace binds tighter than operators and separators, then foo ~bar:`Thing(some_value) would work!
<flux>
but yeah, I guess it is a bit annoying, but it follows from the rest of the language while maintaining coherence
<flux>
personally I find there are more annoying things :). like: where to put that 'in' of 'let'
<reynir>
that would probably get cofnusing
<Algebr`>
flux: of course that in should be trailing
<Algebr`>
:)
<flux>
..
<Algebr`>
a
<Algebr`>
ha*
BitPuffin|osx has joined #ocaml
<flux>
so I put it to the end of the line, of course, for single-line let statements (the whole expression of course spans many lines)
<Anarchos>
flux put the in just after the name of the thing you want to define ?
<flux>
but then if I have a multi-line 'let in' it sometimes is a bit confusing where to put it
<flux>
on a line of its own or to the line where the last character of the previous expression is?
<Anarchos>
flux personnally, i always put the in just under the let, with same indentation, and nothing after the in.
ygrek has quit [Ping timeout: 255 seconds]
n3ss3s has quit [Ping timeout: 272 seconds]
javamonn has quit [Remote host closed the connection]
s1n4 has quit [Read error: Connection reset by peer]
mort___ has quit [Quit: Leaving.]
javamonn has joined #ocaml
swgillespie has joined #ocaml
Haudegen has joined #ocaml
javamonn_ has joined #ocaml
thomasga has quit [Ping timeout: 246 seconds]
yomimono has quit [Ping timeout: 245 seconds]
GeorgeHahn has quit [Ping timeout: 250 seconds]
osa1 has quit [Ping timeout: 264 seconds]
javamonn has quit [Ping timeout: 250 seconds]
s1n4 has joined #ocaml
s1n4 has quit [Client Quit]
osa1 has joined #ocaml
s1n4 has joined #ocaml
manizzle has quit [Ping timeout: 250 seconds]
thomasga has joined #ocaml
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
systmkor has quit [Quit: Leaving]
teiresias has joined #ocaml
swgillespie has joined #ocaml
nullcat has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
swgillespie has quit [Client Quit]
osa1 has quit [Ping timeout: 264 seconds]
psy_ has quit [Read error: Connection reset by peer]
psy_ has joined #ocaml
struk|work has joined #ocaml
axiles has joined #ocaml
<Algebr`>
There are six regex libraries. Which one is most feature rich?
<Algebr`>
and how can Re_perl and Re_pcre both exist..
<nojb>
are you referring to the libraries in ocaml-re ? Those are frontends for the different regexp syntaxes. My suggestion is to forgo them and just deal with the Re library (https://github.com/ocaml/ocaml-re/blob/master/lib/re.mli)
MrScout has quit [Ping timeout: 265 seconds]
<Algebr`>
ah, thank you. Is this some dated convention to have ocaml-foo, ocaml-bar..etc
<nojb>
it is common to call the library ocaml-X and the opam/findlib package X
pyon has quit [Read error: Connection reset by peer]
n3ss3s has joined #ocaml
manizzle has joined #ocaml
pyon has joined #ocaml
ncthom91 has joined #ocaml
<flux>
my first GADT use case!
<flux>
and it took only 40 minutes to make it compile!
<flux>
I haven't tried running it, but of course it works. yes.
<flux>
bonus: it isn't an interpreter..
<companion_cube>
what for? :)
<flux>
I have two kinds of requests I can make to a web service: GETs that get no arguments and POSTs that get objects in
<pippijn>
companion_cube: type-safe IPC
<pippijn>
ok, almost
<pippijn>
type-safe web service
<companion_cube>
sounds interesting
<flux>
the request function generated for GETs don't get an argument for data, but the POSTs do. the trickysome part was enforcing that the converter function types were correct.
<companion_cube>
pippijn: are you flux? :p
<flux>
pippijn, maybe we are!
<pippijn>
companion_cube: no, that was my last use-case for GADTs :)
<pippijn>
flux: maybe :o
<flux>
so now I define the external calls like: let range_request = request (endpoint_uri "epg/range") (PostRequest (API.range_request_to_yojson, API.range_response_of_yojson))
<flux>
of course the _yojson parts are elsewhere, but they are mostly generated as well
rgrinberg has quit [Ping timeout: 265 seconds]
<flux>
and the other case: let checkSession_request = request (endpoint_uri "user/checkSession") (GetRequest (API.checkSession_response_of_yojson))
<flux>
what's magical about them is that the second function has one argument less than the first one
<flux>
perhaps too magical :)
swgillespie has joined #ocaml
<flux>
yeah, it's a bit too magical, I'll make it use 'unit' :)
<companion_cube>
cool anyway! GADTs are nice
slash^ has quit [Read error: Connection reset by peer]
<flux>
what tricked me was that using the 'a Lwt.t type inside the GADT was poison
<flux>
I needed to wrap that to type 'a lwt_result = LWtResult of 'a Lwt.t and unwrap it later
<flux>
so that there's a concrete type for GADT to work on.. or something :-)
<companion_cube>
erf
<companion_cube>
some problem of injectivity I guess
javamonn_ has quit [Read error: Connection reset by peer]
javamonn has joined #ocaml
<flux>
let's see how far can I get till this system bites my ass :). I hope I have it pretty contained..
s1n4 has quit [Ping timeout: 272 seconds]
manizzle is now known as WeLoveCP
javamonn has quit [Read error: Connection reset by peer]
javamonn has quit [Read error: Connection reset by peer]
s1n4 has joined #ocaml
Submarine has joined #ocaml
Submarine has joined #ocaml
javamonn has joined #ocaml
<flux>
this function was useful, I wonder if it's already it batteries&co: val partition_map : ('a -> [< `Left of 'b | `Right of 'c ]) -> 'a list -> 'b list * 'c list
uris77` has joined #ocaml
uris77 has quit [Ping timeout: 240 seconds]
<companion_cube>
interesting
s1n4 has quit [Ping timeout: 252 seconds]
<companion_cube>
might be a good addition to CCList
<flux>
dmbaturin, hmm, you just made a two-argument function?-)
<flux>
ilia, often times you don't need them..
<flux>
ilia, in particular 'let a = b in c' has its scope go on after 'in' until it's closed by a surrounding scope
<dmbaturin>
flux: I'm a little braindead today. Seems I need some sleep before I eta-expand anything.
keen________ has quit [Ping timeout: 250 seconds]
yomimono has quit [Ping timeout: 276 seconds]
<Denommus>
flux: thanks
<flux>
I think I shall get some sleep as well
<ilia>
I read a file line by line in while true do ... done loop. I did let(id,p) = if.. thing and now I am getting an error at "done "string"
<flux>
fine evening of 2 hours coding and compiling, and never running!
<dmbaturin>
ilia: In the example above, I think you don't.
<flux>
ilia, the issue is that a while loop returns 'unit'
<flux>
maybe
_andre has quit [Quit: leaving]
<flux>
yet you probably want to get something outside that while loop
<dmbaturin>
* I mean, the begin/end.
<flux>
solution: don't use a while loop, use recursion
<ilia>
i do it like let () = let ic = open_in ...
<flux>
there is also the solution of using mutable references, but let's not go into that..
nullcat_ has joined #ocaml
<flux>
but I shall go into bed. perhaps someone else can point to nice resources on the subject :). happy hacking!
<ilia>
thanks flux
The_Mad_Pirate has quit [Excess Flood]
larhat has quit [Ping timeout: 240 seconds]
The_Mad_Pirate has joined #ocaml
seako has quit [Read error: Connection reset by peer]
steshaw has quit [Ping timeout: 256 seconds]
lopex has quit [Ping timeout: 256 seconds]
Sorella has quit [Read error: Connection reset by peer]
ousado has quit [Remote host closed the connection]
ousado has joined #ocaml
steshaw has joined #ocaml
lopex has joined #ocaml
Sorella has joined #ocaml
seako has joined #ocaml
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
thomasga has quit [Quit: Leaving.]
larhat has joined #ocaml
s1n4 has joined #ocaml
Haudegen has quit [Ping timeout: 272 seconds]
thomasga has joined #ocaml
nullcat_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<ollehar>
ilia: pastebin?
Submarine has quit [Remote host closed the connection]
n3ss3s has quit [Ping timeout: 240 seconds]
michael_lee has joined #ocaml
root_empire has joined #ocaml
77CAATDCI has joined #ocaml
<Drup>
flux: can you detail the issue with Lwt inside the gadt
<Drup>
it sounds odd
n3ss3s has joined #ocaml
s1n4 has quit [Ping timeout: 256 seconds]
Algebr` has quit [Ping timeout: 256 seconds]
Algebr` has joined #ocaml
ygrek has quit [Ping timeout: 264 seconds]
Haudegen has joined #ocaml
rgrinberg has joined #ocaml
jonludlam has quit [Ping timeout: 246 seconds]
mengu has quit []
s1n4 has joined #ocaml
rgrinberg has quit [Ping timeout: 256 seconds]
tane has quit [Quit: Verlassend]
michael_lee has quit [Quit: Ex-Chat]
root_empire has quit [Quit: Ex-Chat]
rgrinberg has joined #ocaml
s1n4 has quit [Ping timeout: 272 seconds]
mort___ has joined #ocaml
javamonn has quit [Remote host closed the connection]
javamonn has joined #ocaml
matason has quit []
mort___ has left #ocaml [#ocaml]
javamonn has quit [Ping timeout: 264 seconds]
matason has joined #ocaml
n3ss3s_ has joined #ocaml
badon has quit [Quit: Leaving]
n3ss3s has quit [Ping timeout: 264 seconds]
<apache2>
I'm having trouble with 'open Mutex'. strace -f says:
<apache2>
[pid 7168] stat("Mutex.cmi", 0x7fff07994340) = -1 ENOENT (No such file or directory)
<apache2>
[pid 7168] stat("/home/user/.opam/4.02.1/lib/bytes/mutex.cmi", 0x7fff07994340) = -1 ENOENT (No such file or directory)
<apache2>
[...] lots of places where mutex.cmi is not to be found
<apache2>
I have a /usr/lib/ocaml/mutex.mli
<Drup>
did you loaded the thread package ?
<apache2>
and /usr/lib/ocaml/vmthreads/mutex.cmi and /usr/lib/ocaml/threads/mutex.cmi
<apache2>
ah, no. thanks!
<apache2>
ocamlfind: Error from package `threads': Missing -thread or -vmthread switch
<apache2>
where should I pass that switch, Drup ?
<Drup>
to the compiler
agarwal1975 has quit [Quit: agarwal1975]
<apache2>
is -vmthread preferable over -thread or vice versa?
badkins has quit []
<Drup>
vmthread is only for ocamlc apparently, not ocamlopt, and I don't know the difference
<Drup>
never saw it used
n3ss3s_ has quit [Ping timeout: 240 seconds]
ilia has quit [Quit: Leaving]
ilia_ has quit [Remote host closed the connection]
thomasga has quit [Quit: Leaving.]
<apache2>
alright, I'll go with -thread. seems like it's automatically converted to -vmthread when applicable
swgillespie has joined #ocaml
hugomg has quit [Ping timeout: 250 seconds]
<ollehar>
uh, ctags in vim jumps strange...
<ollehar>
mark function but jumps to mod sig
badon has joined #ocaml
<osa1>
heh, found an interesting REPL auto-completion bug. but probably haskeline related.
<osa1>
if the identifier has ' in it, REPL doesn't auto-complete. for example let's say I have blah123'blah, and I type blah1<tab>, even though that's the only identifier with that prefix it's not completed. same thing works if the identifier doesn't contain '
<osa1>
ops, sorry, wring channel
<osa1>
wrong*
Tekilla has joined #ocaml
yomimono has joined #ocaml
uris77` has quit [Ping timeout: 272 seconds]
struktured has joined #ocaml
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
avsm has joined #ocaml
<Denommus>
osa1: I was wondering how you got autocompletion on the toplevel :-(
clog_ has joined #ocaml
larhat has quit [Quit: Leaving.]
Leonidas_ has joined #ocaml
dbrumley_ has joined #ocaml
smondet_ has joined #ocaml
<Drup>
there is autocompletion in utop
OnkV has joined #ocaml
mcclurmc_ has joined #ocaml
ontologiae has joined #ocaml
pii_4_ has joined #ocaml
lobo has quit [Quit: leaving]
mietek_ has joined #ocaml
jave_ has joined #ocaml
clog has quit [Ping timeout: 252 seconds]
smondet has quit [Ping timeout: 252 seconds]
Leonidas has quit [Ping timeout: 252 seconds]
dbrumley has quit [Ping timeout: 252 seconds]
Haudegen has quit [Ping timeout: 252 seconds]
pii4 has quit [Ping timeout: 252 seconds]
rbocquet has quit [Ping timeout: 252 seconds]
rbocquet1 has joined #ocaml
jave has quit [Ping timeout: 252 seconds]
mietek has quit [Excess Flood]
c74d has quit [Ping timeout: 252 seconds]
yac has quit [Ping timeout: 252 seconds]
pii_4_ is now known as pii4
yac has joined #ocaml
c74d3 has joined #ocaml
mcclurmc has quit [Ping timeout: 252 seconds]
<Denommus>
Drup: speaking of which, if I want to load my library in an interactive REPL, what should I call?
<Drup>
#require "my_library"
kakadu has quit [Remote host closed the connection]
rbocquet1 is now known as rbocquet
<Denommus>
Drup: what if I'm editing in Emacs and want to open the toplevel on Emacs?
<Drup>
the same
<Denommus>
Drup: must the library installed via opam for that to work?
ncthom91 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
hugomg has joined #ocaml
osa1 has quit [Ping timeout: 245 seconds]
<Drup>
only be in ocamlfind
jonludlam has joined #ocaml
<Denommus>
Drup: one more question, sorry if I'm being too disruptive
<Denommus>
Drup: make install is trying to install on /usr/local/share/doc. How to make it install in my opam path?
<rgrinberg>
persistent irc reinvented for github with a web ui
<rgrinberg>
you can still use irc to access it though
<rgrinberg>
the cohttp room is relatively active
<Drup>
I have trouble to see why you would use that over irc
<Denommus>
people are reinventing IRC quite frequently, uh
<companion_cube>
preferentially with closed source protocoles
<Drup>
yeah
jeffmo has quit [Quit: jeffmo]
<Denommus>
there's also slack. Though I do see the use for slack
<rgrinberg>
it saves the chat history by default, and you can access it with 1 click from the project page
<rgrinberg>
i'm preferring it over irc, but it did help me discover a few ocaml users out there who for some reason refuse to use irc
<rgrinberg>
s/preferring/not preferring/
<rgrinberg>
oops
shinnya has joined #ocaml
hsuh has quit [Ping timeout: 272 seconds]
<apache2>
jabber MUCs with persistent messaging sort of solves this problem already, doesn't it? it's a shame there aren't many clients who prioritize MUCs
<apache2>
it's always a bit clumsy
hsuh has joined #ocaml
<rgrinberg>
Anyway, i see it as supplementing IRC rather than replacing it as i know both camps have partisans. but something like https://github.com/finnp/gitter-irc-bot can satisfy both user types.
<apache2>
as long as there's a bridge, I guess
<Drup>
rgrinberg: this bot is weird
<Drup>
I mean, what is the point ?
<rgrinberg>
apache2: yeah jabber is nice from a technical perspective. but the goal of this exercise is to connect our small communities rather than choose the best technical solution
<Drup>
if you are replicating messages across services, just use the same service, period. They fill exactly the same use cases. gitter has the cute web UI and the cool github factor for it, and that's pretty much all
<avsm>
gitter is persistent. that's most useful.
<avsm>
also, it's per project, so less noise
<apache2>
and it has a web ui for people who don't have time for irc
<Drup>
I can see the point about persistent, since IRC is rather lacking from this point of view. Creating a room in irc is not an issue though, so per project is not that much of an argument
<pippijn>
I want to make a new protocole too
<Drup>
Despise the good points, I mostly see it as yet another way to device a community and lock part of it in a proprietary protocol, and meh.
<pippijn>
IRC4
<apache2>
pippijn: you mean jabber?
<Drup>
divide*
<apache2>
the gitter people could expose their thing as a jabber muc though, that would be nice
<pippijn>
I'm going to make a protocol buffers based IRC
<apache2>
pippijn: irc is horrible for many many reasons, I don't think plaintext opcodes is one of them
<pippijn>
and I'll use DNS as transport
<Drup>
anyway, closing the discussion, it's off topic and not something I really want to discuss :p
<pippijn>
apache2: protocol buffers can be plain text
mort___ has joined #ocaml
rwmjones has quit [Read error: Network is unreachable]
hugomg has quit [Quit: Leaving]
rwmjones has joined #ocaml
s1n4 has joined #ocaml
madroach has quit [Ping timeout: 264 seconds]
kdef has quit [Quit: Leaving]
madroach has joined #ocaml
77CAATDCI has quit [Quit: gone...]
rgrinberg has quit [Ping timeout: 244 seconds]
asQuirreL has joined #ocaml
ygrek has joined #ocaml
ncthom91 has joined #ocaml
jonludlam has quit [Quit: Leaving]
lordkryss has quit [Quit: Connection closed for inactivity]