adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | Current MOOC: https://huit.re/ocamlmooc | OCaml 4.04.0 release notes: http://ocaml.org/releases/4.04.html | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml
demurgos has joined #ocaml
<demurgos> Hi, I am encountering a really strange behavior with OCaml. I create two identical strings: one as a literal (`"\xaa\xaa"`), the second one with `Bytes.to_string (Bytes.make 2 '\xaa')`. String.compare returns 0, they are identical.
<demurgos> Now, what happens is that if I use the literal string, my function throws an error but when I use the string built with Bytes it works.
<Drup> Can you pastebin the code somewhere ?
<demurgos> Even worse: if I simply define my string with a literal but never use it (flagged by the compiler), it still breaks the function
<demurgos> Here is the code
<demurgos> I know that it is not that minimal, but I spent a few days tracking an issue in the compiler
<demurgos> It has this really weird behavior (unused variable changing the result of a function) so I couldn't isolate it more
<Drup> this codes raises multiple level of "wat"
<demurgos> (build instructions)
<Drup> demurgos: my first instinct would be to look for == in the code
<demurgos> The only function that matters is the one from the line 55 to 142
virtualeyes has joined #ocaml
virtualeyes1 has quit [Quit: Leaving.]
virtualeyes has quit [Client Quit]
virtualeyes has joined #ocaml
<Drup> huh, I'm really not sure
<demurgos> More precisely, the issue is only around: main.ml, line 55 ; IO.nwrite, IO.close and Extc.output_zip
<demurgos> I will try to isolate it even more, but I just feel that I encountered a really weird memory error
<Drup> pure ocaml should never get something like that, so it's probably zlib's fault (or a bug in the compiler, but unless you are on trunk, this is extremly unlikely)
<demurgos> I know, those are both the stable version of zlib and the stable version of haxe
<Drup> You should try to extract the zlib part and see if you can reproduce with just that
virtualeyes has quit [Ping timeout: 260 seconds]
<demurgos> I know that I did not finish isolating the issue, but I hit a wall here because if I move this code and literal directly in Extc to directly call zlib, it works perfectly (no error).
<demurgos> I'll try to move it outside of the context of the compiler at least
groovy2shoes has quit [Quit: Leaving]
wtetzner has quit [Remote host closed the connection]
mengu has quit [Remote host closed the connection]
jao has quit [Remote host closed the connection]
jao has joined #ocaml
Onemorenickname has quit [Read error: Connection reset by peer]
virtualeyes has joined #ocaml
demurgos has quit [Quit: Page closed]
Marak has joined #ocaml
<Marak> Hello. I'm working a little web service for executing ocaml code. I've got it mostly working, but need to figure out how to eval an string as ocaml code. I found http://stackoverflow.com/questions/33291754/eval-a-string-in-ocaml, but I'm hoping to do it with just using ocaml binary itself. Is this possible?
<Marak> perhaps by using compiler-libs package?
<Drup> Marak: what's your issue with the first answer ?
<Marak> Drup: It's talking about running UTop? I just have ocaml right now.
silver has quit [Quit: rakede]
<Marak> It's actually my first day ever using ocaml, so I'm an epic noob right now. My apologies.
<Drup> the first answer doesn't talk about utop,
<Drup> or rather, it doesn't actually need it, not sure why this comment was added
<Marak> `Error: Unbound module Toploop`
<Drup> yeah, you need to load compiler-libs
<Marak> how would i do that?
<Marak> is it a package i require, or a flag for building?
virtualeyes has quit [Ping timeout: 240 seconds]
<Marak> i've got opam installed already
<Drup> then type the #require thing in your toplevel, and it should work
<Marak> okay, thanks. i tried this, but now i will try again knowing its the right thing to do.
<Drup> (and install utop, really)
<Marak> Unknown directive `require'., is that a local env issue?
<Drup> It's a setup issue, dud you initialized opam as indicated ?
<Marak> I RTFM and am now configuring opam.
<Drup> Please do follow all the installation instructions, it'll make your life easier for a long while after that. :)
<Drup> (Side note: evaluating ocaml code at runtime is not something I would advise as a first project)
<Marak> Drup: I'm hoping to add ocaml support to https://github.com/stackvana/microcule, which would add ocaml support to the https://hook.io project
<Marak> Mostly as a fun and easy way to write streaming webservices in ocaml. Probably wouldn't be super performant ( to start ). We are adding plans for a compilation step in the future. I'm just experimenting now using -stdin flag
<Drup> Ehe, surprisingly, all the supported languages are interpreted :D
<Drup> anyway, in this case, just pipe to toplevel, yeah
<Marak> i'm still getting Unknown directive `require'. and i'm fairly certain i configured opam correctly and setup the env variables it wants
<Marak> i did install from brew, that might have to do with it
<Drup> what's the content of .ocamlinit ?
<Drup> (in your ~ )
<Marak> (* Added by OPAM. *) let () = try Topdirs.dir_directory (Sys.getenv "OCAML_TOPLEVEL_PATH") with Not_found -> () ;;
fraggle_ has quit [Ping timeout: 255 seconds]
<Marak> $ echo $OCAML_TOPLEVEL_PATH /Users/squiresm/.opam/system/lib/toplevel
<Drup> Add "#use "topfind";;" on it's own line, at the end
<Drup> (without the surrounding quotes)
<Marak> i did that and opened up a new shell, same
<Marak> #use "topfind";;
<Marak> wait, one sec
<Marak> nope, no luck
<Drup> huuum, "opam install ocamlfind" ?
<Marak> [NOTE] Package ocamlfind is already installed (current version is 1.7.1).
<Drup> right, as expected
<Drup> you tried utop ?
<Marak> i'm getting sub 20ms response time on ocaml binary. would utop be a replacement for ocaml binary?
<Marak> overhead of spawning process is a concern
fraggle_ has joined #ocaml
<Drup> yeah, let's try to make it work first, right ?
<Marak> okay, i'll try out utop, it seems like a nice tool to have anyway. brb
<Drup> if your only concern is to eval ocaml code by spawning a process each time, you don't even need to write ocaml code anyway
<Drup> just pipe to the ocaml toplevel
<Marak> aye, but i'll need to do a codegen to create a bit of ocaml to create environment for microservice
<Marak> we've got two hashes, of http params, and env variables
<Drup> well, you can still use pipes :D
<Marak> yes, i've got that part working
<Marak> utop seems to have no issues running the script, heh. also it seems awesome
Flerex has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
<Marak> going to circle around again and see when i get stuck. i'll try not to bug you
<Marak> thanks Drup
<Marak> wow
<Marak> its working
<Marak> node.js http streams connected to stdin / stdout of ocaml. neat
fraggle_ has quit [Ping timeout: 255 seconds]
<Marak> i should push this further. whats the recommended way to make http requests in ocaml?
<Drup> the cohttp library
<Marak> installing now
<Marak> i'm curious. opam is installing these dependencies per user? not per application? what happens if i needed to use two separate versions of a package at once in two separate applications on the same system.
<Drup> There is a thing called switches, which allows parallel installations
<Marak> cool
fraggle_ has joined #ocaml
<Marak> hrmmm. Error: Unbound module Lwt
<Marak> $ opam install Lwt [NOTE] Package lwt is already installed (current version is 2.7.0).
<Drup> did you #require the packages you need ?
<Marak> probably not, i just ran the example without really reading it.
<Marak> im still trying to figure out this syntax.
<Marak> i think i understand it now, trying
<Drup> in the toplevel, you need to #require packages. If you compile (with ocamlbuild for example) you need to provide them on the command line (with -pkg, in the case of ocamlbuild)
<Marak> thanks
<Marak> i got lwt and cohttp #required, but its getting hung up Error: Reference to undefined global `Cohttp_lwt_unix'
<Marak> No such package: cohttp_lwt_unix
<Drup> (run "ocamlfind list" to get the list of packages, it unfortunatly doesn't always map 1-1 to module names)
<Marak> #require "cohttp.lwt", much success
<Marak> so cool, thanks again Drup. you've probably saved me hours of time
<Marak> how is JSON support in Ocaml? good, or bad? i have to choose between using Ocaml the parse the incoming argv JSON into ocaml data structures, or use the eval function to evaluate a block of meta-programmed ocaml code ( that came over argv from javascript land )
<Marak> programming is fun
<Marak> yojson, looks good
virtualeyes has joined #ocaml
FreeBirdLjj has joined #ocaml
ivan_ has quit [Remote host closed the connection]
mesiviah_ has quit [Remote host closed the connection]
govg has quit [Quit: leaving]
fedruantine has quit [Ping timeout: 248 seconds]
obadz has quit [Ping timeout: 260 seconds]
obadz has joined #ocaml
mfp has quit [Ping timeout: 256 seconds]
fedruantine has joined #ocaml
jao has quit [Ping timeout: 240 seconds]
Marak has quit [Ping timeout: 260 seconds]
snhmib has quit [Ping timeout: 240 seconds]
agarwal1975 has joined #ocaml
agarwal1975 has quit [Quit: agarwal1975]
snhmib has joined #ocaml
agarwal1975 has joined #ocaml
agarwal1975 has quit [Quit: agarwal1975]
virtualeyes has quit [Read error: Connection reset by peer]
virtualeyes1 has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 240 seconds]
fedruantine has quit [Ping timeout: 258 seconds]
mattrepl has quit [Quit: mattrepl]
FreeBirdLjj has joined #ocaml
fedruantine has joined #ocaml
agarwal1975 has joined #ocaml
pyx has joined #ocaml
pyx has quit [Client Quit]
fedruantine has quit [Ping timeout: 252 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
agarwal1975 has quit [Quit: agarwal1975]
snhmib has quit [Ping timeout: 256 seconds]
virtualeyes1 has quit [Ping timeout: 276 seconds]
groovy2shoes has joined #ocaml
snhmib has joined #ocaml
pierpa has quit [Ping timeout: 240 seconds]
agarwal1975 has joined #ocaml
FreeBirdLjj has joined #ocaml
agarwal1975 has quit [Quit: agarwal1975]
larhat has joined #ocaml
larhat has quit [Client Quit]
defgeneric has quit [Ping timeout: 240 seconds]
MercurialAlchemi has joined #ocaml
djellemah has quit [Ping timeout: 240 seconds]
Flerex has joined #ocaml
<shon> Oh man... the build stuff is really driving me nuts. I'm starting to think I'm just not smart enought to handle these build tools. Nothing works like I expect it to.
<shon> That's just steam blowing off, btw -- not a cry for help.
Marak has joined #ocaml
<Marak> Drup: totally got it working, https://github.com/Stackvana/microcule/commit/0092afe2d6811219ef4f231fe56c0a6621a74875. thanks for the help
<Marak> need to write examples and documentations and will have it included in the next update to https://hook.io
Flerex has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
william-s has joined #ocaml
AlexDenisov has joined #ocaml
snhmib has quit [Ping timeout: 240 seconds]
MercurialAlchemi has quit [Ping timeout: 245 seconds]
<shon> I failed to realize that specifying a module signature in an mli file without actually duplicating the contents of the signature there has the effect of creating an abstract module type, leaving all the internals inaccessible! Now I know, and it makes sense...
<shon> But that was a rough wall to bang my head on for 3 hours...
snhmib has joined #ocaml
<shon> I wonder if anyone here has had good experiences with solvuu-build (https://github.com/solvuu/solvuu-build). It seems like using the language itself to specify the build is an appealing idea, and taking care of the .merlin and .ocamlinit files automatically is a sweet bonus...
Marak has quit [Ping timeout: 260 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
govg has joined #ocaml
rgrinberg has quit [Ping timeout: 255 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
djellemah has joined #ocaml
FreeBirdLjj has joined #ocaml
MercurialAlchemi has joined #ocaml
Algebr has joined #ocaml
govg has quit [Ping timeout: 240 seconds]
govg has joined #ocaml
zpe has joined #ocaml
<Algebr> Is there anywhere in the manual that formally talks about hex string literals? the "\x00\x12", etc
<Algebr> And what is the easiest way to turn a byte sequence into an integer without a library
AlexDenisov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ewanas has quit [Remote host closed the connection]
zpe has quit [Remote host closed the connection]
ewanas has joined #ocaml
govg has quit [Quit: leaving]
snhmib has quit [Ping timeout: 264 seconds]
Simn has joined #ocaml
fre has joined #ocaml
snhmib has joined #ocaml
govg has joined #ocaml
Algebr has quit [Ping timeout: 255 seconds]
govg has quit [Client Quit]
<companion_cube> int_of_string?
<companion_cube> or are you talking about turnning 4 bytes into an int? (in which case you'd better use a lib imho, to explicitely specify endianess)
ocalm has quit [Quit: Leaving]
jnavila has joined #ocaml
william-s has quit [Quit: WeeChat 1.7]
ocalm has joined #ocaml
<ocalm> Hi
<ocalm> what editor do you use for ocaml?
AlexDenisov has joined #ocaml
<ocalm> I use VS Code at the moment.
AlexDenisov has quit [Client Quit]
<flux> emacs! is vs code good for it? does it work with merlin?
<flux> apparently there's some support available from the visualstudio marketplace
alfredo has joined #ocaml
AlexDenisov has joined #ocaml
<ocalm> Yes it does has support, from the little I know. github.com/hackwaly/vscode-ocaml
AltGr has joined #ocaml
zpe has joined #ocaml
kakadu has joined #ocaml
cheater has quit [Ping timeout: 240 seconds]
cheater has joined #ocaml
<companion_cube> flux: yes, it does show types on hover, and all that
zv has quit [Quit: WeeChat 1.6]
govg has joined #ocaml
jnavila has quit [Quit: It was time]
jnavila has joined #ocaml
larhat has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
AlexDenisov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
AlexDenisov has joined #ocaml
<flux> well, that's the main feature :), but the rest would be nice as well
<flux> (and ie. copying type to clipboard)
ocp has joined #ocaml
govg has quit [Ping timeout: 248 seconds]
mfp has joined #ocaml
demurgos has joined #ocaml
demurgos2 has joined #ocaml
<demurgos2> Drup: I managed to isolate my code that causes an error because of an unused variable: https://github.com/demurgos/min-zlib-issue/blob/master/main.ml
<demurgos2> If I compile this program, I get: File "main.ml", line 8, characters 8-17: Warning 26: unused variable def_data2.
<demurgos2> But it crashes unless I comment out def_data2
<companion_cube> how do you mean "crash"?
<demurgos2> Ok, I'll explain you
<companion_cube> ah, calling an external library?
<demurgos2> I am tracking an issue in the Haxe compiler
<demurgos2> Yes
<demurgos2> It seems that the latest stable version of zlib (1.2.11) has an issue and triggers sometimes the error: "Error: zlib_deflate".
<demurgos2> When I tried to reproduce the calls to zlib_deflate directly, I wasn't able to reproduce the error
<demurgos2> So I followed what arguments are provided in what order to the functions in Extc calling zlib
<demurgos2> I finally managed to come up with a minimal code example (see repo)
<demurgos2> But that's when things gets strange: the current code triggers the issue
<companion_cube> and the assertion def_data=def_data2 holds?!
<demurgos2> YES
<companion_cube> (I suppose this all uses Core?)
<demurgos2> But if I try to build the data string with "Bytes.make" instead of a literal, it works
<demurgos2> Yes
<companion_cube> wth
<companion_cube> if you use String.make?
<demurgos2> The mere presence of the literal causes the error
<companion_cube> :D
<demurgos2> BUT IT IS UNUSED
<demurgos2> This is driving me crazy :D
<companion_cube> I suspect the literal must live in the static section of the program
<demurgos2> I'll try with String.make
<demurgos2> Yes, that's what I guess too, but I do not see what causes this
<demurgos2> Maybe, it is related to a call to String.blit ? https://github.com/demurgos/min-zlib-issue/blob/master/extc.ml#L42
<demurgos2> It's the only function that seems "deprecated"
<demurgos2> (or unsafe)
<demurgos2> But I am not that sure about this (I just started with OCaml last week to solve this issue)
<companion_cube> hum, do you use safe-string?
<companion_cube> but yeah, String.blit is to be avoided
<companion_cube> ohhhhhhh
AlexDenisov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<companion_cube> if you try to String.blit into a static string…
<companion_cube> (note: the indentation in this module is weird)
<companion_cube> (ah, tabs :/)
<demurgos2> (Sorry about the indentation, I usually use spaces)
<demurgos2> The thing is that this code works with zlib 1.2.8
<demurgos2> And if I follow the code, the String.blit is from the static string to a string that was dynamically created
<demurgos2> (not to)
<companion_cube> ah
<companion_cube> (still, it's good practice nowwadays to use Bytes for this stuff, and enforce the distinction using -safe-string)
<demurgos2> (Anyway, def_data2 is not even used)
govg has joined #ocaml
<demurgos2> Yes, that what I saw but I think that there is a lot of work to update the codebase of Haxe
<demurgos2> String.make leads to the same results.
<demurgos2> I'll try to replace String.blit with Bytes.blit
ygrek_ has quit [Ping timeout: 240 seconds]
ocp has quit [Quit: Leaving.]
ocp has joined #ocaml
<companion_cube> it must be something else
ocp has quit [Ping timeout: 276 seconds]
ocp has joined #ocaml
AlexDenisov has joined #ocaml
govg has quit [Quit: leaving]
govg has joined #ocaml
orbifx-m has joined #ocaml
<orbifx-m> greetings
<companion_cube> mortals
<orbifx-m> indeed :P
<cheater> can i use gpus from ocaml? say for prime factorization or preimage attacks
<orbifx-m> does cstruct support variant fields?
<Drup> cheater: lookup "SPOC"
<cheater> Drup: i'm just trying to figure out the feasability of using ocaml for something..
<cheater> i'm guessing the answer is "yes" :)
<companion_cube> Drup: no, don't
<companion_cube> I don't think spoc is production ready at all
<Drup> right
<companion_cube> not sure it even compiles (didn't last time I tried, and the package version is still "20140620")
<companion_cube> we'd better have some CUDA bindings and unsafe C kernels for a start
<companion_cube> decoupling fancy preprocessors, and the actual backends
<companion_cube> should be the same for databases, btw
ziyourenxiang has joined #ocaml
fre has quit [Ping timeout: 240 seconds]
<demurgos2> companion_cube: I update the code to use -safe-string, there is still an issue .-.
<cheater> companion_cube: hmm... so... possible? (even via C lib)
<demurgos2> updated*
<companion_cube> cheater: well yes, it's definitely possible, but people haven't done it afaik
<companion_cube> but if python can bind to CUDA, no reason OCaml can't
<companion_cube> (cuda or openCL)
<companion_cube> demurgos2: heh. Are you alone on this, or can you talk to the maintainer of the zlib binding? or are you the maintainer yourself?
<demurgos2> I am not the maintainer, this the custom binding used byt the haxe compiler
<demurgos2> I opened an issue here
<cheater> OK companion_cube
<demurgos2> this is*
<companion_cube> cause the behavior of crashing if you just *declare* a constant string is definitely not normal
<demurgos2> Yes, but I do not know if it is a problem with the OCaml compiler, zlib or Haxe
<demurgos2> I opened the issue on the Haxe repo since it where I discovered it, but it is really not clear
<demurgos2> Now, I managed to isolate it from the compiler, so it is either ocamlc or zlib
<demurgos2> (the compiler = haxe)
fre has joined #ocaml
dhil has joined #ocaml
dhil has quit [Client Quit]
dhil has joined #ocaml
snowcrshd has joined #ocaml
govg has quit [Quit: leaving]
govg has joined #ocaml
govg has quit [Client Quit]
govg has joined #ocaml
dhil has quit [Ping timeout: 260 seconds]
<orbifx-m> does cstruct support variant fields?
<orbifx-m> Also, what's the best way to express a fold over a Buffer?
<orbifx-m> convert it to string than to array? or something else?
<companion_cube> erf
<companion_cube> this is quite sad, Buffer doesn't even have `iter` :/
zpe has quit [Ping timeout: 240 seconds]
mengu has joined #ocaml
silver has joined #ocaml
<orbifx-m> Let's check batteries
<zozozo> seemes like a good idea for a PR
<companion_cube> zozozo: please do it then
<companion_cube> I provide a `to_seq` function in my iterator PR though
dhil has joined #ocaml
<zozozo> well, that would be better
_andre has joined #ocaml
<zozozo> I'll look at it and try the PR soon (assuming nothing moves on iterators)
<orbifx-m> Do you have to open an issue or anything?
FreeBirdLjj has joined #ocaml
<zozozo> there are no issues on the ocaml github sadly, so you could open one on mantis but I think a PR is actually better
<orbifx-m> you mean impement it and request a merge (PR = pull request?)
<companion_cube> yes
<companion_cube> anyway, I'd also like to make a PR for more list functions
<orbifx-m> And do I'm I correct that they now accept merge requests from github?
<companion_cube> indeed they do
AlexDenisov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
AlexDenisov has joined #ocaml
govg has quit [Ping timeout: 256 seconds]
AlexDenisov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
snhmib has quit [Read error: Connection reset by peer]
larhat has quit [Quit: Leaving.]
freehck has joined #ocaml
fre has quit [Ping timeout: 276 seconds]
silver_ has joined #ocaml
silver has quit [Ping timeout: 260 seconds]
demurgos2 has quit [Quit: Page closed]
demurgos has quit [Quit: Page closed]
jao has joined #ocaml
silver_ is now known as silver
ocaml101 has joined #ocaml
larhat has joined #ocaml
snhmib has joined #ocaml
jao has quit [Ping timeout: 255 seconds]
mengu has quit [Remote host closed the connection]
AlexDenisov has joined #ocaml
snhmib has quit [Ping timeout: 258 seconds]
fre has joined #ocaml
Algebr has joined #ocaml
ansiwen_ is now known as ansiwen
Algebr has quit [Ping timeout: 255 seconds]
ocp has quit [Quit: Leaving.]
snhmib has joined #ocaml
__y has quit [Ping timeout: 252 seconds]
tobiasBora has quit [Ping timeout: 256 seconds]
zpe has joined #ocaml
xorpse has joined #ocaml
yomimono has joined #ocaml
_y has joined #ocaml
tobiasBora has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
snhmib has quit [Ping timeout: 252 seconds]
AltGr has left #ocaml [#ocaml]
mattrepl has joined #ocaml
mengu has joined #ocaml
govg has joined #ocaml
nomicflux has joined #ocaml
wtetzner has joined #ocaml
yomimono has quit [Ping timeout: 240 seconds]
snhmib has joined #ocaml
wtetzner has quit [Ping timeout: 248 seconds]
virtualeyes has joined #ocaml
nomicflux has quit [Quit: nomicflux]
yomimono has joined #ocaml
sh0t has joined #ocaml
AltGr has joined #ocaml
dhil has quit [Ping timeout: 240 seconds]
AlexDenisov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dhil has joined #ocaml
mengu has quit [Remote host closed the connection]
mengu has joined #ocaml
Flerex has joined #ocaml
AlexDenisov has joined #ocaml
virtualeyes has quit [Ping timeout: 240 seconds]
ocaml101 has quit [Ping timeout: 260 seconds]
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
zpe has quit [Ping timeout: 240 seconds]
infinity0_ has joined #ocaml
infinity0_ has joined #ocaml
infinity0 has quit [Changing host]
infinity0 has quit [Remote host closed the connection]
govg has quit [Ping timeout: 240 seconds]
infinity0 has joined #ocaml
infinity0 has quit [Remote host closed the connection]
govg has joined #ocaml
infinity0 has joined #ocaml
jfntn has joined #ocaml
infinity0 has quit [Remote host closed the connection]
virtualeyes has joined #ocaml
infinity0 has joined #ocaml
govg has quit [Ping timeout: 240 seconds]
infinity0 has quit [Remote host closed the connection]
MercurialAlchemi has quit [Ping timeout: 256 seconds]
infinity0 has joined #ocaml
infinity0 has quit [Remote host closed the connection]
jfntn has quit [Remote host closed the connection]
jfntn has joined #ocaml
infinity0 has joined #ocaml
rgrinberg has joined #ocaml
rossberg has quit [Ping timeout: 240 seconds]
rgrinberg has quit [Remote host closed the connection]
sz0 has joined #ocaml
rgrinberg has joined #ocaml
ciniglio has joined #ocaml
rossberg has joined #ocaml
AlexDenisov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
AlexDenisov has joined #ocaml
<cheater> hey guys
<cheater> i've noticed when i get type errors the location of the error starts on the space before the value, rather on the value itself. it seems like a bug. can someone confirm this is or isn't the behaviour we want?
<Drup> the indexes in error message follow the usual conventions for error message such that they are properly highlited by emacs/vim/others
<Drup> Not sure what you are using, but as first guess: you are counting columns off by one
<cheater> i'm using vim
<cheater> and if i have code like
<cheater> my_func my_val
<cheater> and my_val is of the wrong type
<cheater> then this is where the error will start:
<cheater> my_funcXmy_val
virtualeyes has quit [Ping timeout: 260 seconds]
larhat has quit [Quit: Leaving.]
virtualeyes has joined #ocaml
shinnya has joined #ocaml
kakadu has quit [Quit: Konversation terminated!]
<flux> cheater, have you looked what the output of the compiler is?
MercurialAlchemi has joined #ocaml
<flux> cheater, also are there tabs involved?
shinnya has quit [Ping timeout: 240 seconds]
xorpse has quit [Ping timeout: 252 seconds]
govg has joined #ocaml
<jerith> flux: You were interested in slacko stuff, right?
<flux> yes
ziyourenxiang has quit [Quit: Leaving]
<flux> cool ;)
handlex has joined #ocaml
zpe has joined #ocaml
handlex has quit [Read error: Connection reset by peer]
handlex has joined #ocaml
zpe has quit [Remote host closed the connection]
handlex has quit [Ping timeout: 276 seconds]
<Leonidas> jerith: yes, thanks. Will look into it!
<jerith> Leonidas: Cool, whenever you have time.
<jerith> It was an interesting weekend project and I discovered that my conduit bug from a year ago (which is relevant to the test code) was fixed in December. :-)
<companion_cube> !xyproblem = http://mywiki.wooledge.org/XyProblem
<ocabot_> OK.
<companion_cube> (quite interesting)
<Leonidas> jerith: I'm kinda thinking whether it wouldn't be better to functorize instead of the set_base_url so the tests could create their own environment without any mutation under the hood.
<cheater> flux, no tabs
AlexDenisov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<jerith> Leonidas: My main goal here was to make the minimum feasible change to the non-test code.
<cheater> flux, i haven't seen the output of the compiler, why is that relevant?
<jerith> I'm definitely happy to change non-test code, and the functor thing sounds like a reasonable approach, but I wanted to have this kind of conversation before hacking your library to bits and reassembling it in a different order.
<Leonidas> jerith: yep, I see your reasoning :-)
<Leonidas> I'm thinking whether it would make sense to functirize even further so Lwt.t could be replaced by e.g. something lighter that would be easier to test.
<Leonidas> so happy we're at 0.x so we can break whatever we please :D
slash^ has joined #ocaml
<jerith> Anyway, I have to head out for the evening. I'll probably be on IRC sporadically during band practice, but not really in a way that would allow proper conversation.
<Leonidas> no worries :)
fre has quit [Ping timeout: 240 seconds]
<Leonidas> jerith: anyway, I am quite surprised coverall works. That's *really* neat :)
jnavila has quit [Quit: It was time]
AlexDenisov has joined #ocaml
<jeroud> I spent way too long looking for a way to use codecov.io instead, but that would be a lot more work.
<Leonidas> what is better on codecov.io?
<jeroud> Branch coverage, a nicer UI, and useful PR comments.
virtualeyes1 has joined #ocaml
virtualeyes has quit [Ping timeout: 255 seconds]
alfredo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
AlexDenisov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mengu_ has joined #ocaml
Flerex has quit [Read error: Connection reset by peer]
<cheater> Leonidas companion_cube do you guys see the same issue with type errors?
<cheater> i.e. the error location starts on the space before whatever is causing the error rather than on the first letter of the identifier/expression/whatever
mengu has quit [Ping timeout: 258 seconds]
ygrek_ has joined #ocaml
<companion_cube> I don't know, for me vim knows where to jump
<companion_cube> because lines and columns start at 1, no 0
benwbooth has quit [Quit: Textual IRC Client: www.textualapp.com]
<flux> cheater, to see how the column numbers it outputs align with your input..
<cheater> companion_cube: i use vim too
<cheater> companion_cube: but if i go to the column mentioned i get put on the space before the identifier
fraggle-boate has quit [Ping timeout: 245 seconds]
smondet has joined #ocaml
agarwal1975 has joined #ocaml
copy` has joined #ocaml
AlexDenisov has joined #ocaml
jnavila has joined #ocaml
dhil has quit [Ping timeout: 255 seconds]
pierpa has joined #ocaml
orbifx-m has quit [Ping timeout: 240 seconds]
AlexDeni_ has joined #ocaml
dhil has joined #ocaml
AlexDenisov has quit [Read error: Connection reset by peer]
nicoo has quit [Ping timeout: 240 seconds]
nicoo has joined #ocaml
Algebr has joined #ocaml
jnavila has quit [Ping timeout: 252 seconds]
ocaml048 has joined #ocaml
alfredo has joined #ocaml
<ocaml048> I'm a bit confused about working with types in modules matching interfaces. Suppose I have a simple module matching the Floatable signature
<ocaml048> module Discrete : Floatable = struct type t = int let of_float = Pervasives.int_of_float let to_float = Pervasives.float_of_int end
<ocaml048> Now if I try to use the module, for example in a test
<ocaml048> assert_equal 1.0 (Discrete.to_float 1)
<ocaml048> The compiler complains that Discrete.to_float expects a t, not an int
<ocaml048> I've tried declaring t in Discrete with a constructor: type t = Value of int
<ocaml048> but the compiler complains that it does not match the signatuire.
<ocaml048> What am I doing wrong?
<Drup> When you write "Discrete : Floatable", you constraint the type of Discrete to be exactly Floatable
<Drup> however, type t is abstract in Floatable
<Drup> You need to expose the fact that Discrete.t = int explictely: "Discrete: Floatable with type t = int"
octachron has joined #ocaml
<ocaml048> @drup: thanks - that makes sense :-)
<octachron> Drup, do you still have something to add to the compiler Hacking.adoc file?
<Drup> octachron: not at the moment (and I have tons of stuff to do .. :p)
<octachron> Drup, then would you mind closing https://github.com/ocaml/ocaml/pull/751 ?
<Drup> why ?
<octachron> because "An improved version was merged"?
<Drup> done :p
yomimono has quit [Ping timeout: 255 seconds]
ygrek_ has quit [Ping timeout: 252 seconds]
nomicflux has joined #ocaml
<copy`> shon: I have some experience with solvuu-build
Muzer has quit [Ping timeout: 256 seconds]
sz0 has quit [Quit: Connection closed for inactivity]
Xadnem has joined #ocaml
william-s has joined #ocaml
<octachron> First-class modules + GADTs can do really horrifying things to dependency computations:
<octachron> for instance, is the M5 module an external dependency in https://github.com/Octachron/codept/blob/master/tests/cases/riddle.ml#L114 ?
ygrek_ has joined #ocaml
slash^ has quit [Read error: Connection reset by peer]
jao has joined #ocaml
<cheater> "riddle.ml"
<cheater> that sounds like something i shouldn't read
Muzer has joined #ocaml
alfredo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<octachron> cheater, this is more or less a (atrocious) worse case scenario for dependencies computation in OCaml, no something that anyone would write (or read) in normal code
<octachron> ((at least I hope so))
virtualeyes1 has quit [Ping timeout: 240 seconds]
* Drup raises his hand
virtualeyes has joined #ocaml
<Drup> (it was not in "real" software, though)
jnavila has joined #ocaml
<companion_cube> GADTs + first class modules? Oh, I must have both not too far away from one another
<Drup> the thing is, most of the use cases are better solved by (*gasp*) objects
<companion_cube> boarf
<octachron> companion_cube, + opening/including first-class modules without signature annotation, because … reasons?
<companion_cube> ah, that
<companion_cube> not often indeed
<companion_cube> I tend to annotate mos tof my code anyway
kakadu has joined #ocaml
<cheater> octachron: :)
<cheater> octachron: hey have you noticed that the type errors emitted by the compiler start at the wrong column?
<cheater> octachron: so for me, when i get a type error in something like "foo bar" and bar is the wrong type, then the columns mentioned in the type error start at the space before "bar" which seems bizarre
emacs-fb has joined #ocaml
<cheater> octachron: i wonder if that's by design or just an off by one error?
fre has joined #ocaml
<emacs-fb> I came across a situation where a simple OCaml program compiled with ocamlopt works differently than that same program interpreted -- print_string does not print unless manually flushed from OCaml in the compiled version, but prints just fine in the interpreted version.
fre has quit [Read error: No route to host]
<emacs-fb> See ./print_endline.out vs ./print_string.out
AlexDeni_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<emacs-fb> Is this expected? Is there an OCaml buffer I have to flush automatically?
AlexDenisov has joined #ocaml
Xadnem has quit [Quit: leaving]
fre has joined #ocaml
AlexDenisov has quit [Client Quit]
nomicflux has quit [Quit: nomicflux]
AlexDenisov has joined #ocaml
AlexDenisov has quit [Client Quit]
AlexDenisov has joined #ocaml
orbifx has joined #ocaml
AlexDenisov has quit [Client Quit]
AlexDenisov has joined #ocaml
AlexDenisov has quit [Client Quit]
<octachron> cheater, isn't that simply ocaml column count starting at 0 after a new line?
snowcrshd has quit [Read error: Connection reset by peer]
_andre has quit [Quit: leaving]
hcarty has joined #ocaml
<cheater> octachron: hmm
<cheater> octachron: why would it start at 0 though?
<octachron> emacs-fb, input/outputs through Pervasives.*channel are indeed buffered and you may need to flush with "Pervasives.flush output_channel"
<octachron> cheater, because 0 is the first ordinal?
<cheater> nope octachron it doesn't start at 0
<cheater> because the right end of the range is where it should be
<cheater> so if my line is
<cheater> foo bar
<cheater> and bar is wrong
<cheater> it'll say columns 4-7
<emacs-fb> octachron: I don't need to do that when running with `ocaml print_string.ml` or even `ocamlopt print_string.ml; ./a.out` -- why is this?
<cheater> so starting with the space and ending with r
orbifx has quit [Ping timeout: 240 seconds]
mengu_ has quit [Remote host closed the connection]
<lyxia> If you assume it starts at 0, then it's the end of the range which is one column past the actual end of the range, while the start is at the right place.
<octachron> not if the range is right exclusive: [4,7)
<lyxia> that too
<cheater> octachron: ....... :)
<lyxia> isn't it a pretty common convention in fact?
<cheater> well, it seems to be doing what octachron said
<cheater> so for example this...
<cheater> Arg.parse 2 (fun str -> ()) "UsageMsg"
<cheater> says the error is:
<cheater> File "my_prog.ml", line 5, characters 12-13:
<cheater> "2" is just one character
<cheater> but..
<cheater> 1. it's confusing 2. you never start counting columns with 0 in text editing
<Drup> cheater: just in case this wasn't clear: your setup/editor is wrong, ocaml isn't.
<cheater> how is vim wrong in counting columns
<Drup> ocaml follow the same convention than C compilers and error messages works perfectly fine under emacs and various other editors, draw the conclusion you want from that. :)
AltGr has left #ocaml [#ocaml]
<cheater> do c compilers use the same convention?
<cheater> i didn't know that
fre has quit [Read error: No route to host]
<cheater> also i noticed that emacs starts counting at 0 too
<cheater> nano starts at 1
<cheater> other stuff... is of less significance
<cheater> OK now i understand why ocaml reports errors like this :)
<cheater> thanks :)
<Drup> your ocaml mode for vim should handle that stuff correctly, anyway
<cheater> i don't use an ocaml mode
<cheater> i just type make in bash
<cheater> and go to the line and column by hand
<cheater> works well enough for me
<Drup> You like loosing time in counting columns ? ^^'
fre has joined #ocaml
<companion_cube> :/
fre has quit [Read error: Connection reset by peer]
<companion_cube> cheater: you didn't even install merlin?
leah2 has quit [Ping timeout: 255 seconds]
<octachron> emacs-fb, both works for me (since the implicit exit is flushing still-open channel )
<companion_cube> merlin + syntastic + ocp-indent = happyness
<emacs-fb> octachron: Both which?
<emacs-fb> & what platform are you on?
orbifx-m has joined #ocaml
<octachron> emacs-fb, print_string (print_endline always flush) on linux
<octachron> with either ocamlc or ocaml
<emacs-fb> octachron: Using the GitHub Gist or via one of: `ocaml print_string.ml`, `ocamlopt print_string.ml; ./a.out`? The latter two work for me and the Gist does not. I am running OS X.
virtualeyes1 has joined #ocaml
virtualeyes has quit [Ping timeout: 240 seconds]
fre has joined #ocaml
<emacs-fb> The Gist being compiling to an object file then running from a C program.
<emacs-fb> afk for lunch
virtualeyes1 is now known as nullremains
fre has quit [Read error: No route to host]
tg has quit [Excess Flood]
tg has joined #ocaml
emacs-fb has quit [Ping timeout: 240 seconds]
jfntn has quit [Remote host closed the connection]
dhil has quit [Ping timeout: 240 seconds]
MercurialAlchemi has quit [Ping timeout: 255 seconds]
leah2 has joined #ocaml
emacs-fb has joined #ocaml
APNG is now known as CTCP-S
orbifx-m has quit [Ping timeout: 240 seconds]
orbifx has joined #ocaml
<octachron> emacs-fb, just to be sure, you obtain different results with your C file when linking with the bytecode or native runtime?
<emacs-fb> octachron: I obtain different results between: A) compiling to a .o then linking with the aforementioned C file B) ocamlopt print_string.ml; ./a.out
jmiven has quit [Quit: co'o]
<octachron> emacs-fb, this sounds normal: when linking with the C code, there is no implicit call to ocaml exit function
jmiven has joined #ocaml
<emacs-fb> octachron: that does not happen inside ocaml_run?
fre has joined #ocaml
<octachron> emacs-fb, I don't think so: caml_main only performs some initialization, then the control flow is in the hand of the C program
<emacs-fb> Hm, ok. What is the name of the exit function?
ocaml048 has quit [Ping timeout: 260 seconds]
philtor has quit [Remote host closed the connection]
<octachron> emacs-fb, would it not be easier to simply flush this channel?
<emacs-fb> It's certainly easier but I am curious how to get the same behavior with the same OCaml code
<emacs-fb> This was a "bug" reported in a channel I'm in
<hcarty> emacs-fb: I think it's caml_sys_exit or something similar
<hcarty> Which will exit the entire program
<hcarty> https://github.com/ocaml/ocaml/pull/71, if it gets merged, may make this simpler/cleaner
<emacs-fb> hcarty: Called that -- didn't print the string :-/
<hcarty> In that case it may require a manual call to flush the buffered output
<emacs-fb> Welp.
<emacs-fb> Can do.
fre has quit [Ping timeout: 240 seconds]
mengu has joined #ocaml
jnavila has quit [Remote host closed the connection]
<hcarty> emacs-fb: Looks like caml_sys_exit(foo) doesn't do much beyond calling exit(foo)
<hcarty> So maybe it's not doing much cleanup
nullremains has quit [Ping timeout: 255 seconds]
fre has joined #ocaml
virtualeyes has joined #ocaml
agarwal1975 has quit [Quit: agarwal1975]
fre has quit [Read error: No route to host]
<cheater> companion_cube: no, why would i use merlin? what does it give me?
<thizanne> !merlin
<companion_cube> weeeeeeeell completion, type inference, doc, jump-to-def
<thizanne> wait how can i say that to cheater
<thizanne> !merlin cheater
<thizanne> feature request.
fre has joined #ocaml
emacs-fb has quit [Quit: leaving]
fre has quit [Read error: Connection reset by peer]
<octachron> cheater, (much) shorter error feedback
<companion_cube> thizanne: ?
virtualeyes has quit [Ping timeout: 240 seconds]
<companion_cube> !merlin > cheater
<thizanne> !thanks |> companion_cube
<cheater> ok merlin looks pretty cool
<cheater> i shall shave that yak sometime in the near future
kakadu has quit [Remote host closed the connection]
virtualeyes has joined #ocaml
average has quit [Quit: leaving]
average has joined #ocaml
fre has joined #ocaml
xyproto has joined #ocaml
AlexDenisov has joined #ocaml
fre has quit [Ping timeout: 248 seconds]
average has quit [Ping timeout: 245 seconds]
average has joined #ocaml
AlexDeni_ has joined #ocaml
AlexDenisov has quit [Ping timeout: 255 seconds]
sh0t has quit [Remote host closed the connection]
pierpa has quit [Ping timeout: 240 seconds]
virtualeyes has quit [Ping timeout: 258 seconds]
ocabot_ has quit [Remote host closed the connection]
ocabot_ has joined #ocaml
CTCP-S is now known as Go-use-CTCP-S
smondet has quit [Ping timeout: 240 seconds]
virtualeyes has joined #ocaml
silver has quit [Read error: Connection reset by peer]
AlexDeni_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
AlexDenisov has joined #ocaml
AlexDenisov has quit [Client Quit]
AlexDenisov has joined #ocaml
AlexDenisov has quit [Client Quit]
Simn has quit [Quit: Leaving]
hcarty has quit [Quit: WeeChat 1.5]
octachron has quit [Quit: Leaving]
isd has quit [Ping timeout: 260 seconds]
shinnya has joined #ocaml