ChanServ changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml 4.02.1 announcement at http://ocaml.org/releases/4.02.html | Public channel logs at http://irclog.whitequark.org/ocaml
Trin00 has quit [Remote host closed the connection]
nojb has joined #ocaml
rgrinberg has joined #ocaml
jao has joined #ocaml
jao has quit [Changing host]
jao has joined #ocaml
SomeDamnBody has quit [Ping timeout: 256 seconds]
thomasga has quit [Quit: Leaving.]
nojb has left #ocaml [#ocaml]
thomasga has joined #ocaml
madroach has quit [Ping timeout: 250 seconds]
madroach has joined #ocaml
<rgrinberg> Drup: how are the docs on ocsigen.org generated?
<Drup> ahah.
<Drup> It's a thing called wikidoc that uses ocamldoc and generate wiki creole markdown
<Drup> and then it's rendered by ocsimore
<rgrinberg> sounds complicated
<Drup> yes >_>
<Drup> and fragile
<rgrinberg> i thought ocsimore is a wiki? you can't edit anything on it
<rgrinberg> i mean in the ocsigen docs
thomasga has quit [Quit: Leaving.]
<Drup> *you* can't.
<rgrinberg> I see. Hmm I thought about whether it would be possible to adopt something like that for myself
<rgrinberg> but tbh i like ocaml.org style a lot more
<rgrinberg> everything is static and contributions are done through github
<Drup> if you want my opinion, go the static route
<rgrinberg> yes I'd like to create a small site for opium with docs and a few examples
<Drup> except if you want to showcase opium, of course
<rgrinberg> something simple, as automatic as possible, and pure ocaml
<rgrinberg> nah, serving static content can be done in anything there's no point
<rgrinberg> besides all the hard work is in cohttp anyway
<rgrinberg> i was thinking stog + somehow adopting ocsigen's ocamldoc extraction mechanism
<Drup> rgrinberg: don't use the ocsigen thing
<rgrinberg> :/ too bad
<Drup> It's broken in various ways, it uses some wikicreol syntax that matkes me cringe horrible
<rgrinberg> yeah that sounds strange. why not normal markdown?
<rgrinberg> we even have omd for that now
<Drup> rgrinberg: you do realize how old the ocsigen project is ? ^^'
<rgrinberg> i keep forgetting...
<Drup> anyway
<Drup> rgrinberg: did you actually look at stog or are you following popular believe that it's a nice blog generator in OCaml ? ^^'
<rgrinberg> i know the xml is horrible
<rgrinberg> but my impression was that it was flexible
<Drup> yeah ... sort of .. not really.
<Drup> let's say I don't agree with its design choice. :)
<rgrinberg> it certainly seems a little complex. have you used it?
<Drup> I investigate writing a plugin for it
<Drup> then I realized that the onnly way to plug something, was in the core xml syntax by a series of acrobatic hooks
<Drup> and the xml syntax is so deeply integrated in the rewriting engine that you can't really use the flexibility with anything else
<rgrinberg> so sad
<rgrinberg> the author seems like a smart guy too
<Drup> (and the code, oh my ... I don't want to see that again)
<rgrinberg> maybe usability isn't his thing
<Drup> rgrinberg: if you are motivated, https://github.com/Drup/cowabloga/tree/tyxml
<Drup> I started a rewrite, It's quite near completion, but I stoped working on it, for independent reasons
<rgrinberg> tyxml branch?
<Drup> yes
<Drup> It can generate static content and it only ask for "something that generates tyxml"
<rgrinberg> ah
<rgrinberg> yeah i'll check that out. how's the original cowabloga?
<Drup> not using tyxml :D
<Drup> the original cowabloga is mostly "the bunch of script powering mirage.org extracted"
<rgrinberg> :) brb
<Drup> It's very simple, it's written correctly, but it's not really organized/documented/though to be used for something else
<Drup> I rewrote most of it
<Drup> rgrinberg: The things that remains is mostly to plug in lambdoc.
<Drup> and, let me push the stuff I have sitting here
rgrinberg has quit [Quit: Leaving.]
bytbox has quit [Read error: Connection reset by peer]
bytbox has joined #ocaml
bytbox has quit [Ping timeout: 244 seconds]
bytbox has joined #ocaml
jao has quit [Ping timeout: 244 seconds]
manud__ has joined #ocaml
nadako has quit [Quit: Leaving]
rgrinberg has joined #ocaml
BitPuffin has quit [Ping timeout: 240 seconds]
struktured has joined #ocaml
jhaberstro has quit [Quit: jhaberstro]
WraithM has joined #ocaml
darkf has joined #ocaml
samrat has joined #ocaml
samrat has quit [Client Quit]
as has joined #ocaml
|jbrown| has quit [Remote host closed the connection]
as has quit [Quit: Leaving]
jhaberstro has joined #ocaml
rgrinberg has quit [Quit: Leaving.]
struktured has quit [Ping timeout: 258 seconds]
WraithM has quit [Quit: leaving]
struktured has joined #ocaml
manud__ has quit [Quit: Be back later ...]
AlexRussia has quit [Ping timeout: 240 seconds]
manud__ has joined #ocaml
manud__ has quit [Ping timeout: 240 seconds]
samrat has joined #ocaml
struktured has quit [Ping timeout: 258 seconds]
struktured has joined #ocaml
AlexRussia has joined #ocaml
rgrinberg has joined #ocaml
q66 has quit [Quit: Leaving]
jhaberstro has quit [Ping timeout: 256 seconds]
jhaberstro has joined #ocaml
manud__ has joined #ocaml
AlexRussia has quit [Ping timeout: 240 seconds]
AlexRussia has joined #ocaml
manud__ has quit [Ping timeout: 264 seconds]
rgrinberg has quit [Quit: Leaving.]
manud__ has joined #ocaml
manud__ has quit [Quit: Be back later ...]
expo873 has quit [Quit: Connection closed for inactivity]
mcclurmc has quit [Remote host closed the connection]
Whitticker has quit [Ping timeout: 240 seconds]
demonimin has quit [Ping timeout: 265 seconds]
milosn has joined #ocaml
mcclurmc has joined #ocaml
pyon has joined #ocaml
pyon is now known as pyon-faithful
mcclurmc has quit [Ping timeout: 252 seconds]
joncfoo has joined #ocaml
boogie has joined #ocaml
matason has joined #ocaml
manud__ has joined #ocaml
Submarine has joined #ocaml
Submarine has joined #ocaml
kakadu has joined #ocaml
mcclurmc has joined #ocaml
ygrek has joined #ocaml
mcclurmc has quit [Ping timeout: 244 seconds]
boogie has quit [Remote host closed the connection]
slash^ has joined #ocaml
MercurialAlchemi has joined #ocaml
joncfoo has quit [Ping timeout: 240 seconds]
samrat has quit [Quit: [Textual IRC Client: http://www.textualapp.com/]]
demonimin has joined #ocaml
matason has quit [Quit: Leaving...]
jhaberstro has quit [Read error: Connection reset by peer]
jhaberstro has joined #ocaml
matason has joined #ocaml
mk270 has quit [Remote host closed the connection]
zump has joined #ocaml
<zump> I installed the core and utop as required by the real world ocaml tutorial. Now when I go into ocaml REPL, i type "3+10;;" and it just hangs.. WTF?
<kakadu> Does it hang without utop?
<kakadu> run 'ocaml' and do the same there
<zump> kakadu: im doing it in ocaml
<zump> in utop it works
<kakadu> em.... very strange issue
<kakadu> which ocaml version?
<kakadu> maybe https://github.com/ocaml/camlp4/issues/48 is related somehow
<zump> $ ocaml -version The OCaml toplevel, version 4.02.1
<zump> so camlp4 is broken (whatever it is..)
<kakadu> Did you install OCaml using opam?
<kakadu> It seems it works for me
<kakadu> cat ~/.ocamlinit
<kakadu> zump: ^^
<zump> I installed it from a PPA
<kakadu> You can create dummy(empty) init file and pass it to 'ocaml -init myinit'
<kakadu> and test it there
<kakadu> and after that you can add some lines to new init file
<kakadu> to check which line of your init file causes a problem
<zump> i upgraded camlp4 from github and it workes now
<zump> now i get a bunch of crap about "disagree over interface" argh (expected i guess)
AlexRussia has quit [Ping timeout: 245 seconds]
<kakadu> I strongly recommned you to recompile OCaml using opam with command 'opam switch 4.02.1', AFAIR
ygrek has quit [Ping timeout: 256 seconds]
<zump> then i can install camlp4 from OPAM?
OnkV is now known as Haudegen
<kakadu> yes, and core too
Haudegen is now known as Guest8468
Guest8468 is now known as Haudegen
lewis1711 has joined #ocaml
jhaberstro has quit [Quit: jhaberstro]
<lewis1711> been trying to get ocaml set up for the past few hours. a lot of compiling has happened, but I still cant get ctypes working
<lewis1711> The dependency base-bytes of package ctypes.0.3.3 is not available for your compiler or your OS.
<lewis1711> 'opam install ctypes' failed.
<kakadu> which ocaml version?
<lewis1711> 4.02.0
<kakadu> It's better to switch to next bugfix release 4.02.1 btw
<lewis1711> fair enough
ygrek has joined #ocaml
pyon-faithful is now known as pyon-free
kapil__ has joined #ocaml
<kakadu> It installs ctypes for me
<kakadu> maybe your opam repe is not updated? 'opam update'
<kakadu> repo*
<lewis1711> kakadu: It errored out on opam update, with quite a few of them
<lewis1711> I managed to install ctypes after I switched to 4.02.1 as suggested
<kakadu> So, let's say that problem fixed? :)
<lewis1711> not sure. installing utop and core now
thomasga has joined #ocaml
milosn has quit [Remote host closed the connection]
AlexRussia has joined #ocaml
pyon-free is now known as pyon-cofree
<lewis1711> I don't understand why opam installs ocamlfind again and again
<lewis1711> every second command it's re-installing ocamlfind
<kakadu> sounds weird
<kakadu> maybe you forgot to do eval `opam config env`
<kakadu> need to see some your output, anyway
<lewis1711> do I need to do that every time before I do anything opam?
<lewis1711> if so that explains a lot
Simn has joined #ocaml
<kakadu> You should do it once at the beginning of shell session
<kakadu> I have put this into ~/.zshrc
<lewis1711> I've kept the same terminal open
<lewis1711> I thought that getting opan gives you the option to to put into your .bashrc or zshrc or whatever, but I just checked what was in there
<lewis1711> eval `opam config env` wasn't, so I added it in
<kakadu> It's easier to me to make alias for this called 'evalopam' and exec when I need it
<lewis1711> the ctypes module looks really nice. main reason I want to give ocaml a shot.
<kakadu> maybe
<kakadu> Do you know if that allow you to call methods of C++ classes?
<lewis1711> hmm I haven't checke
ygrek has quit [Ping timeout: 240 seconds]
<lewis1711> things seem to be working finally. thanks for the tips kakadu
ygrek has joined #ocaml
<kakadu> sya
<kakadu> cya*
<lewis1711> wow utop is really sluggish sometimes. took about 2 seconds to return the prompt after I wrote "true;;". I wonder if it's trying to compile to machine code instead of using the bytecode VM
milosn has joined #ocaml
<kakadu> Don't think so
<kakadu> you need ocaml native toplevel for that
<kakadu> I prefer just 'rlwrap ocaml' btw
jhaberstro has joined #ocaml
<nicoo> lewis1711: This is very surprising. Do you have Core-related things automagically loaded?
<kakadu> nicoo: very likely
<lewis1711> nicoo: yes I do. is that the issue?
<lewis1711> pretty much been following real world ocaml, unless I came across problems
davine has joined #ocaml
<kakadu> I think that even with core it should not work so long
<nicoo> lewis1711: Well, I never read RWO, but Core isn't really known for being lightweight. Even then, it seems long
<lewis1711> it's long the first time I declare a type
<lewis1711> then after subsequent invocations, it's fast
tane has joined #ocaml
<nicoo> 'kay. Strange
<lewis1711> just did a count in my head, about 4 seconds on a fresh utop session to evaluate "true"
<lewis1711> (unremarkable 4*1.8ghz laptop, 4gb ram)
<kakadu> what is in your ~/.ocamlinit ?
<zump> hey lewis1711 i found that its really slow in the first command entered..
ygrek_ has joined #ocaml
ygrek has quit [Remote host closed the connection]
<kakadu> It seems it loads modules lazily..........
<lewis1711> hmmm it will straight up freeze on bad syntax
<lewis1711> might just stick to rlwrap ocaml
<zump> whats rlwrap ocaml
<lewis1711> I'm sure I remember it being faster and less buggy last time I installed it a few months back.
<lewis1711> something probably went wrong with the voodoo of opam
<lewis1711> too tired now
<kakadu> maybe we should report it
<lewis1711> kakadu: it's probably my fault. got impatient and opam is fussy
<kakadu> While your were hacking opam I have had hard time with compiling popcorn-time
<kakadu> this npm stuff is weird
<kakadu> I execute command, it returns 1 and prints nothing
<zump> Does anyone like FRAMA C
<kakadu> I don't know anything how to debug it
<kakadu> That's why I think that opam is fine :)
<Drup> the initial sluginesh of utop is known, but I don't know the cause
<Drup> kakadu: no C++ with ctypes
<Drup> lewis1711: are you using aspcud ?
<lewis1711> Drup: no clue. I'll install it. (couldn't get it working on arch if you remember me from a few hours ago btw, using an ubuntu partition)
<Drup> yeah, use aspcud, it's much better with it
<lewis1711> how do you mean "use"?
<lewis1711> I mean it's installed now
<Drup> opam will use it automatically if it's installed
<lewis1711> hmmm, still chokes on "utop # List.map [1; 2] (* 3);;"
<lewis1711> will I need to reinstall utop?
<kakadu> I don't think that aspcud is related to utop issues
<Drup> no, it was releated to the "install ocamlfind all over again"
<lewis1711> ahh
manud__ has quit [Quit: Be back later ...]
ygrek_ has quit [Remote host closed the connection]
ygrek has joined #ocaml
<zump> lewis1711: wtf! Just tried that code and utop just hangs..??
<kakadu> It doesn't
<kakadu> is sees comments and waits for the end of comments
<pyon-cofree> The types "type 'a foo = <head: 'a; tail: 'b> as 'b;;" and "type
<pyon-cofree> And "type 'a bar = <head: 'a; tail: <head: 'a; tail: 'b> > as 'b" are the same, right?
<lewis1711> kakadu: don't know why I didn't think of that. I think F# had some syntax sugar where you could do a similar expression and I was messing around
zump has quit [Quit: Page closed]
ygrek has quit [Ping timeout: 258 seconds]
zwer has quit [Remote host closed the connection]
zwer has joined #ocaml
<kakadu> You can also can give a show ocaml-top
<kakadu> s/show/shot/
BitPuffin has joined #ocaml
ygrek has joined #ocaml
lewis1711 has quit [Quit: Konversation terminated!]
Submarine has quit [Quit: Leaving]
nadako has joined #ocaml
ggole has joined #ocaml
jhaberstro has quit [Quit: jhaberstro]
mk270 has joined #ocaml
mk270 has quit [Ping timeout: 240 seconds]
mk270 has joined #ocaml
davine has quit [Quit: Leaving]
huza has joined #ocaml
rand000 has joined #ocaml
Whitticker has joined #ocaml
jbrown has joined #ocaml
AlexRussia has quit [Ping timeout: 250 seconds]
AlexRussia has joined #ocaml
chambart has joined #ocaml
kakadu has quit [Quit: Konversation terminated!]
kakadu has joined #ocaml
keen____ has joined #ocaml
BitPuffin has quit [Ping timeout: 250 seconds]
keen___ has quit [Ping timeout: 258 seconds]
pyon-cofree is now known as pyon
ChristopheT has joined #ocaml
davine has joined #ocaml
huza has quit [Ping timeout: 264 seconds]
chambart has quit [Ping timeout: 256 seconds]
mcclurmc has joined #ocaml
dav_ has joined #ocaml
dav has quit [Ping timeout: 255 seconds]
mcclurmc has quit [Ping timeout: 265 seconds]
milosn has quit [Quit: Lost terminal]
chambart has joined #ocaml
<MercurialAlchemi> I'd like to randomly praise 'opam pin'
<MercurialAlchemi> that's really awesome
chambart has quit [Ping timeout: 244 seconds]
chambart has joined #ocaml
thomasga has quit [Quit: Leaving.]
chambart has quit [Ping timeout: 245 seconds]
q66 has joined #ocaml
_5kg has quit [Ping timeout: 255 seconds]
<hannes> how would I hook custom actions to lambda-terms readline functionality? (I'd like to consume some key presses for other actions than shell stuff)
<Drup> hannes: you create a class than inherites the readline widget and overwrite the right class
<Drup> the right method*
<hannes> Drup: aha.. thanks! you're aware of some concrete code samples on the internetz?
<Drup> hannes: there are examples in lambda-term sources, I think
<hannes> yeah... I'm that far already.. will dig further, thx!
kapil__ has quit [Quit: Connection closed for inactivity]
<hannes> ah, there's even a `bind` provided by lTerm_read_line.mli
darkf has quit [Quit: Leaving]
lu324___ has joined #ocaml
lu324__ has quit [Ping timeout: 244 seconds]
expo873 has joined #ocaml
lordkryss has joined #ocaml
pgomes has joined #ocaml
_5kg has joined #ocaml
BitPuffin has joined #ocaml
<MercurialAlchemi> I need to tell OCaml to tell when a given float is equivalent to an integer (eg, 1.)
<adrien> epsilon
<adrien> val epsilon_float : float
<adrien> The difference between 1.0 and the smallest exactly representable
<adrien> floating-point number greater than 1.0 .
<ggole> MercurialAlchemi: fst (modf x) = 0.0, maybe
<MercurialAlchemi> mm
<MercurialAlchemi> <= works
<MercurialAlchemi> (well, = is there for safety reason, and I have to combine it with abs_float)
<struktured> ggole: isn't that kind of expesenive though?
<ggole> What do you propose?
<adrien> MercurialAlchemi: which precision do you need/want?
<MercurialAlchemi> adrien: technically? the same precision that %F uses to decide when X.Y should be printed as X.
<MercurialAlchemi> in practice, modf x |> fst |> abs_float <= epsilon_float should work, I think
<struktured> ggole: let equal_precision ~epsilon a b = abs_float (a-.b) < epsilon
<ggole> That is an equality test. Not an "is-integral" test.
<struktured> ggole: yeah but use that with floor function of the value and the original value, and epsilon = episolon_float. then its not doing any mod arithmetic
<ggole> I don't think that will actually work on large values, though.
<struktured> ggole: what becomes inaccurate as the values become large?
<ggole> let test x = equal_precision epsilon_float x (floor x)
<ggole> test 1000000000000.000001;; - : bool = true
<ggole> Hmm, but maybe that's actually integral.
<MercurialAlchemi> ggole: modf is just as unhappy with this one
<MercurialAlchemi> modf 1000000000000.000001 |> fst < epsilon_float;;
<MercurialAlchemi> - : bool = true
<ggole> Yeah
<struktured> is that hitting epsilon_float barrier?
<ggole> I think this is in the range where n + eps = n
<mrvn> epsilon_float should only work for testing for 1
<mrvn> let equal x y = abs ((x -. y) /. x) <= epsilon_float? or <= 2 * epsilon_float to be more forgiving
<MercurialAlchemi> well, the problem is that it is too forgiving for large values
<MercurialAlchemi> but it's probably an issue with float representation anyway
<mrvn> MercurialAlchemi: No, it is normalized by the /. x
<mrvn> The above should check if there is any other float number z with x < z < y
<mrvn> (or x > z > y)
<MercurialAlchemi> let f = 1000000000000.000001;;
<MercurialAlchemi> equal f (floor f);;
<MercurialAlchemi> - : bool = true
AlexRussia has quit [Ping timeout: 240 seconds]
<MercurialAlchemi> (after s/abs/abs_float)
<ggole> That's because 1000000000000.000001 is actually 1000000000000.0
<ggole> It's truncated
<MercurialAlchemi> well, that's what I was saying
AlexRussia has joined #ocaml
<ggole> This doesn't have anything to do with the equality test, though.
<mrvn> # 1000000000000.000001 -. 1000000000000.;;
<mrvn> - : float = 0.
<MercurialAlchemi> no amount of trickery will help when you don't have the right data
<mrvn> 1000000000000.000001 is the closest float to 1000000000000
AlexRussia has quit [Client Quit]
<ggole> If you want that to work, you'll have to use ratios.
<MercurialAlchemi> that's out of scope
AlexRussia has joined #ocaml
<mrvn> # equal 1000000000000. 1000000000000.001;;
<mrvn> - : bool = false
<mrvn> # equal 1000000000000. 1000000000000.0001;;
<mrvn> - : bool = true
<struktured> ggole: to prove my point about speed.. https://gist.github.com/struktured/fb6045468027e2c23c8b
<ggole> Sure, modf is pretty slow
<whitequark> ugh, floats
<adrien> clock_gettime!
AlexRussia has quit [Ping timeout: 250 seconds]
<adrien> struktured: how many iterations in your benchmark?
<adrien> according to your result, modf would require 30us
<adrien> that's unbelievable
<struktured> adrien: you are correct actually if I do 100 iterations they both even out to zero
<whitequark> 100?
<whitequark> for modf?
<whitequark> how about 100k
<struktured> whitequark: ok, .34 vs .24 using Sys.time which is probably not idea
<struktured> *ideal
<adrien> Sys.time is fin if you have many iterations
<adrien> Unix.gettimeofday can be better
<adrien> best would be clock_gettime() but that's not in Unix
<adrien> I'm wondering which are the platforms which ocaml supports and which don't have clock_gettime
<adrien> windows has it in 3rd party libs
larhat has quit [Quit: Leaving.]
chambart has joined #ocaml
struktured has quit [Ping timeout: 258 seconds]
chambart has quit [Ping timeout: 264 seconds]
struktured has joined #ocaml
_5kg has quit [Ping timeout: 245 seconds]
tharugrim has quit [Ping timeout: 256 seconds]
tharugrim has joined #ocaml
ygrek has quit [Ping timeout: 264 seconds]
chambart has joined #ocaml
lu324___ is now known as lu324
AlexRussia has joined #ocaml
lordkryss has quit [Ping timeout: 258 seconds]
oscar_toro has quit [Ping timeout: 258 seconds]
lordkryss has joined #ocaml
Whitticker has quit [Ping timeout: 258 seconds]
Whitticker has joined #ocaml
_5kg has joined #ocaml
<whitequark> I want this for ocaml.
milosn has joined #ocaml
<struktured> whitequark: what would if-lets sig look like in ocaml ?
<whitequark> sig?
<struktured> whitequark: just want to understand that if-let syntax. what is semantically doing?
<mrvn> what if-let syntax?
<whitequark> see link above
<ggole> Isn't that just a nested match?
<ggole> | ExprWhile (ExprLit (LitBool true), _, _) -> ...
<whitequark> struktured: "if let p = e then x" ≡ "match e with p -> x | _ -> ()"
<struktured> whitequark: ah I see, thanks.
<gasche> indeed, it looks like a nested match in this case
<gasche> and the nested match is more readable
<ggole> I wonder if the "ref" is problematic
<gasche> but still "if let" is not a bad idea
<mrvn> or: try let p = e in x with Match_error -> ()
<whitequark> yes, I think it is in the same domain as "match with exception"
<gasche> well (ref p) should be a pattern in OCaml, equivalent to {contents = p}
<ggole> That would be nice. We have lazy patterns, refs are probably more common.
<whitequark> is ref a keyword?
<gasche> on the other hand, beginners that write "let ref x = 1" would scream to death about the error messages
<ggole> No.
<whitequark> so it can't be a pattern
<ggole> It's just a function let ref contents = { contents }
<gasche> this syntax used to work in Caml light, which had mutable constructor arguments
<gasche> (but we're probably better off without them still)
<ggole> Er, doesn't 4.03 add those?
BitPuffin has quit [Ping timeout: 264 seconds]
<ggole> Unless there's some distinction.
<gasche> only in named argument positions, which doesn't allow you to implement "ref" as it was in Caml Light
<whitequark> not for regular constructors
<gasche> basically (type 'a ref = ref of mutable 'a)
<ggole> Ah.
expo873 has quit [Quit: Connection closed for inactivity]
<gasche> and people would write stuff like (match foo with ref x -> (x <- x + 1)), the horror
<ggole> That's a bit off-putting.
<gasche> on the other hand whitequark
<gasche> beginners complain about the if-without-else when they write a rhs with type other than unit
<gasche> if-let would have the same problem
thomasga has joined #ocaml
<whitequark> sure
<gasche> also a better expansion would be
<gasche> match ... with ... -> ... | _ -> default
<gasche> with
<gasche> class Default a where default :: a
<ggole> Is that actually better?
<whitequark> mmmm, assuming implicits get merged
<gasche> ggole: it's better as soon as you use monads rather than the unit type
<whitequark> PR6685
<ggole> I'm more concerned about what happens to ordinary values
<ggole> Somebody adds a Default instance for Int and all of a sudden there are magic zeros in your program.
<ggole> It's probably very convenient, but blargh.
<gasche> hm
<gasche> alternatively, you could have (return ()) be the default case
<Drup> whitequark: not 666 :(
<gasche> (or (pure ()), whatever)
<ggole> Wouldn't that fail to unify with regular ()?
<ggole> I guess that wouldn't matter if you were all-monads-all-the-time.
<Drup> whitequark: if let sounds easy to do with a ppx, but meh
<whitequark> it does not, surely
BitPuffin has joined #ocaml
<Drup> ?
<whitequark> well, maybe if [%let? patt] = x then, but this is really ugly
<Drup> yes, that's what I was thinking
<gasche> ggole: the type-checker would have to be smart enough to see that (Monad m => m unit) unifies with (unit) for the identity monad
<Drup> hence "meh"
<Drup> easy, but meh.
<ggole> You can add syntax until the cows come home, really.
<gasche> ? was added to ppx when I mentioned the use-case of rwjones's pa_matches syntax extension
<ggole> I've wanted if x = Foo (_, 1) then ... a few times.
<gasche> if [%matches? p] e then ... else ..
<Drup> gasche: yes, I was thinking about that too.
<gasche> this is almost reasonable because it is a local transformation
<whitequark> oh, that's not bad
<ggole> Mmm, that might be nicer than if (match x with Foo (_, 1) -> true | _ -> false) then ...
<gasche> whereas if-let adds an environment to the then-case, making it a primitive construct
<gasche> (on the other hand of course naming thing is one of the strengths of if-let compared to matches?)
<SuperNoeMan> Unhammer: oh ok. Does ocsigen eliom facilitate construction of RPC mechanisms? I have things thing where I want to be able to call a function from another language or machine
<mrvn> you don't just want to see if it matches but also use the match.
<SuperNoeMan> I've got the part about data serialization-I am using piqi, which compiles to protobuf
<SuperNoeMan> But right now, I'm sort of... selecting the function by manually writing on the RPC server side what functions are available and selecting them with an integer
<whitequark> should I write ppx_matches?..
<Drup> No
<gasche> whitequark: I think it's a bad idea if the pattern variables are bound in the "then" case
<whitequark> gasche: I don't think they would be
<gasche> then feel free to
<ggole> You would disallow variables, surely
<whitequark> (and it's easy to make them not to?)
<Drup> It sounds easy to make them not to, yeah
<Drup> my "opposition" is sort of different
<gasche> well
<Drup> the same I have about ppx_type_notrec
<gasche> [%matches? p] should expand to (function p -> true | _ -> false)
<gasche> also, after looking at the occurences of "_ -> ()" in some codebase, I have a suggestion that I prefer over if..let
<gasche> match .. with default -> ... | ...
<Drup> I don't feel like such comodities should be a macro
<whitequark> gasche: default isn't a keyword I think?
<gasche> (the problem is "default" which is a valid identifier, and I don't think "_" is a good idea)
<companion_cube> o/
<Drup> SuperNoeMan: RPC inside your eliom program is handle almost transparently
<gasche> in particular (if let p = e then foo) would be (match e with default -> () | p -> e)
<gasche> but this also handles multi-case matches and non-unit types
<gasche> it just follows the "shorter case first" principle for pattern-matching
<Drup> SuperNoeMan: do you want something else ?
<gasche> (it's really tempting to use "_" instead of "default" but also a bad idea I think)
<ggole> gasche: what's the difference between default and _, exactly?
<gasche> default means "at the end I'm _"
<gasche> but it comes first
<gasche> so it gives better code in the cases where the default case is much shorter than the other
<gasche> in particular, you can write it on the same line as "with", with a "|" before
<ggole> Hrm, I see
<gasche> s/with/without/
Hannibal_Smith has joined #ocaml
Whitticker has quit [Quit: Leaving]
<gasche> y lies madness)
Thooms has joined #ocaml
<gasche> (another way to do this would be to specify that more-specific patterns are always tested first, with a top-to-bottom order only on incomparable patterns, but this wa
<companion_cube> btw gasche, maybe you know: is there something in the compiler to check whether a type is recursive?
<ggole> One of the earlier pattern matching languages did that IIRC
<gasche> I'm not sure what you mean
<gasche> do you have some context, companion_cube?
<gasche> whitequark: what do you think of "with default" vs. "if let" ?
romildo has joined #ocaml
<companion_cube> gasche: many ppx_deriving instances need to know, when generating a function for a type t, whether t is recursive
<companion_cube> because the function will be recursive or not as well
<gasche> can't you make it recursive each time?
<companion_cube> it's ugly (warning 39) and no, not in my case, I have specific combinators for fixpoints
<companion_cube> currently I use a hack :>
<companion_cube> if you're interested, I write ppx_deriving_cconv
<gasche> so I don't know; and I suspect it would be at the typedtree level anyway, while I suppose you work on asttree
<gasche> cconv?
<companion_cube> I work on parsetree, indeed
<companion_cube> the "universal conversion" thingie
<whitequark> gasche: "with default" would be very nice
<whitequark> but I think the keyword thign makes it problematic
<gasche> what about
<gasche> (match e with -> e_default | ...)?
igstan has joined #ocaml
igstan has quit [Client Quit]
<gasche> (I feel dirty)
<Drup> is there a reason not [%default] ?
oscar_toro has joined #ocaml
<whitequark> ew
<gasche> I suspect the keystrokes are expansive here
<gasche> *expensive
<whitequark> [%default], huh
<Drup> gasche: [%default] is probably less keystrokes on average than e_default
<gasche> not for () at least
<Drup> not even talking about the cases where you match on an expression, not an identifier
<gasche> if the default-case rhs is so large, it *should* go at the end of the matching
<Drup> (or I don't understand what you mean by "e_default"
<gasche> any expression
<Drup> Oh.
<gasche> (if let <p> = <e> then <e'>) => (match <e> with -> () | <p> -> <e'>)
<ggole> e isn't necessarily an identifier, though
<pippijn> Drup: [%] is expensive for me
sheijk has joined #ocaml
<gasche> hi pippijn!
<pippijn> it's RAlt+8, Shift+5, RAlt+9
<pippijn> hi gasche
<Drup> pippijn: same here
<gasche> (in pratice the "| <p> -> <e'>" part is expected to go on its own line most of the time)
<Drup> not the same numbers, but still
<pippijn> would be better on english programmer dvorak, but I'm used to german normal dvorak (II)
MercurialAlchemi has quit [Ping timeout: 255 seconds]
<gasche> how's life at Google?
<pippijn> busy
<pippijn> and fast
<pippijn> my life here passes by much faster than in paris
<struktured> companion_cube: is there something like this in CCOpt already that I missed? "let get_lazy f t = match t with Some t -> t | None -> f () end"
<gasche> pippijn: you may be interested in knowing that I've worked a bit with def-lkb on his Menhir patches for incrementality and error reporting
<pippijn> ah, in what direction?
<gasche> we may get them upstream eventually, but I think def-lkb is too busy right now
<SuperNoeMan> Drup: I just want RPC capability in ocaml
<SuperNoeMan> the best way possible
<Drup> SuperNoeMan: did you look at what I linked you ?
<pippijn> I have failed in (and given up on) getting mine upstream
<SuperNoeMan> Yeah just now opened it
<gasche> the direction was to get upstream whatever features were necessary to play with error reporting
<SuperNoeMan> Is there a way to use piqi
<SuperNoeMan> and serialize to whatever format I want?
<pippijn> all you need is stuff in the exception object
<pippijn> token/state pairs
<companion_cube> struktured: I don't think so (not the lazy part)
<Drup> SuperNoeMan: why do you care ? eliom handles the serialization for you.
<pippijn> it's about 10 lines diff, I think
<pippijn> for error reporting, that's all
<gasche> yes and no
<pippijn> for specific error recovery, it's a bit more
<gasche> exactly
<gasche> def-lkb's work allows to inspect the parsing stack, which allows for more error reporting techniques
matason has quit [Quit: Leaving...]
<pippijn> does it hook into the parser or does the exception carry the stack?
<gasche> he adds a step-by-step execution interface to the parser
<pippijn> ah
<pippijn> push parsing
<gasche> meaning the user can react to parser transitions (failure in particular)
<pippijn> nice
<gasche> which is also useful for Merlin's handling of incrementality
<pippijn> I like that
matason has joined #ocaml
<gasche> well I think it'll take a few more months because we're all busy on something else, but I hope we can get this upstream
<pippijn> sounds good
tane has quit [Quit: Verlassend]
<companion_cube> whitequark: so, with ppx_deriving_cconv, which seems to start working, encoding/decoding to/from sexplib and bencode should now be possible!
<whitequark> cool
<Drup> SuperNoeMan: we agree you want to call, from the client written in OCaml, a server side OCaml function written by you, right ?
<whitequark> companion_cube: examples?
<companion_cube> https://github.com/c-cube/ppx_deriving_cconv <--- the readme
<companion_cube> basically you get values encode/decode, which can then be used with several backends
<whitequark> cool
<gasche> whitequark: do you think "if let" is better than "with ->"?
davine has quit [Ping timeout: 264 seconds]
<whitequark> definitely
<whitequark> I think if let is the best non-ppx option
<whitequark> given the reluctance to add keywords
<Drup> I tend to agree
<gasche> hm
<gasche> in fact
<gasche> I dislike the without-else form
<gasche> but the with-else form is ok
<gasche> I think you could the part about modular-implicits from the PR, it's just silly/distracting
<gasche> +remove
<whitequark> removed it
<gasche> also the PR you reference to is not optimal to highlight the feature, because it only has without-else examples
<gasche> and those are rather ugly (and suggest that the feature is meant to make imperative style easier, while it's actually agnostic)
<whitequark> it has an example with else
<whitequark> oh, the rust thing
<gasche> ... and that piece of code is surprisingly hard to read
<Drup> and that piece of code is a maybe.
<gasche> they handle the Some(id) case twice, once in a "if let" once in the "match"
<Drup> well, there is a guard in the other
<gasche> there's a guard here as well
<gasche> but it's called "} return;"
tane has joined #ocaml
slash^ has left #ocaml [#ocaml]
slash^ has joined #ocaml
chambart has quit [Ping timeout: 264 seconds]
emery has quit [Ping timeout: 250 seconds]
cdidd has quit [Ping timeout: 240 seconds]
matason has quit [Quit: Leaving...]
emery has joined #ocaml
jhaberstro has joined #ocaml
struktured has quit [Ping timeout: 252 seconds]
MercurialAlchemi has joined #ocaml
Hannibal_Smith has quit [Quit: Sto andando via]
matason has joined #ocaml
matason has quit [Client Quit]
ChristopheT has left #ocaml ["ERC Version 5.3 (IRC client for Emacs)"]
matason has joined #ocaml
sheijk has quit [Read error: Connection reset by peer]
struktured has joined #ocaml
sheijk has joined #ocaml
manud__ has joined #ocaml
romildo has quit [Quit: Leaving]
BitPuffin has quit [Read error: Connection reset by peer]
slash^ has quit [Read error: Connection reset by peer]
BitPuffin has joined #ocaml
sheijk has quit [Ping timeout: 258 seconds]
matason has quit [Quit: Leaving...]
matason has joined #ocaml
davine has joined #ocaml
<ggole> Yes, it runs! Time for sleep!
ggole has quit []
manizzle has joined #ocaml
chambart has joined #ocaml
davine has quit [Ping timeout: 245 seconds]
jhaberstro has quit [Quit: jhaberstro]
davine has joined #ocaml
ca-friend has joined #ocaml
larhat has joined #ocaml
davine has quit [Ping timeout: 265 seconds]
ca-friend has left #ocaml [#ocaml]
boogie has joined #ocaml
manud__ has quit [Quit: Be back later ...]
mcclurmc has joined #ocaml
dav_ is now known as dav
bytbox has quit [Remote host closed the connection]
cdidd has joined #ocaml
milosn has quit [Remote host closed the connection]
expo873 has joined #ocaml
davine has joined #ocaml
pgomes has quit [Quit: Leaving]
manud__ has joined #ocaml
oscar_toro has quit [Ping timeout: 258 seconds]
rand000 has quit [Ping timeout: 240 seconds]
saltylicorice has joined #ocaml
matason has quit [Quit: Leaving...]
chambart has quit [Ping timeout: 256 seconds]
chambart has joined #ocaml
davine has quit [Remote host closed the connection]
kakadu has quit [Read error: Connection reset by peer]
thomasga has quit [Quit: Leaving.]
thomasga has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 252 seconds]
tane has quit [Quit: Verlassend]
rand000 has joined #ocaml
jhaberstro has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
saltylicorice has quit [Ping timeout: 264 seconds]
saltylicorice has joined #ocaml
igstan has joined #ocaml
igstan has quit [Client Quit]
nadako has quit [Read error: Connection reset by peer]
saltylicorice has quit [Ping timeout: 252 seconds]
Simn has quit [Quit: Leaving]
araujo has quit [Quit: Leaving]
<struktured> what is this syntax supposed to accomplish? "type x = y = z ", such as here: https://github.com/c-cube/ocaml-containers/commit/23c1288849c5bec75a34f708a26c85e0521a1b95#diff-e58559bc58c1adf2ac56796857f73226R30
<Drup> It's a sort of "redefinition"
<Drup> basically, you say that fpclass is an alias of Pervasive.fpclass *and* you give the definition, so that the constructors are defined in the module too.
<struktured> oh that seems pretty useful. I suppose as a side effect it ensures that the assignments are sound at compile time, so that helps maintain the relationship.
yomimono has joined #ocaml
<Drup> obviously :)
jhaberstro has quit [Quit: jhaberstro]
WraithM has joined #ocaml