<nicoo>
zozozo: xavierbot used to do that (prevent access to Sys, Unix and so on), but it is a very ugly piece of code.
<zozozo>
how surprising, ^^
manizzle has joined #ocaml
lopex has quit [Quit: Connection closed for inactivity]
HrafnA has quit [Read error: Connection reset by peer]
javamonn has quit [Remote host closed the connection]
mort___ has joined #ocaml
The_Mad_Pirate has quit [Ping timeout: 256 seconds]
swgillespie has joined #ocaml
ontologiae has joined #ocaml
ohama has quit [Ping timeout: 244 seconds]
ohama has joined #ocaml
ontologiae has quit [Ping timeout: 244 seconds]
thomasga has quit [Quit: Leaving.]
monoprotic is now known as monoprotic[ded]
palomer has joined #ocaml
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
monoprotic[ded] is now known as monoprotic
seangrove has joined #ocaml
chris2 has quit [Ping timeout: 272 seconds]
chris2 has joined #ocaml
asQuirreL has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<rgrinberg>
is ocp-indent 1.5 acting up for anyone else? I'm using vim btw
<nicoo>
zozozo: Mismash of Perl and OCaml REPL
Denommus has joined #ocaml
mort___ has quit [Quit: Leaving.]
yaewa has joined #ocaml
javamonn has joined #ocaml
moei has quit [Ping timeout: 244 seconds]
darkf has joined #ocaml
keen_____ has joined #ocaml
keen____ has quit [Ping timeout: 265 seconds]
palomer has quit [Quit: palomer]
badkins has quit []
yomimono has quit [Ping timeout: 256 seconds]
BitPuffin|osx has quit [Ping timeout: 272 seconds]
keen______ has joined #ocaml
keen_____ has quit [Ping timeout: 246 seconds]
ontologiae has joined #ocaml
bjorkintosh has joined #ocaml
swgillespie has joined #ocaml
ontologiae has quit [Ping timeout: 256 seconds]
rgrinberg has quit [Ping timeout: 272 seconds]
javamonn has quit [Remote host closed the connection]
javamonn has joined #ocaml
rgrinberg has joined #ocaml
palomer has joined #ocaml
jeffmo has joined #ocaml
palomer has quit [Quit: palomer]
palomer has joined #ocaml
javamonn has quit [Remote host closed the connection]
AlexRussia has joined #ocaml
idegen has quit [Quit: Leaving.]
palomer has quit [Quit: palomer]
Tekilla has quit [Quit: Quitte]
jeffmo has quit [Ping timeout: 264 seconds]
c74d has quit [Remote host closed the connection]
c74d has joined #ocaml
Tekilla has joined #ocaml
Tekilla_ has joined #ocaml
Tekilla_ has quit [Client Quit]
Tekilla has quit [Client Quit]
Tekilla has joined #ocaml
rgrinberg has quit [Ping timeout: 250 seconds]
GeorgeHahn has joined #ocaml
dubosec has quit [Ping timeout: 240 seconds]
rgrinberg has joined #ocaml
osa1 has quit [Ping timeout: 265 seconds]
palomer has joined #ocaml
dubosec has joined #ocaml
bjorkintosh has quit [Ping timeout: 265 seconds]
palomer has quit [Client Quit]
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
palomer has joined #ocaml
gbluma has left #ocaml [#ocaml]
nullcat_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
palomer has quit [Quit: palomer]
rgrinberg has quit [Ping timeout: 256 seconds]
swgillespie has quit [Max SendQ exceeded]
swgillespie has joined #ocaml
Tekilla has quit [Quit: Quitte]
swgillespie has quit [Max SendQ exceeded]
swgillespie has joined #ocaml
nullcat_ has joined #ocaml
Tekilla has joined #ocaml
Tekilla has quit [Quit: Quitte]
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
palomer has joined #ocaml
rgrinberg has joined #ocaml
pobivan has joined #ocaml
MercurialAlchemi has joined #ocaml
avsm has joined #ocaml
rgrinberg has quit [Ping timeout: 265 seconds]
MercurialAlchemi has quit [Remote host closed the connection]
MercurialAlchemi has joined #ocaml
rgrinberg has joined #ocaml
dubosec has quit [Ping timeout: 245 seconds]
nullcat_ has quit [Ping timeout: 246 seconds]
nullcat has joined #ocaml
dubosec has joined #ocaml
lewis1711 has quit [Ping timeout: 256 seconds]
avsm has quit [Quit: Leaving.]
javamonn has joined #ocaml
ggole has joined #ocaml
javamonn has quit [Ping timeout: 272 seconds]
nullcat has quit [Ping timeout: 264 seconds]
s1n4 has joined #ocaml
nullcat has joined #ocaml
palomer has quit [Quit: palomer]
psy has quit [Quit: Leaving]
psy has joined #ocaml
palomer has joined #ocaml
Kakadu has joined #ocaml
mengu has joined #ocaml
pobivan_ has joined #ocaml
pobivan has quit [Read error: Connection reset by peer]
pobivan_ is now known as pobivan
octachron has joined #ocaml
GeorgeHahn has quit [Read error: Connection reset by peer]
echo-area has joined #ocaml
wildsebastian has joined #ocaml
Haudegen has quit [Ping timeout: 245 seconds]
nullcat has quit [Ping timeout: 264 seconds]
nullcat has joined #ocaml
wildsebastian has quit [Quit: Konversation terminated!]
Haudegen has joined #ocaml
palomer has quit [Quit: palomer]
wildsebastian has joined #ocaml
palomer has joined #ocaml
nullcat has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
troydm has quit [Ping timeout: 264 seconds]
Denommus has quit [Ping timeout: 240 seconds]
bjorkintosh has joined #ocaml
axiles has quit [Ping timeout: 255 seconds]
larhat has joined #ocaml
Simn has joined #ocaml
<companion_cube>
o/
siddharthv_away is now known as siddharthv
siddharthv is now known as siddharthv_away
rgrinberg has quit [Ping timeout: 265 seconds]
<flux>
hmm.. I might have a use case for metaocaml.. having a chain of bitmap image manipulation primitives (ie. abs(image1 - image2) / area(image1)) and then producing an optimal inner loop for producing the value
NoNNaN has joined #ocaml
<flux>
but I wonder if there's a way to go from that representation to generating OpenCL code and executing it with SPOC
thomasga has joined #ocaml
michatotol has quit [Remote host closed the connection]
michatotol_ has joined #ocaml
teiresias has quit [Remote host closed the connection]
larhat has quit [Read error: Connection reset by peer]
larhat has joined #ocaml
ollehar has joined #ocaml
<flux>
..actually it should be quite straight-forward, given I create my own expression trees and then just have custom MetaOCaml code for running it as OCaml and then completely non-MOC-code that generates the OpenCL..
larhat has quit [Client Quit]
larhat has joined #ocaml
larhat has quit [Quit: Leaving.]
axiles has joined #ocaml
Denommus has joined #ocaml
larhat has joined #ocaml
voglerr1 has quit [Quit: WeeChat 0.4.2]
palomer has quit [Quit: palomer]
milosn has quit [Quit: leaving]
Submarine has joined #ocaml
mengu has quit [Remote host closed the connection]
asQuirreL has joined #ocaml
Haudegen has quit [Ping timeout: 276 seconds]
Night_Elf has quit [Quit: quitting]
Haudegen has joined #ocaml
larhat has quit [Quit: Leaving.]
larhat has joined #ocaml
larhat has quit [Quit: Leaving.]
avsm has joined #ocaml
larhat has joined #ocaml
yomimono has joined #ocaml
mengu has joined #ocaml
Tekilla has joined #ocaml
<apache2_>
what's everyone's favorite standard library collection? Core? Batteries? Are there more?
<flux>
I use Batteries
<flux>
though Core intrigues a bit as it has wider set of various stuff
<reynir>
there's also extlib
<flux>
containers also has some nice stuff if Batteries isn't enough
<flux>
well, batteries is a super set of extlib, I don't see much reason to use it unless you for some reason need even leaner and meaner standard library replacement
<flux>
(not strictly true of course anymore, but that's where it comes from)
<reynir>
(oh, I didn't know)
<apache2_>
I didn't know about Containers, I'll check that out. Core takes too much memory to compile, ocamlopt crashes. Batteries looks a little tiny bit too simple still for my taste
so is now known as shawn
shawn is now known as Guest79903
Guest79903 is now known as so
Gama11 has joined #ocaml
lopex has joined #ocaml
rgrinberg has joined #ocaml
rgrinberg has quit [Ping timeout: 256 seconds]
<Drup>
apache2_: batteries is "too simple" ?
<apache2_>
Drup: I only had a very brief look, don't mean to step on anyone's toes
<companion_cube>
are there things you expected to be in batteries and that weren't?
Gama11 has quit [Read error: Connection reset by peer]
<apache2_>
I was hoping I could find something that did number packing into uint8_t, uint16_t, uint32_t, uint64_t etc
<companion_cube>
a bitfield, you mean?
<apache2_>
sort of like perl's pack/unpack functions
<reynir>
ah
<reynir>
there's bitstring IIRC
<apache2_>
ah no, just storing big-endian or small endian numbers, like you'd want when implementing network protocols
Gama11 has joined #ocaml
<apache2_>
reynir: that looks /perfect/! thank you!
larhat1 has joined #ocaml
larhat1 has quit [Client Quit]
<haesbaert>
apache2_: you can use cstruct too
Gama11_ has joined #ocaml
Gama11 has quit [Ping timeout: 252 seconds]
dav has quit [Ping timeout: 240 seconds]
oscar_to1o has quit [Quit: Lost terminal]
dav has joined #ocaml
<Leonidas>
apache2_: well, batteries can't possibly contain all things that might or might not be needed, otherwise it would be called Core ;-)
<apache2_>
Leonidas: That's completely understandable, I'm not criticizing anything here :)
<companion_cube>
every problem can be solved by adding a stdlib feature, except for the feature of the stdlib not being too big
<companion_cube>
:p
echo-area has quit [Ping timeout: 255 seconds]
<apache2_>
well, fixing int_of_float to not return 0 on large numbers wouldn't add to the size, would it?
<ollehar>
speaking of which, was there ever a tutorial on how to strip exec?
<companion_cube>
unless you switch from "using the builtin int_of_float" to "reimplement int_of_float"
<Leonidas>
it might. think of all the BYTES in the binaries!
<companion_cube>
good question, I just use "strip foo" on occasion, but it doesn't do much
<ollehar>
strip, eh.
<ollehar>
hm
<ollehar>
maybe worth a stackoverflow question...
TheLemonMan has joined #ocaml
<apache2_>
how about compiling native bins / libs with "hardening" ? for use when binding from a (potentially vulnerable) c application?
<apache2_>
(slightly related, I guess)
bjorkintosh has quit [Ping timeout: 256 seconds]
mengu has quit [Remote host closed the connection]
ggole_ has joined #ocaml
ggole has quit [Ping timeout: 252 seconds]
sdothum has joined #ocaml
_andre has joined #ocaml
larhat has quit [Quit: Leaving.]
larhat has joined #ocaml
nojb has joined #ocaml
fedjo has quit [Read error: Connection reset by peer]
fedjo1 has joined #ocaml
mengu has joined #ocaml
mengu has joined #ocaml
thomasga has quit [Quit: Leaving.]
Submarine_ has joined #ocaml
Submarine_ has quit [Changing host]
Submarine_ has joined #ocaml
Submarine has quit [Ping timeout: 240 seconds]
Tekilla has quit [Quit: Quitte]
nojb has quit [Quit: nojb]
thomasga has joined #ocaml
osa1 has joined #ocaml
mengu has quit [Remote host closed the connection]
badkins has joined #ocaml
dav- has joined #ocaml
mengu has joined #ocaml
mengu has joined #ocaml
mengu has quit [Changing host]
nojb has joined #ocaml
dav has quit [Ping timeout: 264 seconds]
Tekilla has joined #ocaml
larhat has quit [Quit: Leaving.]
javamonn has joined #ocaml
nojb has quit [Quit: nojb]
nojb has joined #ocaml
<apache2_>
I'm getting this error from `opam`: "# checking for time... no
<gal_bolle>
Drup: this might be worth mentionning on its website
idegen has joined #ocaml
<gal_bolle>
so, is ocp-build alive?
javamonn has quit [Remote host closed the connection]
javamonn has joined #ocaml
<Drup>
alive might be a bit strong
<Drup>
it compiles
larhat has joined #ocaml
javamonn has quit [Remote host closed the connection]
javamonn has joined #ocaml
Tekilla has quit [Quit: Quitte]
helix__ has joined #ocaml
osa1 has joined #ocaml
javamonn has quit [Remote host closed the connection]
javamonn has joined #ocaml
Submarine_ has quit [Ping timeout: 264 seconds]
oscar_toro has joined #ocaml
govg has joined #ocaml
<helix__>
I recently updated and upgraded with opam for first time in a few months and now I cannot compile a module utilizing ctypes. Specifically ocamlc complains about an unbound module "Dl" which has always been present in the code and always compiled before. I can only find mention of dlopen within ctypes mli files. Adding dynlink to the list of packages required doesn't help. Where did the Dl namespace go?
avsm has quit [Quit: Leaving.]
<nojb>
which version of ctypes are you using ?
mengu has quit [Remote host closed the connection]
<nojb>
you might need to install ctypes-foreign and link with the ocamlfind package ctypes.foreign
darkf has quit [Quit: Leaving]
Hannibal_Smith has quit [Quit: Leaving]
<helix__>
I'm using ctypes 0.4.1
<nojb>
try `opam install ctypes-foreign` and use the package `ctypes.foreign`
<helix__>
I just did a search and see that I'm missing that package. Most likely that is the case. Very frustrating problem. I gave up and came here. Grep'ing all the source just didn't help. Is this doc'd anywhere?
avsm has joined #ocaml
Hannibal_Smith has joined #ocaml
<tokenrove>
this just changed very recently. i would imagine it's documented in the ctypes changelog; i think it was mentioned on one of the mailing lists when it happened, too.
<tokenrove>
hmm, i see it's mentioned in the mailing list announcement (for 0.4.0) but not clearly in the CHANGES.md or anywhere else really obvious
<helix__>
I had no internet access at the time this hit me so I was sol and I did read the CHANGES.md but I didnt see anything about this. Oh well. Many thanks.
badkins has quit [Ping timeout: 256 seconds]
tsumetai has quit [Read error: Connection reset by peer]
badkins has joined #ocaml
<tokenrove>
maybe you could add it to the FAQ as i expect you won't be the only one bitten by it
badkins has quit [Client Quit]
idegen has quit [Quit: Leaving.]
<orbitz>
Is there a fix for things that depends on camlp4 failing on ocaml 4.02.1? things like findlibe cannot find camlp4.extends
idegen has joined #ocaml
<avsm>
orbitz: install camlp4-extra i believe
<avsm>
for some reason, there are two camlp4 packages in many distributions
rgrinberg has joined #ocaml
nojb has quit [Ping timeout: 240 seconds]
badkins has joined #ocaml
tsumetai has joined #ocaml
<helix__>
I suppose I could add it to the ctypes FAQ. I'll try later today. Too bad it's not a dependency. Opam upgrade really shouldn't leave you hanging like that IMHO.
<orbitz>
avsm: hrmm, I don't see it in FreeBSD
avsm has quit [Quit: Leaving.]
bjorkintosh has joined #ocaml
psy has quit [Ping timeout: 240 seconds]
nojb has joined #ocaml
dav has quit [Remote host closed the connection]
dav has joined #ocaml
keen_______ has joined #ocaml
agarwal1975 has joined #ocaml
keen______ has quit [Ping timeout: 240 seconds]
Hannibal_Smith has quit [Read error: Connection reset by peer]
Submarine has joined #ocaml
Submarine has joined #ocaml
milosn has joined #ocaml
osa1_ has joined #ocaml
osa1 has quit [Ping timeout: 265 seconds]
BitPuffin|osx has joined #ocaml
gal_bolle has quit [Remote host closed the connection]
freling has joined #ocaml
wildsebastian has quit [Ping timeout: 244 seconds]
freling has quit [Quit: Leaving.]
agarie has joined #ocaml
rgrinberg has quit [Ping timeout: 240 seconds]
wildsebastian has joined #ocaml
wildsebastian has quit [Read error: Connection reset by peer]
axiles has quit [Ping timeout: 256 seconds]
matason has joined #ocaml
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
Algebr` has joined #ocaml
pobivan has joined #ocaml
larhat has quit [Quit: Leaving.]
rgrinberg has joined #ocaml
antegallya has joined #ocaml
kdef has joined #ocaml
matason has quit []
ggole_ is now known as ggole
larhat has joined #ocaml
Denommus has quit [Ping timeout: 246 seconds]
<Algebr`>
What would be the smart thing to do when say getting an env fails? I'm using core so Result.t is on the table, but frankly it seems that I should just throw an exception
slash^ has joined #ocaml
bjorkintosh has quit [Ping timeout: 240 seconds]
matason has joined #ocaml
octachron has quit [Quit: Leaving]
Submarine has quit [Quit: Leaving]
<ggole>
What does "getting an env" mean?
palomer has joined #ocaml
larhat has quit [Quit: Leaving.]
matason has quit []
axiles has joined #ocaml
<Algebr`>
oh sorry, env variable
avsm has joined #ocaml
<ggole>
Depends on the variable, really
<ggole>
If it contains information you strictly require, and it isn't there, then an exception is reasonable
<Algebr`>
Yea, I need the info and can't proceed without it.
larhat has joined #ocaml
<agarwal1975>
When writing a library, it is unclear what “strictly require” means as that is dictated by the user of your library, not you.
hugomg has joined #ocaml
<zozozo>
well, the interesting question to ask is : is there a reasonable default value for it ?
troydm has joined #ocaml
kdef has quit [Quit: Leaving]
fraggle-boate__ has joined #ocaml
fraggle-boate_ has quit [Ping timeout: 255 seconds]
axiles has quit [Read error: No route to host]
<Algebr`>
no
hugomg has quit [Ping timeout: 240 seconds]
ilia_ has joined #ocaml
<flux>
dora-molly, here's the output of the basic avg(abs(frame1 - frame2))-algorithm from one of my outdoor cameras: https://modeemi.fi/~flux/motion.png
struk|work has joined #ocaml
<pippijn>
what's the best way to pass --table to menhir in ocamlbuild?
MrScout has joined #ocaml
<nojb>
ocamlbiuld -yaccflag --table
<pippijn>
ok, that's good, thanks
Sizur has left #ocaml [#ocaml]
jwatzman|work has joined #ocaml
<flux>
BatEnum has iter2, fold2 but no map2?-(
<flux>
hmm, I'm sure I'll bite myself to but with these destructive sequences, time to look at LazyList :). or maybe containers..
<dmbaturin>
flux: Maybe send them a patch too? :)
srax has quit [Remote host closed the connection]
srax has joined #ocaml
palomer has quit [Quit: palomer]
<flux>
I think I'll just use the Sequence module :)
Haudegen has quit [Ping timeout: 246 seconds]
kdef has joined #ocaml
larhat has quit [Quit: Leaving.]
<flux>
ok, is it just me or is it very difficult to have two Sequence.t's and produce one Sequence.t that has pairs from the both sequences?-)
<osa1_>
I want to initialize a module-level state and get an instantiated module, I guess I need to use functors but do I need to create a new module just for one parameter passing to my module?
<Drup>
I know about the incremental parser, but I'm pretty sure I never mentionned error handling myself.
<pippijn>
how do you know what state you're in? how do you know what it expects?
<Drup>
pippijn: I think dora-molly has another patch for that
<Denommus>
nojb: I'm using pure None, not ref None
<pippijn>
how can you ever handle errors other than by eating tokens until it accepts?
Haudegen has joined #ocaml
BitPuffin|osx has quit [Ping timeout: 252 seconds]
<apache2_>
but mychar is an int in this case. it can be solved with check (char_of_int mychar |> is_valid_char), but I was wondering if there's a prettier way to do it
<Drup>
I don't know, as I said :)
<Denommus>
...
<Denommus>
WConst None worked
<Denommus>
wat
<nojb>
Denommus: when you apply pure to an argument you force the argument to have a monomorphic type
<flux>
drup, ah, yes. I wonder why it's not combine as in the list module..
<Denommus>
nojb: so I must change the type signature for pure?
<nojb>
Denommus: no, I'm afraid it is not possible to do what you want ...
<nojb>
you can just do let empty = WConst None
hugomg has quit [Quit: Leaving]
<Denommus>
nojb: won't this get on the way of the user of the library? I mean, if he tries to use pure?
<apache2_>
AND yet another question regarding bitstring: ocamlmklib doesn't seem to accept the -syntax switch, is there another option to use or is ocamlmklib a legacy thing I should stay clear of? (sorry about all the questions)
<nojb>
not really, pure is still polymorphic, but (like all ocaml functions) its arguments must be monomorphic ... not normally a problem
jabesed has joined #ocaml
octachron has joined #ocaml
nojb has quit [Quit: nojb]
ollehar has quit [Remote host closed the connection]
ollehar has joined #ocaml
thomasga has joined #ocaml
tane has joined #ocaml
mort___ has joined #ocaml
mort___ has left #ocaml [#ocaml]
ollehar has quit [Remote host closed the connection]
Haudegen has quit [Ping timeout: 240 seconds]
ollehar has joined #ocaml
ollehar has quit [Ping timeout: 240 seconds]
luzie has quit [Remote host closed the connection]
ollehar has joined #ocaml
luzie has joined #ocaml
osa1_ is now known as osa1
avsm has joined #ocaml
helix__ has quit []
MrScout has quit [Ping timeout: 256 seconds]
MrScout has joined #ocaml
Haudegen has joined #ocaml
robink has quit [Ping timeout: 244 seconds]
manizzle has quit [Ping timeout: 272 seconds]
Hannibal_Smith has joined #ocaml
avsm has quit [Quit: Leaving.]
robink_ has joined #ocaml
avsm has joined #ocaml
robink_ is now known as robink
yomimono has joined #ocaml
kdef has quit [Ping timeout: 250 seconds]
brendan has quit [Excess Flood]
brendan has joined #ocaml
kdef has joined #ocaml
jeffmo has joined #ocaml
bjorkintosh has joined #ocaml
matason has joined #ocaml
ncthom91 has joined #ocaml
avsm has quit [Quit: Leaving.]
<apache2_>
I found the solutions to both of my problems: first was the -package order being wrong in ocamlfind. d'oh.
<apache2_>
the second can be done with bitmatch data with { mychar : 8 : char, check (is_valid_char mychar) } -> 1 | { _ } -> 0
zaquest has quit [Read error: Connection reset by peer]
asQuirreL has quit [Ping timeout: 272 seconds]
manizzle has joined #ocaml
asQuirreL has joined #ocaml
Algebr` has quit [Ping timeout: 246 seconds]
ollehar has quit [Remote host closed the connection]
bjorkintosh has quit [Read error: Connection reset by peer]
<xificurC>
can't I use some math in match? let rank = 10 in match something with | rank -> do_stuf | rank+1 -> do_else | _ -> do_more <--- errors on rank+1
slash^ has left #ocaml [#ocaml]
<ggole>
No.
<xificurC>
:(
<xificurC>
will be an if then
<dmbaturin>
xificurC: You can do it if you use Peano arithmetics. ;)
<xificurC>
dmbaturin: sounds more complex than falling back on an if :)
<dmbaturin>
A more practical approach is to use guarded patterns.
<ggole>
Named constants and constant expressions are poorly supported in patterns.
<ggole>
But... yeah
<ggole>
match something with x when x = expr -> ...
cdidd has quit [Remote host closed the connection]
MrScout has quit [Remote host closed the connection]
<xificurC>
won't an if be simpler
<xificurC>
or is there a performance difference? I might need that later
<dmbaturin>
Depends, even with 2-3 branches guarded patterns are easier IMHO.
MrScout has joined #ocaml
matason has quit []
<xificurC>
so I can write | x when x = rank+1
<dmbaturin>
Yep.
<xificurC>
oh, what I wrote actually shadows the rank var? Makes sense now
<xificurC>
that was stupid of me :D
<dmbaturin>
Just make sure to add a non-guarded case to avoid Match_failure's.
cdidd has joined #ocaml
<xificurC>
yeah I got warnings on
<xificurC>
emacs flycheck ftw
<xificurC>
ocaml is quite pleasant to write :)
<xificurC>
oh I have 1 more question! This _modular implicits_ that is planned (btw when is it planned?), will it result in the ability to kind of overload a definition?
<xificurC>
like Haskell's bind (>>=) works on any monad so you could say it's definition is overloaded (maybe?)
bjorkintosh has joined #ocaml
larhat has joined #ocaml
BitPuffin|osx has joined #ocaml
<dmbaturin>
xificurC: Not sure when it's planned, but it kind of will. Also, for the do notation there's a syntax extension somewhere ("with Mymodule.bind do ..." or something in this fashion).
<dmbaturin>
There's a syntax extension for MLton-like overloading too, not sure if anyone should ever use it or not, MLton included. :)
zaquest has joined #ocaml
<reynir>
I'm thinking of introducing my brother to programming (maybe ocaml)
<dmbaturin>
How old is your brother?
<reynir>
23
<apache2_>
he might have an easier time learning python
apache2_ is now known as apache2
<adrien_znc>
why?
ollehar has joined #ocaml
<dmbaturin>
I'd like to try teaching programming to beginners as executable mathematics. Sadly (fortunately?) I have no test subjects.
TheLemonMan has joined #ocaml
badkins has quit []
<apache2>
because build "system" surrounding ocaml is a nightmare, especially if you don't come from a background that has had you solving dependency problems and weird errors with virtually no usable error messages
<xificurC>
dmbaturin: i don't know about mlton or its overloading but I guess it is something similar
<apache2>
it's sort of like telling people who want to try out linux to install gentoo hardened
<adrien_znc>
I've rarely seen the teaching of programming start with using tens of existing libraries
<dmbaturin>
By the time beginners actually need to care about the build system, they usually have the required skill.
<adrien_znc>
exactly ^
<apache2>
adrien_znc: good point. I think "learn ocaml from the very beginning" is a really good read
matason has joined #ocaml
<apache2>
dmbaturin: not sure about that, but at least they might have the motivation to go on irc and complain :)
<apache2>
<--
<dmbaturin>
xificurC: No, SML overloading is not like those modular implicits. My primary objection against it (and haskell Num) is that it has magically selected default that is used in the absense of type annotation.
<xificurC>
RWO had it simple no? They really only called corebuild with a couple of parameters
<companion_cube>
it's pretty simple to start with ocamlbuild for very simple projects
<companion_cube>
problems arise for projects which start having dependencies and several modules
<apache2>
xificurC: rwo is fairly fast-paced though imo
<xificurC>
apache2: dont know, might be, i read too many books about too many languages by now to tell
<companion_cube>
so, I've got a new computer, I can code again during the evenings
<companion_cube>
shall I make a container release?
<reynir>
the build system and that he's using windows is worrying me a bit
<apache2>
I got the vibe from it that it's targeting people coming from other languages. I just flipped it open to look what the prologue says -- it seems to assume knowledge of several languages and talks about polymorphic types on the first page of the book.
<xificurC>
dmbaturin: I never noticed this magical default in haskell, interesting
<dmbaturin>
Well, RWO was hardly meant for beginner level programmers.
<apache2>
dmbaturin: that's what we're debating
<apache2>
reynir: I'd say go for python. if you really want to set him up with ocaml, you could install a VM for him with linux or freebsd
<dmbaturin>
xificurC: Num defaults to Int unless specified otherwise.
<companion_cube>
I concur, it's for experienced programmers that want to learn OCaml
<dmbaturin>
I did enjoy RWO even though I knew virtually nothing about ocaml when I stumbled upon it.
<apache2>
"Ocaml from the very beginning" is the only other book I know of that could be relevant
<xificurC>
dmbaturin: I see. And OCaml will have something similar?
<dmbaturin>
...but I knew multiple other languages by that time.
nojb has joined #ocaml
<apache2>
reynir: I think python is a bit friendlier to start out with, depending on his use cases
<dmbaturin>
Racket has the best IDE for beginners I think.
<dmbaturin>
xificurC: Let me find the paper.
<xificurC>
oh yes, lisp all the way :)
<xificurC>
get him SICP
<reynir>
I would really prefer to set him up with a programming language with a good type system
pobivan has quit [Quit: pobivan]
<dmbaturin>
Well, seriously, it's a great teaching IDE. It can display images right in the REPL and it can show you where something is defined by drawing arrows over your code.
pobivan has joined #ocaml
<reynir>
I also had racket in mind :)
<xificurC>
reynir: there is typed racket, not that mature but working just fine. The guys are even moving some of their codebase to it
<dmbaturin>
Whether beginners should be exposed to a unityped language is a different story. :)
<xificurC>
dmbaturin: paper on what, the modular implicits?
<companion_cube>
yminsky seems to be teaching his children typed racket
<xificurC>
companion_cube: some of the error messages I got were quite strange and cryptic and for higher-order functions or for syntax you might need to annotate some stuff
<reynir>
Hm, maybe I'll go with racket after all
<dmbaturin>
I have a mixed feeling about HTDP though, even if less mixed than my feeling about SICP.
<reynir>
I would need to (re)learn it then :)
<xificurC>
other than that it worked very well, especially for simple stuff it should suffice just fine
<flux>
yes :). thank you for not making me read the fine manual myself!
<flux>
for the people even lazier than I: (setq ac-auto-start nil)
<reynir>
bah, emacs ;)
freling has quit [Quit: Leaving.]
<flux>
now this should be nicer than plain dynamic completion. remains to be seen!
n3ss3s has joined #ocaml
nullcat has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
ddub has quit [Ping timeout: 265 seconds]
ddub has joined #ocaml
rgrinberg has joined #ocaml
Denommus has joined #ocaml
Simn has quit [Quit: Leaving]
matason has quit []
nullcat_ has joined #ocaml
rgrinberg has quit [Ping timeout: 272 seconds]
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
kdef has quit [Quit: Leaving]
agarie has quit []
ontologiae has quit [Ping timeout: 255 seconds]
seangrov` has quit [Ping timeout: 256 seconds]
ncthom91 has joined #ocaml
rgrinberg has joined #ocaml
kdef has joined #ocaml
Gama11_ has quit [Read error: Connection reset by peer]
mengu has quit []
jonludlam has joined #ocaml
tane has quit [Quit: Verlassend]
octachron has quit [Quit: Leaving]
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
rgrinberg has quit [Ping timeout: 272 seconds]
mahem1 has joined #ocaml
<dora-molly>
fine manual… that can't be merlin, you must be talking of auto-complete :P
struk|work has quit [Quit: Page closed]
<dora-molly>
reynir: yop, that's the "dwim" completion that has been added lately… happy you enjoy it :-)
larhat has quit [Quit: Leaving.]
<flux>
I have dynamic json data in the form: ["key1": { value }, "key42" : { value2 }] as part of my non-dynamic data. can I make ppx_deriving_yojson work with that?
asQuirreL has quit [Read error: Connection reset by peer]
asQuirreL has joined #ocaml
<flux>
seems to me there's no way to have an associative list in OCaml so that it becomes that in JSON or vice versa with ppx_deriving_yojson
asQuirreL has quit [Client Quit]
<dora-molly>
producing/consuming an object with arbitrary field names?
<flux>
I would like it to produce something like: (channel_name * vod list) list
<dora-molly>
no idea :'
milosn has quit [Ping timeout: 256 seconds]
<flux>
I guess I'll need to parse that part myself
<flux>
well that wasn't so bad :-)
<flux>
gotta love merlin's destructuring feature
nullcat_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<dora-molly>
:P, for destructuring arbitrary json, I guess merlin can't do magic :-)
<flux>
well, it's already an OCaml object, I suppose it didn't really help me much here other than tell what the constructors were and that I could've found otherwise :)
<dora-molly>
true. You know what is expected, you just need to be reminded the pedantic litteral notation…
ollehar1 has joined #ocaml
nullcat has joined #ocaml
nullcat has quit [Client Quit]
osa1 has quit [Ping timeout: 265 seconds]
<dora-molly>
(or "get prefilled" rather than being reminded)
<Denommus>
anyone here used RxCpp?
<Denommus>
sorry, wrong channel
Kakadu has quit [Remote host closed the connection]
struktured has joined #ocaml
<ollehar1>
what's it called again, variant types where type is "a or b or ..."
<ollehar1>
?
<ollehar1>
ah, polymorphic
<ollehar1>
or no? if I have type a and b, and then want a hashtable from c to a or b.
<ollehar1>
must I use variants?
<zozozo>
ollehar1: you'd want a sum type, something like type a_or_b = A of a | B of b
<zozozo>
and then a hashtbl from c to a_or_b
<ollehar1>
yeah, but I thought I could do it without boxing the types
<ollehar1>
with [`a; `b]
<ollehar1>
or something
<zozozo>
as far as I know, that's not possible
tsumetai has quit [Read error: Connection reset by peer]
<ollehar1>
hm ok
<zozozo>
you might use : `A of a and `B of b, in which case you do not need to define them before
<ollehar1>
new in the channel?
<ollehar1>
right!
<ollehar1>
but still need boxing
<zozozo>
not really, juste not that active usually
<zozozo>
you'll always need boxing as you need to decide which type the value you receive has
<ollehar1>
yep
<ollehar1>
unless you want an abstract type
<zozozo>
and since ocaml erases the types after compilation, it nedd some tag
<ollehar1>
hm
<zozozo>
*needs
BitPuffin|osx has joined #ocaml
<ollehar1>
you could receive a polymorphic type of some kind, no? but you couldn't do much with it.
<ollehar1>
or am I thinking too much interfaces.
<dora-molly>
at the value level, you always need "boxing" -- you need a way to store the value witnessing whether it is `A or `B
swgillespie has joined #ocaml
<ollehar1>
ok
<dora-molly>
what you are looking for is "declaring the type"… indeed with polymorphic variants you don't need a type declaration
<dora-molly>
([`A of a | `B of b], some_value) Hashtbl.t is fine.
<ollehar1>
ok
<ollehar1>
but then I might as well define it before hand
tsumetai has joined #ocaml
<dora-molly>
yes of course.
<dora-molly>
It depends on what you want to express.
<ollehar1>
mhm
<ollehar1>
too much PHP :D thinking interface like "limit types to this and that", and then you can just type or whatever at runtime.
<ollehar1>
*type cast
<ollehar1>
actually, I think I could do that with the object system. oh well.
<dora-molly>
this can be done with exceptions/open types
<dora-molly>
these allow to turn dynamic information to type information
<ollehar1>
really?
<ollehar1>
should read
<dora-molly>
php just has no types… it's runtime information/values, but by definition, can't assert anything that would be statically true
<ollehar1>
eh?
<ollehar1>
type hints in arguments?
<ollehar1>
function this(that : Interface) ...
inr has quit [Ping timeout: 256 seconds]
<dora-molly>
how is that different from function this(that) { assert(hastype(that, Interface)); … } ?
<ollehar1>
hm
<dora-molly>
types are properties from an earlier stage, there is just no such notion in php
<ollehar1>
no compile phase?
osa1 has joined #ocaml
<dora-molly>
which one? by compile phase, you mean semantic analysis… how would semantic analysis in php be influenced by such annotation?
<dora-molly>
since there is no way, from a caller, to assert that the value passed in position of "that" argument actually has type Interface
<dora-molly>
(and by "has type" I mean the "property to be an Interface" holds for that), it's exactly the same as dynamically checking a predicate
<dora-molly>
(the "hastype" in my rewriting)
tsumetai has quit [Ping timeout: 256 seconds]
<ollehar1>
well there yo go
<ollehar1>
*you
<dora-molly>
so objects in ocaml allow you to flexibly express that a value satisfy a set of properties (each method defined in the object)
<dora-molly>
at the use-point (call site), you only need to specify the property that you want (calling the appropriate method)
<dora-molly>
that's purely static (although at runtime, the call needs to do slightly more work than a static function call)
<dora-molly>
exceptions/open-types allow you to express the fact that you expect to recover a value from a specific tag
<jyc>
is there anyway to selectively open?
<zozozo>
jyc: you can do local open
<dora-molly>
(that can be used to encode downcasting relation from oop)
<Drup>
depending on what ?
<jyc>
a module I open has a Log module that is overriding log.ml in my project's directory
<jyc>
oh, ok. is there no other way?
<zozozo>
you can also not open the module, and call Module.Log... instead
<jyc>
well log.ml is in the project directory; is there some way to refer to it other than Log?
<zozozo>
not to my knowledge
<dora-molly>
module ReExportExternal : module type of struct include ExternalModule end with module Log := ExternalModule.Log open ReExportExternal
<dora-molly>
that way you create a module equals to the external one without the Log shadowing
<dora-molly>
… not really more readable, but composable :P
<Drup>
eh, that's not going to work if they don't have the same type ...
<dora-molly>
uhhh, yes it will work
<Drup>
even if some other modules depends on Log ?
<dora-molly>
it's reexporting ExternalModule.Log to be ExternalModule.Log, that's fine
NoNNaN has quit [*.net *.split]
<Drup>
I reread, yeah
<jyc>
haha, thanks. I guess I will just end up renaming it.
<dora-molly>
it's just extremely ugly… or verbose, as they say in java :-)
<Drup>
jyc: tbh, you should rename it. Log is just a name too generic
<jyc>
ok, I will rename it to com.example.project.log.Log
<Drup>
jyc: MyLog ;)
<Drup>
dora-molly: new tentative with my generalization issue. wrapping everything in unit on the library side doesn't even work since it needs to be eta expanded on the definition side >_>
javamonn has quit [Remote host closed the connection]
<dora-molly>
Drup:
javamonn has joined #ocaml
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<dora-molly>
yes, everything you'll be able to export will be type variances anyway (if all the user can do is applying funcitons)
<dora-molly>
all the (clever) encoding has to go through that…
<Drup>
no, even if the type are exposed
<Drup>
I mean, the types are not abstract at all
<dora-molly>
relaxing sure
MrScout_ has quit [Ping timeout: 256 seconds]
<dora-molly>
but the user builds value through functions?
<Drup>
yeah, I know, I know ...
<dora-molly>
:-)
<Drup>
it's mildly infuriating, though.
<dora-molly>
(appropriately) relaxing the value restriction seems to be the way to go
<sheijk>
shouldn't it also work to do 'module MyLog = Log \n open OtherModule' and then use MyLog.foo instead Log.foo?
<sheijk>
(about the Log module shadowing discussion earlier)
n3ss3s has joined #ocaml
<zozozo>
it should work, but you'll have to do that in every file where you want to use Log and OtherModule
<zozozo>
plus it makes the code that harder to read and understand
<sheijk>
i think it would make it easier to understand than the other re-exporting solutions
<zozozo>
sure
<zozozo>
but I think renaming you log.ml file would be the best and simplest solution
javamonn has joined #ocaml
<jyc>
by the way, does anyone know how to get merlin to unhlight the things it highlighted with :TypeOf?
yomimono has quit [Ping timeout: 246 seconds]
dsheets has quit [Ping timeout: 265 seconds]
<sheijk>
yep. as long as that is an option (which it might not be if the project has many active branches)
<zozozo>
sure
dsheets has joined #ocaml
yomimono has joined #ocaml
kdef has quit [Quit: Leaving]
javamonn has quit [Ping timeout: 272 seconds]
asQuirreL has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<n3ss3s>
Hey. I have the following code for extracting every consecutive trigram from a list of words, http://pastebin.com/5Er6mn3c
<n3ss3s>
It works as expected for an input list of 3 elements, but anything greater and it returns an empty list
<n3ss3s>
Any hints?
<zozozo>
n3ss3s: in your match, you match a list of exactly 3 elements
<zozozo>
match words with a :: b :: c :: []
<dora-molly>
jyc: :MerlinClearHighlighting
<n3ss3s>
oh dear, I need d instead of []
<zozozo>
you should replace [] by _ to match any list with a least three elements
<n3ss3s>
Oh yeah _ is better. Thanks.
<zozozo>
n3ss3s: also, the List.tl function is already defined in the stdlib
<zozozo>
(equivalent to your tail function)
<jyc>
dora-molly: haha, thanks. how did you find that?
<n3ss3s>
Hmm I suspected it would exist, List.tail didn't so I just went on and implemented it
<dora-molly>
jyc: I cheated. I'm one of merlin author :'
javamonn has joined #ocaml
madroach has quit [Ping timeout: 264 seconds]
<dora-molly>
(but in next version, all commands will start with Merlin; coupled with vim completion (and vim doc), this should make it easier to discover merlin commands)
javamonn has quit [Remote host closed the connection]
<dora-molly>
haha, I like the idea of infering the type from a value occuring in a positive position
<dora-molly>
but used in a negative position in the resulting type
<Drup>
?
<dora-molly>
it (approximately) reveals the intent of matching your type is made for
javamonn has joined #ocaml
inr has joined #ocaml
<dora-molly>
Drup: in the first example, you give a string value, which by virtue of inference makes type 'a from the instantiation of Add be of type string
<Drup>
hum, no, it does not
<Drup>
ah, which 'a ?
<Drup>
maybe I should rename the last one
<dora-molly>
the one resulting from instantiation of the first /
<dora-molly>
(and the 'a from the type declaration, not the universal one :/)
<Drup>
right.
<Drup>
yes, and ?
<Drup>
why is that exceptional ? It's exactly what format is doing :D
<dora-molly>
so a value stored in the constructed type, put a constraint on a type occuring in negative position ('a at the left of the -»)
<dora-molly>
->*
<Drup>
yeah
<dora-molly>
more or less, in format we only give a constraint on the shape
<dora-molly>
here, it's directly a value of the expected type
<Drup>
well, it's equivalent
<dora-molly>
in format case, the typechecker has to infer that "%s" (or whatever specifier) constraint the type to be string
<Drup>
not really, the typechecker doesn't infer that really
<Drup>
it builds a value that put it in the type
<dora-molly>
here, it's the value (on which there is no constraint), which unifies with the negative occurene…
<Drup>
it's just that value in question is a gadt, not a real value of the type
<Drup>
but yes, I got your point :)
<dora-molly>
I agree. It's just… there is some symmetry between the value you give and the matched one.
<Drup>
(I actually don't even use that in practice, it really doesn't change a thing)
<Drup>
(In furl, it's also a gadt, not a real value)
<dora-molly>
ok :-)
<dora-molly>
from your example list, I would not only write ('f, +'r), but (+'f, +'r)
jwatzman|work has quit [Quit: jwatzman|work]
<Drup>
err, how do you write this one ?
<Drup>
'r is almost covariant, but 'f is really not
<dora-molly>
since 'f = _ -> 'r, both 'f and 'r are positive occurences
<dora-molly>
in your example, they are
<dora-molly>
*minimal* example
<Drup>
covariant.ml ? OCaml doesn't agree :D
<dora-molly>
covariant.ml? sounds like a fine domain name for ml'ers coffee place
nullcat has joined #ocaml
<Drup>
:D
<dora-molly>
yes, in base case its wrong
<Drup>
yep
<dora-molly>
because this invariant is not preserved between Base and Add