paddymahoney has quit [Read error: Connection reset by peer]
Uvs has joined #ocaml
UncleVasya has joined #ocaml
Uvs has quit [Ping timeout: 258 seconds]
Snark has joined #ocaml
ggole has joined #ocaml
UncleVasya is now known as Uvs
mikurubeam has quit [Ping timeout: 240 seconds]
yacks has quit [Ping timeout: 260 seconds]
mikurubeam has joined #ocaml
Yoric has joined #ocaml
answer_42 has joined #ocaml
icarot has joined #ocaml
Yoric has quit [Ping timeout: 246 seconds]
eikke has joined #ocaml
answer_42 has quit [Remote host closed the connection]
answer_42 has joined #ocaml
sivoais has quit [Quit: leaving]
sivoais has joined #ocaml
djcoin has joined #ocaml
thomasga has joined #ocaml
thomasga has quit [Quit: Leaving.]
Kakadu has joined #ocaml
yacks has joined #ocaml
eikke has quit [Ping timeout: 240 seconds]
Yoric has joined #ocaml
rwmjones has quit [Ping timeout: 264 seconds]
cago has joined #ocaml
mika1 has joined #ocaml
ttamttam has joined #ocaml
thomasga has joined #ocaml
<djcoin>
Is there a mailing list dedicated to js_of_ocaml ?
<Kakadu>
djcoin: use the same as ocsigen
<djcoin>
ok, thanks Kakadu
rwmjones has joined #ocaml
ontologiae has joined #ocaml
frogfoodeater has joined #ocaml
icarot has quit [Quit: leeave()]
icarot has joined #ocaml
mikurubeam has quit [Ping timeout: 260 seconds]
Nahra has quit [Remote host closed the connection]
Nahra has joined #ocaml
ulfdoz has joined #ocaml
frogfoodeater has quit [Ping timeout: 264 seconds]
weie has quit [Quit: Leaving...]
Snark has quit [Ping timeout: 246 seconds]
weie has joined #ocaml
weie has quit [Client Quit]
Snark has joined #ocaml
leoncamel1 has joined #ocaml
Yoric has quit [Ping timeout: 246 seconds]
leoncamel has quit [Ping timeout: 245 seconds]
Yoric has joined #ocaml
thomasga1 has joined #ocaml
thomasga has quit [Ping timeout: 240 seconds]
weie has joined #ocaml
Uvs has quit [Ping timeout: 246 seconds]
Yoric has quit [Ping timeout: 264 seconds]
tane has joined #ocaml
Yoric has joined #ocaml
q66 has joined #ocaml
<hcarty>
thomasga1: opam won't let me uninstall core or anything that depends on it. I get a message saying "The package core.109.15.00 is in conflict with core.109.15.01."
<hcarty>
thomasga1: I had installed Jenga to see what it was and now I'm trying (without luck) to remove it.
<hcarty>
thomasga1: "opam remove core" gives that message, as does "opam remove all-of-the-other-janest-core-related-libs"
<companion_cube>
if I include a module in a module, can I access this module's private types?
<companion_cube>
(like, access Hashtbl's t internals)
<thelema>
Leonidas: the section prefix-symbol
<Leonidas>
ollehar: thanks
<thelema>
Leonidas: err, infix symbol
<thelema>
Leonidas: and (|) can't be done as | is a keyword
<thelema>
companion_cube: you're inside the module, the signature (which does all "private"-ing) doesn't apply
<Leonidas>
thelema: yeah, I can live with almost anything as long as it is infix
<companion_cube>
thelema: cool. Then I can implement my iterators for standard types...
<unstable>
Leonidas: yea, I found that. It doesn't seem up to date.
<thelema>
Leonidas: then you can use any sequence of operator characters that starts with =<>@^|&+-*/$%
<thelema>
companion_cube: probably not; how will you inject code into the stdlib Hashtbl?
<companion_cube>
by providing an extension of Hashtbl?
<thelema>
companion_cube: then that code will be defined outside Hashtbl, and will have no access to the internals
<Leonidas>
unstable: well, 4.00.0, without compiling it is about as current as you can get. But compiling is easy, works even on the raspberry pi in decent time.
<companion_cube>
(but yeah, I'd rather not have to provide my own modules :/)
<thelema>
companion_cube: batteries deals with this by cheating; copying the type definition and using %identity to break the abstraction
<Leonidas>
thelema: I am just kinda confused about defining operators in OCaml, that's all. I'll tinker a bit in the repl and come back to ask better questions. Thanks.
<thelema>
Leonidas: ollehar's example should be easy to follow.
<Leonidas>
but it only has one parameter?
<ollehar>
(btw, if the piped functions have more than one arg, you might want to use <| also)
<thelema>
Leonidas: the precedence and whether it's prefix or infix depends on the first character of the symbol
<ollehar>
let (<|) f x = f x
<companion_cube>
thelema: ah :/
<ollehar>
Foo |> Bar <| "arg2 to bar"
<companion_cube>
this lack of extensibility kind of sucks...
<thelema>
Leonidas: generally, infix has two parameters: `let (+) a b = a + b` and prefix has one: `let (~-) a = ~- a`
<thelema>
companion_cube: yup. It's kind of the point of abstract types; that you don't get access to the internals
<companion_cube>
yes, but well, the standard types are limited...
<Leonidas>
ah, alright, this works fine
<Leonidas>
# type mu = Foo | Bar;;
<Leonidas>
type mu = Foo | Bar
<Leonidas>
# let (|>) a b = b;;
<Leonidas>
val ( |> ) : 'a -> 'b -> 'b = <fun>
<Leonidas>
by the way, is there an ocaml bot in this channel?
* Leonidas
happy
<Leonidas>
well, that was considerably easier than I feared.
<thelema>
Leonidas: as long as you don't need a specific precedence or associativity, it's quite easy.
<Leonidas>
yeah, I read the post about @@ in batteries :)
<wmeyer`>
ollehar: FWTW: one is able to say: external (<|) : ('a -> 'b) -> 'a -> 'b = "%apply", and %revapply for (|>)
<wmeyer`>
this will make the operator compile to clambda builtins
<Leonidas>
what does %apply do?
<thelema>
Leonidas: apply a function to a value
<Leonidas>
isn't that what f x does anyway?
<wmeyer`>
yes it's the same
<wmeyer`>
however, the builtin will be recognised internally as function application
<Leonidas>
so why use external and %apply then? Just curious.
<wmeyer`>
performance
<Leonidas>
so it is kinda compile-time optimized?
<Leonidas>
I see.
<wmeyer`>
compiler knows about semantics of this
<wmeyer`>
Leonidas: yes
<thelema>
higher order functions can't be inlined at the moment, meaning if you were to use `let (|>) x f = f x`, then that function wouldn't be able to be optimized out
<ollehar>
didn't know that
<thelema>
"that function" = (|>)
<Leonidas>
is there an overview over the %foo functions? I know of %identity, %apply, %revapply…
<thelema>
Leonidas: I can't remember where, but someone started a list. the only official list is in th esource.
<Leonidas>
ok, not that important :>
milanst has joined #ocaml
<companion_cube>
too bad the compiler isn't able to notice that (|>) = %apply
<companion_cube>
%revapply, sorry
<adrien>
?
<adrien>
if it's declared as the corresponding external, there won't be any issue
<companion_cube>
I mean, from its definition
<thelema>
companion_cube: there's a place for those gazillion hacks, but for lack of benchmarks saying that this change is actually useful at speeding up real programs vs. only making the compiler more complex and harder to maintain, none of this is done.
<companion_cube>
I think that sometimes small hacks can have an important impact
<adrien>
companion_cube: really, why would it? sounds complicated for very little gain in very few cases while there a much easier things to do
<adrien>
agreed but I don't think this one would
<companion_cube>
well, it's just comparing ASTs, isn't it?
<adrien>
"just"
<wmeyer`>
companion_cube: right, this should be possible, but do we want make such corner use so complicated? It's defined just once
<companion_cube>
it's like peephole optimizations, lots of compilers do it
<companion_cube>
anyway, proper inlining should do the trick
<milanst>
I wouldn't say it is a corner case. it is used a lot at Jane Street
<wmeyer`>
I think inliner would help
<wmeyer`>
milanst: but you don't need to redefine it everywhere
<thelema>
companion_cube: true, but enough of them can make the compiler brittle and hard to maintain, not to mention making performance much more unpredictable.
<thelema>
proper inlining is important, but someone just needs to write it.
<thelema>
and apparently it's *hard* for higher order code
<companion_cube>
thelema: Pierre Chambart is working on inlining
<thelema>
companion_cube: great!
<wmeyer`>
I've heard it's not terribly hard
<companion_cube>
(at ocamlpro)
<wmeyer`>
the heuristics are hard
<thelema>
I recall hearing about them working on it, but haven't heard anything coming out of it.
<companion_cube>
it's not ready yet™
<thelema>
wmeyer`: heuristics of when to apply?
<wmeyer`>
Pierre told me sometime ago he started to work on it
<companion_cube>
also someone else at ocamlpro works on multiple runtimes \o/
<wmeyer`>
thelema: how much to inline, what to inline, and how
<wmeyer`>
there is a paper from SPJ about how they make it in GHC
<milanst>
I think programmers should be allowed to specify at least some of that, e.g. sometimes I want a function to be inlined always, I don't care how big it is
<wmeyer`>
you could do via. extension points
<companion_cube>
milanst: indeed
<thelema>
milanst: granted, but this requires adding either some sort of compiler pragmas or the evil of magic comments
<wmeyer`>
givie hints to the compilier
icarot has joined #ocaml
<companion_cube>
what is wrong with a few pragmas ?
<companion_cube>
#inline would not break any semantics
<wmeyer`>
thelema: new meta programming facilities enable that
<thelema>
companion_cube: no such thing exists in ocaml at the moment
<companion_cube>
btw, the most aweful thing for optimization that could be added to the native compiler right now is multistaged compilation :D
<companion_cube>
awesome*
<companion_cube>
-_-
<wmeyer`>
<silence>
milanst has left #ocaml []
icarot has quit [Ping timeout: 255 seconds]
milanst has joined #ocaml
milanst has quit [Client Quit]
milanst has joined #ocaml
milanst has left #ocaml []
<Leonidas>
ugh, why does ocamlc make things so difficult. I have https://gist.github.com/5272587 but how do I get ocamlc to compile this?
<Leonidas>
ocamlc -c Length.ml
<Leonidas>
ocamlc use.ml Length.cmo
<Leonidas>
File "use.ml", line 5, characters 11-17:
<Leonidas>
Error: Unbound value meters
<wmeyer`>
ld has inverted order of compilation units vs ocaml
<wmeyer`>
so you should put Length.cmo before use.ml
<wmeyer`>
and btw, why not to use ocamlbuild: ocamlbuild use.byte
<Leonidas>
ocamlc Length.cmo use.ml
<Leonidas>
doesn't change the outcome
<wmeyer`>
do you have cmi?
<wmeyer`>
file dangling?
<Leonidas>
well, I wanted to try it without a build system. Usually I use oasis, so I'm just happy to let it generate stuff and build on its own :)
<thelema>
problem is that length.ml has a Length sumbodule
<thelema>
Leonidas: you should split your Length.ml file into two files
<thelema>
or access it as Length.Length
<Leonidas>
ah, right
<Leonidas>
This is actually just a test for a larger module that I plan to split into ml and mli
<Leonidas>
when I open Length.Length and use Kakadu's call, it works.
<thelema>
Leonidas: you should try ocamlbuild; ocamlbuild use.native
<thelema>
instead of writing your own build commands
<Leonidas>
but I am trying to learn how it works under the surface
<Leonidas>
I'm not making my own build commands, there is no point to it, of course.
<thelema>
by build commands, I just meant constructing your own ocaml commands
djcoin has quit [Quit: WeeChat 0.3.9.2]
<Leonidas>
ah, damn it, now I can't get it to compile with an mli file. I'll just use ocamlbuild
<thelema>
when using ocamlbuild, you can get a log of the commands it uses by reading _build/_log
<Leonidas>
okay, so after splitting it up into ml and mli, it looks like the phantom type got preserved. good. now I can split my actual code :)
icarot has joined #ocaml
ggole has quit []
<Kakadu>
Is it possible to explain GC that *this* concrete value should not be moved or sweeped? I know about caml_register_global_root, but it seems that it is not exactly what I want. The sentence in the manual which I'm confused by is `You must not call any of the OCaml runtime functions or macros between registering and storing the value.`
icarot has quit [Ping timeout: 256 seconds]
<mfp>
Kakadu: it seems to me this means you have to do *myref = ...; or such right after you registered myref as a global root; if you use any function from the OCaml runtime, a GC run could be triggered and the GC could try to follow the uninitialized pointer, leading to problems if it happens to point to the OCaml heap
<mfp>
AFAIK it is not possible to prevent a single value in the heap from being relocated, but you can disable compaction globally
<Kakadu>
Disabling compaction is a .... *very strong* action ;)
ttamttam has left #ocaml []
<adrien>
or automatic compaction
<adrien>
have a look at lablgtk's READE
<adrien>
README*
<Kakadu>
adrien: found
rwmjones has quit [Read error: Operation timed out]
hcarty has quit [Read error: Operation timed out]
hcarty has joined #ocaml
icarot has joined #ocaml
Neros has joined #ocaml
rwmjones has joined #ocaml
unstable has left #ocaml []
hcarty has quit [Ping timeout: 256 seconds]
hcarty has joined #ocaml
thomasga has quit [Quit: Leaving.]
<ollehar>
another haskell_to_ocaml problem ;)
<ollehar>
# let rec plus m n = match n with Zero -> m | Succ n -> Succ (plus m n);;
<ollehar>
Error: This pattern matches values of type 'a succ
<ollehar>
but a pattern was expected which matches values of type zero
<ollehar>
but Zero and Succ can't be the same type, because then GADT won't work
<thelema>
ollehar: probably need a type annotation on plus
yacks has quit [Quit: Leaving]
<ollehar>
no, the thing is I have
<ollehar>
type zero = Zero
<ollehar>
type 'a succ = Succ of 'a
<ollehar>
instead of
<ollehar>
type nat = Zero | Succ of nat;;
<thelema>
ollehar: then how do you expect the union of these types to be passed in?
<ollehar>
I need this:
<ollehar>
# type ('a, 'l) seq = Nil : (int, zero) seq | Cons : int * (int, 'l) seq -> (int, 'l succ) seq;;
<thelema>
you're trying to write a function that works on types, yes?
<ollehar>
I want a list which type also has the length of the list, peano numbers wise
<ollehar>
this wont work:
<ollehar>
type ('a, 'l) seq = Nil : (int, Zero <-- Not allowed
<thelema>
you can't integrate your 'plus' function to solve this problem, as it's a function on values. you need to manipulate the types, and this is only possible in simple cases
<ollehar>
ah
<ollehar>
so I need to modify plus to operate on types
<thelema>
you need to write a 'plus' that's already in terms of types into the type declaration of your 'concat' function
q66 has quit [Remote host closed the connection]
<ollehar>
Yes, that's done: (int, 'l) seq -> (int, 'l succ) <-- succ to l
<thelema>
ollehar: that works for cons, it sounds like you're trying to implement concat
<thelema>
to join two lists
<ollehar>
ah, right
q66 has joined #ocaml
derek_c has joined #ocaml
q66 has quit [Remote host closed the connection]
q66 has joined #ocaml
derek_c has quit [Client Quit]
derek_c has joined #ocaml
Snark has quit [Quit: Quitte]
gnuvince has quit [Ping timeout: 248 seconds]
BiDOrD has joined #ocaml
BiDOrD_ has quit [Ping timeout: 248 seconds]
Kakadu has quit []
ontologiae has joined #ocaml
pkrnj has joined #ocaml
frogfoodeater has joined #ocaml
derek_c has quit [Ping timeout: 260 seconds]
icarot has quit [Ping timeout: 264 seconds]
Nahra has quit [Ping timeout: 246 seconds]
derek_c has joined #ocaml
gnuvince has joined #ocaml
frogfoodeater has quit [Ping timeout: 246 seconds]
mattrepl has joined #ocaml
mikurubeam has quit [Quit: +1 (Yes). -1 (No). i (What I have been trying to tell you all along).]
mikurubeam has joined #ocaml
Pantoufle has quit [Ping timeout: 240 seconds]
Uvs has quit [Read error: Connection reset by peer]
ollehar has quit [Ping timeout: 256 seconds]
ollehar has joined #ocaml
smondet has quit [Ping timeout: 255 seconds]
frogfoodeater has joined #ocaml
Yoric has quit [Ping timeout: 246 seconds]
darkf has joined #ocaml
emmanuelux has quit [Ping timeout: 258 seconds]
frogfoodeater has quit [Ping timeout: 252 seconds]
derek_c has quit [Read error: Operation timed out]
pkrnj has quit [Quit: Computer has gone to sleep.]
ski has quit [Ping timeout: 264 seconds]
eikke has quit [Ping timeout: 260 seconds]
<ollehar>
need more help with type level plus, if anyone has time :P