adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org and http://caml.inria.fr | http://ocaml.org/releases/4.02.0.html | Public channel logs at http://irclog.whitequark.org/ocaml
q66[lap] has quit [Read error: Connection reset by peer]
<Drup> SGrondin: any non-Async question ? ^^'
AltGr has joined #ocaml
badkins has quit [Remote host closed the connection]
q66[lap] has joined #ocaml
sheijk_ has joined #ocaml
sheijk has quit [Ping timeout: 255 seconds]
<SGrondin> Drup, nope
milosn has joined #ocaml
sheijk_ has quit [Quit: .]
q66[lap] has quit [Read error: Connection reset by peer]
q66[lap] has joined #ocaml
BitPuffin has quit [Ping timeout: 272 seconds]
badkins has joined #ocaml
zpe has joined #ocaml
madroach has quit [Ping timeout: 250 seconds]
madroach has joined #ocaml
zpe has quit [Ping timeout: 258 seconds]
milosn has quit [Ping timeout: 255 seconds]
milosn has joined #ocaml
bytbox has joined #ocaml
mfp_ has joined #ocaml
mfp has quit [Ping timeout: 240 seconds]
cesar_ has joined #ocaml
cesar_ is now known as Guest91875
kandu_ is now known as kandu
Guest91875 has quit [Ping timeout: 258 seconds]
shinnya has quit [Ping timeout: 256 seconds]
darkf has joined #ocaml
ousado has quit [Ping timeout: 255 seconds]
ygrek has joined #ocaml
jwatzman|work has quit [Quit: jwatzman|work]
jao has quit [Ping timeout: 244 seconds]
manizzle has quit [Ping timeout: 240 seconds]
manud_ has joined #ocaml
ygrek has quit [Ping timeout: 256 seconds]
malo has quit [Remote host closed the connection]
q66 has quit [Quit: Leaving]
Guest6 has joined #ocaml
ygrek has joined #ocaml
atondwal has joined #ocaml
bytbox has quit [Remote host closed the connection]
badkins has quit []
MrScout has quit [Ping timeout: 258 seconds]
cesar_ has joined #ocaml
cesar_ is now known as Guest33025
Guest33025 has quit [Ping timeout: 245 seconds]
WraithM has joined #ocaml
pyon has quit [Quit: Know your place, 3D woman!]
ygrek has quit [Ping timeout: 245 seconds]
manizzle has joined #ocaml
mcclurmc has quit []
manizzle has quit [Ping timeout: 245 seconds]
pyon has joined #ocaml
enitiz has quit [Remote host closed the connection]
claudiuc has quit [Remote host closed the connection]
claudiuc has joined #ocaml
enitiz has joined #ocaml
mcclurmc has joined #ocaml
claudiuc has quit [Ping timeout: 258 seconds]
samrat has joined #ocaml
Submarine has quit [Quit: Leaving]
manud_ has quit [Quit: Lingo: www.lingoirc.com]
enitiz has quit [Remote host closed the connection]
enitiz has joined #ocaml
Submarine has joined #ocaml
Submarine has joined #ocaml
ousado has joined #ocaml
expo873 has quit []
expo873 has joined #ocaml
kdef has joined #ocaml
Guest6 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
marchelzo_ has quit [Quit: WeeChat 1.0]
cesar_ has joined #ocaml
cesar_ is now known as Guest66498
meiji11 has joined #ocaml
samrat has quit [Quit: Computer has gone to sleep.]
atondwal has quit [Ping timeout: 255 seconds]
Guest66498 has quit [Ping timeout: 264 seconds]
AltGr has left #ocaml [#ocaml]
AltGr has joined #ocaml
atondwal has joined #ocaml
ousado has quit [Ping timeout: 264 seconds]
struktured has joined #ocaml
pyon has quit [Ping timeout: 244 seconds]
siddharthv_away is now known as siddharthv
ousado has joined #ocaml
keen___________4 has joined #ocaml
keen___________3 has quit [Ping timeout: 258 seconds]
samrat has joined #ocaml
chambart has joined #ocaml
MercurialAlchemi has joined #ocaml
pierpa` has quit [Ping timeout: 264 seconds]
pierpa has quit [Ping timeout: 255 seconds]
darkf_ has joined #ocaml
darkf has quit [Ping timeout: 255 seconds]
darkf_ is now known as darkf
nojb has joined #ocaml
btrace has quit [Read error: Connection reset by peer]
arj has joined #ocaml
atondwal has quit [Quit: WeeChat 0.4.0]
samrat has quit [Quit: Computer has gone to sleep.]
samrat has joined #ocaml
kdef has quit [Quit: peace]
cesar_ has joined #ocaml
cesar_ is now known as Guest63505
Guest63505 has quit [Ping timeout: 255 seconds]
MrScout has joined #ocaml
struktured has quit [Ping timeout: 272 seconds]
tianon has quit [Quit: "I'm a very important man. I've got a tower!"]
MrScout has quit [Remote host closed the connection]
MrScout has joined #ocaml
SGrondin has left #ocaml [#ocaml]
MrScout has quit [Ping timeout: 240 seconds]
BitPuffin has joined #ocaml
ygrek has joined #ocaml
tianon has joined #ocaml
<flux> I wonder if some day Cmdliner will develope to generate GUIs in a declarative fashion for applications.. ;-)
<flux> but nice to see the new release
<adrien> (cough cough)
<adrien> the expectations for GUI are very different
<adrien> on command-line you get your parameters once and for all
<adrien> on GUI the user expects help and the ability to change the values once they have been entered
ggole has joined #ocaml
<flux> well, Cmdliner could easily do that..
<adrien> just as you can C-c and run your command again with different options
<adrien> but it won't be interactive or anything
<adrien> you won't have interactive validation of the values
<adrien> it's a bit like command-line wizards except that we all hate them
tianon has quit [Quit: brb]
tianon has joined #ocaml
nojb has quit [Quit: nojb]
BitPuffin has quit [Ping timeout: 255 seconds]
thomasga has joined #ocaml
meiji11 has quit [Remote host closed the connection]
btrace has joined #ocaml
cesar_ has joined #ocaml
cesar_ is now known as Guest22589
Guest22589 has quit [Ping timeout: 240 seconds]
AlexRussia has quit [Ping timeout: 245 seconds]
natrium1970 has joined #ocaml
<natrium1970> is there an easy way to determine the number of bits available for the “int” type from inside my program?
<natrium1970> The situation is this: let a and b be nonnegative integers. If I know that the product a*b won’t cause overflow, there is a shortcut I can use instead of a more computationally intensive method.
AltGr has left #ocaml [#ocaml]
AltGr has joined #ocaml
<ggole> natrium1970: hmm, you could make a decision based on the value of Sys.word_size
<ggole> I don't think there is any guarantee about the relationship between int and word_size, though
nojb has joined #ocaml
<flux> but it should be easy to test in runtime :)
<ggole> Yeah, you could guard with an assertion
<natrium1970> That was going to be my next question, about whether the number of bits for int is guaranteed to be 31 on all 32-bit platforms, and 63 on 64-bit.
<ggole> In practice it is, but that isn't a guarantee.
<ggole> Somebody could reimplement OCaml without tagging, say
<flux> that's an interesting question. I suppose, if in future someone finds a way to remove that tag, it would be implemented only for int32 and int64 types in the form of unboxing them, to reimplement backwards compatibility?
<ggole> (Not likely, not impossible either.)
<flux> I imagine the number of OCaml programs depending on the implicit overflow behavior are quite few..
<ggole> If you need hard bounds you should be using Int32 or Int64, but of course those are quite slow.
AlexRussia has joined #ocaml
<natrium1970> Let me ask this: The real problem is that I want to make sure the product of the two int’s (which will never be negative) overflows. If overflow occurs, won’t the product end of being negative, so it can be detected that way.
<ggole> No.
<ggole> Try max_int * max_int - 1
<natrium1970> OH. Darn. I’m writing code to compare rational numbers. Assuming that they are nonnegative, one way to compare a/b to c/d is to compare ad and bc, but to do that, I need to make sure they don’t overflow. The other way method I wrote is to use continued fractions, which is slower.
<ggole> There are rationals in the stdlib (and some bindings to faster implementations): perhaps you could use those?
<nojb> natrium1970: there are bindings to gmp - look for zarith
<natrium1970> No, I looked that the ones in stdlib, and they do not expose some of the things I need.
<natrium1970> I want to compile to JavaScript, so zarith is not an option.
<ggole> Then you're in for some fun.
<nojb> natrium1970: what do you need that is not exposed in the stdlib ?
<companion_cube> bigints on javascript, yay
<natrium1970> I’d like to get the numerator and denominator of a a rational number (in normalized form). That is not possible.
<natrium1970> Not possible with Num.
<companion_cube> natrium1970: if you are motivated, it would be very nice to adapt Zarith to a pure ocaml implementation of bignums
<companion_cube> i.e. keep the same interface, change the backend
<natrium1970> Yeah, but I get so distracted as it is. This little advenure on rational numbers is already taking me outside what i wanted to do, but I’m learing a lot of useful things, so i don’t mind.
<natrium1970> I just don’t want to get too far away from my goal.
<flux> finally, a guy who can actually finish his projects ;-)
<natrium1970> I thought that everyone wanted to use GMP.
<nojb> but if you were willing to use the stdlib then you don’t you make your own rational numbers using Big_ints ? Then no need to worry about overflow :)
<natrium1970> Num and the Ratio module it brings in, don’t expose a way to convert the result to an actual ratio (fraction).
<natrium1970> It’s lke once you have converted a ratio of two integers to a Num (Ratio), there’s no getting it back.
<nojb> I mean to ignore Ratio and just define your own datatype type ratio = Big_int.big_int * Big_int.big_int
<nojb> defining the opreations is not very hard
<nojb> *operations
<ggole> natrium1970: er, can't you get the numerator and denominator? Or do you need more?
<natrium1970> But if I use js_of_ocaml, will it translate Big_int to equivalent JavaScript objects?
<natrium1970> ggole: I didn’t see a way to get num and denom from Num (Ratio).
<ggole> val numerator_ratio : ratio -> Big_int.big_int
<ggole> In the Ratio module
<ggole> (I have no idea whether this stuff runs in Javascript though.)
<natrium1970> The ratio module “is used to support the implementation of Num and should not be called directly."
<ggole> Bleh.
<natrium1970> In fact, doesn’t the .mli file hide the numerator_ratio?
<ggole> Um, I would consider stragetically ignoring that advice depending on how much work it would save. :)
<nojb> natrium1970: I seem to remember that the whole Num module has a js_of_ocaml implementation so you should be able to use Big_ints without any problem
<companion_cube> yeah, ignore Num, use Ratio and Big_int
<natrium1970> ggole: I appreciate the help.
<companion_cube> tl;dr we miss a JS backend to Zarith :>
<natrium1970> My schizo self has had these arguments with myself a couple of times.
<ggole> The Num module is pretty strange
<natrium1970> Num seems to want to hide so much information.
<ggole> Right, but it only half-hides it
<ggole> You can see the variant and the parts, but you aren't supposed to use the bits? Very odd.
<ggole> Well, I guess it's ancient machinery from the caml light days.
octachron has joined #ocaml
<companion_cube> also, you can't make the distinction between rationals and integers, if I recall correctly
<companion_cube> there could be a phantom type nowadays
<natrium1970> In some cases, I need to make the distinction.
<ggole> It's type num = Int of int | Big_int of Big_int.big_int | Ratio of Ratio.ratio
<ggole> So "integers" are two of those legs"
<ggole> Bit clumsy.
<natrium1970> One leg is bigger than the other.
<natrium1970> If i were trying to actually complete something (thanks flux!) I would work on some of these extra proejcts.
<natrium1970> s/were/weren't/
enitiz has quit [Ping timeout: 272 seconds]
<natrium1970> Since there are actually lifesigns in the channel, could someone tell me what ever happened to the LLVM-based backend? I looked online and found a bunch of stuff from 2011-ish, but haven’t heard a word since.
<companion_cube> some people here are working on it (I think) but apparently it's hard because of the GC
<natrium1970> I’d like to know more about it, but it’s hard to find information.
<companion_cube> people who discuss it include whitequark & Drup
chambart has quit [Ping timeout: 264 seconds]
<natrium1970> One more question: If I write let x = int_of_big_int (sqrt_big_int (big_int_of_int max_int)), will x be evaluated only once, or will it be evaluated every time I refer to x?
<ggole> Once
nojb has quit [Quit: nojb]
<natrium1970> ggole: I took a detour through Scala, and it utterly confused me about evaluation strategies.
michael_lee has joined #ocaml
<companion_cube> in ocaml, lazyness is explicit
<companion_cube> with the type 'a Lazy.t
<ggole> Really the only way to get something evaluated more than once in OCaml is to put it inside a function and invoke that a bunch of times
<ggole> (Or equivalent things like for/while loops, I guess.)
<ggole> Even laziness doesn't result in multiple computations.
<natrium1970> Like I said, I think Scala uses def for things that are evaluated on each use, and I was confused coming back to OCaml.
<ggole> O_o
<natrium1970> Again, thanks everyone, you are very helpful!
<ggole> Dunno much about Scala, except that it looks pretty complicated from a distance.
<companion_cube> also, in scala there's stuff like def/val and implicits
<companion_cube> much more complicated indeed
<companion_cube> oh, and lazy val
<natrium1970> companion_cube: Yes, it’s the def vs val vs var thing! If something is declared “def” it’s evaluated every time. “val” is evaluated once (but cannot be mutates) and var is mutable.
<natrium1970> It’s like some kind of nightmarish combination of the most confusing features of Haskell and Java.
<companion_cube> def x = y + 1 is like a 0-ary function, iirc
<ggole> Almost like forth words
<ggole> Seems like it would be irritating in an applicative language.
<ggole> I guess the motivation is that you can start out with a val, realise that you need some computation there, and "upgrade" to a def without changing the user code.
<natrium1970> I like the simplicity of OCaml. Some of the esoteric features like “row polymorphism” are beyond me for the moment.
michael_lee has quit [Remote host closed the connection]
<companion_cube> don't worry, you can use the basic features and go pretty far
<natrium1970> I learned quite a bit in school about OCaml. (Really!)
nojb has joined #ocaml
natrium1970 has quit [Quit: natrium1970]
ollehar has joined #ocaml
Simn has joined #ocaml
nojb has quit [Quit: nojb]
nojb has joined #ocaml
zpe has joined #ocaml
michael_lee has joined #ocaml
Guest42622 is now known as johnelse
nojb has quit [Quit: nojb]
nojb has joined #ocaml
jonludlam has joined #ocaml
nojb has quit [Quit: nojb]
pgomes has joined #ocaml
cesar_ has joined #ocaml
cesar_ is now known as Guest82491
<Unhammer> is there a way to make a function that abstracts over things like this:
<Unhammer> let wf = List.filter_map (function Wf b -> Some b | _ -> None) l in
<Unhammer> let sf = List.filter_map (function Sf b -> Some b | _ -> None) l in
Guest82491 has quit [Ping timeout: 240 seconds]
<Unhammer> ie. l is a list of things like [Wf "hi"; Sf "there"; Other; Wf "stuff"], and I want to separate it into the list of all Wf's, the list of all Sf's, etc.
ikaros has joined #ocaml
expo873 has quit [Quit: Connection closed for inactivity]
thomasga has quit [Quit: Leaving.]
govg has quit [Ping timeout: 245 seconds]
BitPuffin has joined #ocaml
<flux> let wf, sf = List.partition (function Wf b -> true | Sf b -> false) l in
<flux> unless your actual case is something more general?
thomasga has joined #ocaml
<Unhammer> the whole type is
<Unhammer> Sf of string|Wf of string|Blank of string|Sub of string list list
<Unhammer> (though I guess I partition is a bit more concise than filter_map, thanks!)
pgomes has left #ocaml [#ocaml]
<gasche> ggole: trunk has Sys.int_size thanks to Hugo Heuzard
kakadu has joined #ocaml
chambart has joined #ocaml
btrace_ has joined #ocaml
w0rp has joined #ocaml
<w0rp> Is there a library for OCaml offering a fixed-point decimal type?
<ggole> gacshe: right, that's more direct
<ggole> I wonder if that's intended to ease things like portability to JS
btrace has quit [Ping timeout: 272 seconds]
hugomg has joined #ocaml
bjorkintosh has joined #ocaml
ygrek has quit [Ping timeout: 255 seconds]
mfp_ has quit [Read error: Connection reset by peer]
dmiles has quit [Quit: Read error: 110 (Connection timed out)]
btrace_ has quit [Read error: Connection reset by peer]
btrace_ has joined #ocaml
dsheets_ has joined #ocaml
kakadu_ has joined #ocaml
michael_lee has quit [Ping timeout: 256 seconds]
kandu has quit [Quit: leaving]
michael_lee has joined #ocaml
nojb has joined #ocaml
AltGr has left #ocaml [#ocaml]
kandu has joined #ocaml
samrat has quit [Quit: Computer has gone to sleep.]
jonludlam has quit [Ping timeout: 250 seconds]
cesar_ has joined #ocaml
cesar_ is now known as Guest23105
thomasga has quit [Quit: Leaving.]
jonludlam has joined #ocaml
Guest23105 has quit [Ping timeout: 240 seconds]
kakadu_ has quit [Quit: Konversation terminated!]
kakadu_ has joined #ocaml
q66[lap] has quit [Read error: Connection reset by peer]
q66[lap] has joined #ocaml
nojb has quit [Quit: nojb]
demonimin has quit [Remote host closed the connection]
Guest6 has joined #ocaml
thomasga has joined #ocaml
Guest6 has quit [Client Quit]
Guest6 has joined #ocaml
demonimin has joined #ocaml
Guest6 has quit [Client Quit]
siddharthv is now known as siddharthv_away
mfp_ has joined #ocaml
thomasga has quit [Quit: Leaving.]
q66[lap] has quit [Read error: Connection reset by peer]
q66[lap] has joined #ocaml
thomasga has joined #ocaml
<Unhammer> if I do "type somerecord = Othermodule.record", I have to "open Othermodule" anyway to access record fields?
<companion_cube> gasche: is there some documentation on [@@ocaml.warning]?
<whitequark> Unhammer: yes
<whitequark> you can do type r = M.r = { x : int; y : int } ...
<whitequark> or you can use https://github.com/whitequark/ppx_import
<companion_cube> gasche: testfile is http://vrac.cedeela.fr/test.ml with -w +39
<Unhammer> there's ppx-es for everything these days
Guest6 has joined #ocaml
<companion_cube> Unhammer: or you can r.Othermodule.x, r.Othermodule.y
jao has joined #ocaml
<Unhammer> same as Othermodule.(r.x) ?
jao has quit [Changing host]
jao has joined #ocaml
<companion_cube> this is more like a local open
<mrvn> the result is the same though
<mrvn> Maybe ocaml should have a "import (type | value | module) from <module>"
<companion_cube> yeah...
<mrvn> short for "module T = (struct include M end : sig type t = ... end) include T
<mrvn> simpler syntax might be "include M.t"
<whitequark> ambiguous
<whitequark> include type M.t is not though
vbmithr has quit [Quit: leaving]
vbmithr has joined #ocaml
<Unhammer> would be neat (though I solved my problem by a different reorganisation)
Guest6 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
ygrek has joined #ocaml
<mrvn> would "open type M.t" make sense too?
jonludlam has quit [Ping timeout: 272 seconds]
<Drup> ggole: sort of. Integers in js are neither 31 nor 63 bits
jonludlam has joined #ocaml
<ggole> Yeah, you get the 53 or whatever it is integral bits of a float.
<ggole> Strange.
<mrvn> whitequark: on second though: "include Module.value" is the same as "let value = Module.value". So maybe include could be limited to Module.type.
koderok has joined #ocaml
<Drup> an "include Module.t" would play nicely with the disambiguation.
<Drup> include type*
<whitequark> imo this is well enough served by ppx_import
<whitequark> no need to complicate the core language
<mrvn> whitequark: can you open with ppx_import?
<mrvn> module M = struct type t = Foo | Bar end
<mrvn> open M.t
<mrvn> let y = Bar
<whitequark> type t = [%import: M.t]
<whitequark> will do exactly what you want
<mrvn> No, that overrides the local type t
<whitequark> so what it is you want, then?
<mrvn> open, not include
<whitequark> what is the difference?
<mrvn> open doesn't end up in the signature of the module
<Drup> creating a symbol vs saying "hey typechecker, see this type, add it to your disambiguation bank"
<mrvn> module M = struct type t = int end module T = struct open M end;;
<mrvn> module T : sig end
<ggole> The bits are still shared though
<Drup> so that you don't need to hint the type everytime you want to use it because it's not strictly speaking in scope.
<ggole> Which surprised me the first time I saw it
<mrvn> open is like a M.(....) around all the rest of the code
Guest6 has joined #ocaml
<mrvn> whitequark: then the DPL can add one
<mrvn> ups, ewin
<whitequark> mrvn: I don't think I can make such an open without polluting namespace
<ggole> Hmm, does ppx have enough info to copy definitions in a .mli?
<mrvn> whitequark: yeah. I thought you could import into a submodule and then open that. But that pollutes the namespace with the module.
<ggole> Eg, instead of duplicating a massive variant just say type t = [@duplicate_from_mli] or something
<mrvn> can ppx open additional files?
<ggole> Might have some thorny edge cases though.
<Drup> ggole: ppx_import do that
<whitequark> mrvn: yes
<ggole> Neat.
<whitequark> ppx_import does exactly that
<Drup> it's from ml to mli or the other way ? i never remember
<whitequark> mli->ml
<mrvn> I realy need to update to a recent ocaml and ppx. ppx_import is just to cool.
<Drup> whitequark: that's sort of unfortunate from the documentation point of view of the mli
<whitequark> what do you mean?
<Drup> you got a remarkably unhelpful import in the .mli,
cesar_ has joined #ocaml
<Drup> not a problem for ocamldoc, but still :/
cesar_ is now known as Guest81211
<whitequark> what do you mean?
<whitequark> mli has the full code, ml import
<companion_cube> agreed, it should go the other way around
<whitequark> imports*
<Drup> whitequark: ah right, the other way then, got it wrong
<mrvn> There shouldn't be a need for 2 files in the first place. But that would be a major syntax change.
<companion_cube> Drup: does "val on_top_of : ('b -> 'b -> 'c) -> ('a -> 'b) -> 'a -> 'a -> 'c" fit your aesthetic sense?
Guest6 has left #ocaml ["Textual IRC Client: www.textualapp.com"]
<Drup> I don't know, what's the documentation for it ?
<mrvn> companion_cube: shouldn't there be a list or something in there?
<companion_cube> sooo, no actor system in OCaml?
<companion_cube> mrvn: I don't think so
<mrvn> on_top_of f1 f2 x1 x2 = f1 (f2 x1) (f2 x2)?
<companion_cube> yes
<companion_cube> basically, for comparisons
<Drup> and what do you want to know ?
<mrvn> on_top_of eq convert x1 x2 = eq (convert x1) (convert x2)?
<companion_cube> Drup: if the name is ok :p
<companion_cube> mrvn: exactly
<companion_cube> on_top_of compare fst
<Drup> no, the name is horribly unhelpful, but I'm pretty sure you knew that already
<mrvn> I don't think on_top_of expresses what it does well
<Drup> convert_binop ?
<companion_cube> I first tried compose_1_2 :>
<companion_cube> why "convert"? could be "map" then
Guest81211 has quit [Ping timeout: 264 seconds]
<companion_cube> map_binop
jlouis_ is now known as jlouis
<ggole> eq_map?
<Drup> it's not really a map.
<mrvn> ggole: works for any binary function.
<companion_cube> no, not eq, it doesn't have anything to do with eq
<mrvn> Drup: 'a -> 'b is a map.
<ggole> Easier to understand if you state the intended use explicitly, though.
<Drup> from a purely typesystem point of view, yes, it is
<Drup> but conceptually, it's a conversion function.
<companion_cube> in haskell it's just "on" -_-
<companion_cube> compare `on` fst
<mrvn> Drup: sure. but we have List.map and not List.convert, too
<Drup> mrvn: there is a little t type at the end.
<Drup> anyway, doesn't matter.
<Drup> companion_cube: except the (ab)use the infix call syntax for that, it doesn't make sens otherwise
<mrvn> would some "cmp @-> conv" like construct work in ocaml?
<mrvn> some existing one
<companion_cube> an infix name would be even worse :s
<companion_cube> or, I can just keep compose_1_2 (or 2_1, depends)
<Drup> meh.
<mrvn> I like map_binop better than compose_1_2
<mrvn> or mapped_binop or binop_mapped or binop_map
<companion_cube> why not, indeed
<Drup> or don't call it a map, because it's not one :>
<companion_cube> < Drup> from a purely typesystem point of view, yes, it is
<mrvn> conv_and_binop if you like typing
<companion_cube> or compose_binop
<Drup> companion_cube: that was answer to the fact that "'a -> 'b" was a map
<mrvn> How about module BinOp = struct let map ....?
<Drup> answering*
<Drup> It's not a map >o<
<companion_cube> I thought F 'a = 'a -> foobar was a functor?
<Drup> it's unhelpful to make it a map, you are not trying to change the content of a type, you are trying to cast things from a type to another
<Drup> to make it fit with another function
<companion_cube> I'll go for compose_binop
<companion_cube> and that's it :p
<ggole> Maybe apply then
<ggole> eq_apply
<Drup> that's less terrible than map >_>
<Drup> (compose_binop)
<ggole> Actually this would also work for orderings, so forget the eq
* ggole mumbles something about naming things and off-by-one errors
<companion_cube> :D
<mrvn> +1 on compose_binop
<companion_cube> done \o/
tane has joined #ocaml
<mrvn> ggole: naming things is harder.
<ggole> Isn't it though?
<companion_cube> sooooo, lwt-2.4.6 can't be installed on my computers. You're drunk, opam
<Drup> at least, off by one errors are checkable, given a sufficient type system.
<mrvn> except for trivial thinks like n and i.
<mrvn> Drup: or at least runtime boundary checks.
<companion_cube> [`Atom of string | `List of 'a list] as 'a ← /me loves structural types
samrat has joined #ocaml
<whitequark> companion_cube: it's broken on os x i think
<companion_cube> I'm on linux :?
<whitequark> huh
<companion_cube> The following would require downgrades or uninstalls, but you may upgrade them explicitely : lwt.2.4.6
<companion_cube> no idea what's causing it, --verbose doesn't give more details
<companion_cube> that's ok for now, I'd rather know why [@warning] doesn't work
<Drup> companion_cube: update/upgrade done and opam 1.2, I presume ?
<companion_cube> yes
<companion_cube> (well I'm updating again just to be sure)
<Drup> which version of lwt are you on right now ?
avsm has joined #ocaml
<companion_cube> 2.4.5
<Drup> what "opam install lwt.2.4.6" returns ?
<companion_cube> argh, a big downgrade
<Drup> are you using aspcud ? =__=
<flux> aspcud should really be a very heavily suggested dependency, because I've found opam really not working properly without it. even for (seemingly?) basic cases..
<companion_cube> apparently I'm not, it's not even on my distro...
<Drup> companion_cube: which distro are you using ?
<companion_cube> fedora 19
<Drup> such a silly idea :]
<companion_cube> yeah, well, I made the choice 2.5 years ago
<companion_cube> I was frightened by freaking UEFI
<Drup> companion_cube: use the "cloud solver" solution
<Drup> (or motivate yourself, and package aspcud for fedora :p)
<companion_cube> hmmm, I never tried the cloud solver
struktured has joined #ocaml
<whitequark> it works welll
samrat has quit [Quit: Computer has gone to sleep.]
samrat has joined #ocaml
<companion_cube> oh, it works
<companion_cube> nice
<companion_cube> and no, I won't package aspcud for fedora --_
<whitequark> apscud is a pain to build
<companion_cube> neat, now I have lwt.ppx
<companion_cube> thanks \o/
bytbox has joined #ocaml
<struktured> companion_cube: take that, camlp4!
<flux> I wonder if the problem with opam is that the default solver isn't quite as advanced as (say) aspcud (hate the name btw ;-)), or are there actually some bugs in it that cause wonky behavior
bytbox has quit [Remote host closed the connection]
<Drup> former
mort___ has joined #ocaml
kakadu_ has quit [Ping timeout: 272 seconds]
<Drup> in aspcud, there is a notion of "optimization" (you maximize the number of package that are uptodate, for example). It's not present in the built in smt solver. It returns *a* solution, and that's all
<whitequark> that's... not very useful at all
avsm has quit [Quit: Leaving.]
<Drup> No it's not.
<whitequark> imo opam should depend on cohttp and just call the solver farm
<whitequark> ruby's bundler does that, btw
<companion_cube> well I hope lwt will finally stop depending on camlp4
<companion_cube> Drup: but in this case there's a solution, and it fails to return it
enitiz has joined #ocaml
<companion_cube> which is... weird
<companion_cube> you are awesome :D
<struktured> camlp4 is a virus and ppx is the cure
jao has quit [Ping timeout: 244 seconds]
<companion_cube> indeed
<flux> until two years after a new, backwards incompatible ppx is introduced
<flux> and the current ppx renamed to ppx2
<flux> to maximize confusion
<whitequark> meh, ppx is not backwards compatible
enitiz has quit [Ping timeout: 258 seconds]
<companion_cube> flux: :D
<companion_cube> I propose "ppy" rather than ppx2
<Drup> whitequark: I'm not yet sure how the maintenance of ppxs is going to work out.
<flux> until we have ppö
<companion_cube> pp×
<flux> whitequark, so, they break all the time?
<Unhammer> ppχ
<whitequark> yes
<gal_bolle> pépéïx (in UTF-17)
<whitequark> parsetree is not considered a stable interface at all
<flux> quite sad
<reynir> is utf-17 a thing?
<ggole> ρρx
<gal_bolle> hopefully not
<whitequark> flux: it's not like camlp4 was
<Drup> whitequark: well, it's understandable, it can't be a stable interface *and* add new things to the syntax
<whitequark> exactly
<flux> whitequark, but how about things like lwt.ppx, will they keep breaking on every ocaml release?
<whitequark> "sometimes"
<flux> I guess it's understandable if ppx_deriving will break
<flux> because it takes original syntax and generates code depending on its contents
<Drup> It shouldn't, I think
<Drup> as long as ppx_metaquot works, and the smart constructors contained in compiler libs are up to date, it should be ok.
<Drup> (which means we need to keep metaquot uptodate, ofc, but that shouldn't be an issue)
<whitequark> well, ppx_metaquot needs to be updated
<Drup> indeed
<whitequark> I mean, I have a PR with 4.03 compat
<whitequark> it sits there for weeks
<Drup> alain is a bit unresponsive currently :(
<whitequark> vacation.
<whitequark> until 24th or so
<Drup> I see
<Drup> long vacations I must say :D
<whitequark> yes
pyon has joined #ocaml
enitiz has joined #ocaml
kakadu_ has joined #ocaml
darkf has quit [Quit: Leaving]
kakadu_ has quit [Ping timeout: 255 seconds]
arj has quit [Quit: Leaving.]
enitiz has quit [Quit: Leaving]
lu324 has joined #ocaml
shinnya has joined #ocaml
cesar_ has joined #ocaml
cesar_ is now known as Guest85781
xyh has joined #ocaml
<xyh> opam init :: Cannot download https://opam.ocaml.org/urls.txt, please check your connection settings
<flux> url works for me. try again?
avsm has joined #ocaml
<xyh> I can view https://opam.ocaml.org/urls.txt in firefox
<xyh> but opam can not
Guest85781 has quit [Ping timeout: 245 seconds]
<flux> does curl https://.. work as well?
avsm has quit [Client Quit]
<xyh> curl: (7) Failed to connect to opam.ocaml.org port 443: Connection refused
avsm has joined #ocaml
<xyh> compiling chamo --> Error: Cannot find file /usr/lib/ocaml/lablgtk2/gtkInit.cmx , but I see there are :: gtkInit.cmi gtkInit.cmo gtkInit.ml
George__ has joined #ocaml
gal_bolle has quit [Remote host closed the connection]
George__ has quit [Ping timeout: 246 seconds]
ollehar has quit [Quit: ollehar]
pierpa` has joined #ocaml
pierpa has joined #ocaml
bytbox has joined #ocaml
tane has quit [Quit: Verlassend]
badkins has joined #ocaml
olauzon has joined #ocaml
dmiles_afk has joined #ocaml
enquora has joined #ocaml
koderok has quit [Quit: koderok]
tane has joined #ocaml
xyh has left #ocaml ["Killed buffer"]
shinnya has quit [Ping timeout: 264 seconds]
gdsfh1 has joined #ocaml
zpe has quit [Remote host closed the connection]
thomasga has quit [Quit: Leaving.]
gdsfh has quit [Ping timeout: 255 seconds]
shinnya has joined #ocaml
govg has joined #ocaml
bytbox has quit [Remote host closed the connection]
thomasga has joined #ocaml
shinnya has quit [Ping timeout: 244 seconds]
shinnya has joined #ocaml
slash^ has joined #ocaml
cesar_ has joined #ocaml
cesar_ is now known as Guest59736
ygrek has quit [Ping timeout: 244 seconds]
Guest59736 has quit [Remote host closed the connection]
govg has quit [Quit: leaving]
Hannibal_Smith has joined #ocaml
octachron has quit [Quit: Leaving]
avsm has quit [Quit: Leaving.]
chambart has quit [Ping timeout: 250 seconds]
yomimono has joined #ocaml
<lu324> what is the correct way to write two types that refer to each other, like this? http://codepad.org/pLrbOZbZ
bytbox has joined #ocaml
jwatzman|work has joined #ocaml
<whitequark> type x = ... and y = ...
<lu324> that seems to work
<lu324> and one more thing that i'm having trouble finding out: how do you define a .ml/.mli module with a concrete type without repeating the definition in both files?
<whitequark> generally, you don't
<whitequark> on >= 4.02, you can use https://github.com/whitequark/ppx_import
q66 has joined #ocaml
<lu324> whitequark: so even with large types with lots of variants, the usual thing to do is to duplicate them and remember to always change both at once?
<ggole> In some circumstances you can pull the type out into a third module and refer to it in both .mli and .ml
jonludlam has quit [Ping timeout: 265 seconds]
<ggole> Which kinda sucks, but eases maintainence
<flux> lu324, well, if you have many concrete types, this may suite you: introduce them in a separate foo.ml. you can then include module type of Foo (not sure if that works..) in the .mli and include Foo in the .ml
<whitequark> lu324: you don't have to jut remember it, the typechecker will ensure they are identical
<whitequark> but, ye
<whitequark> *yes
<Drup> you can even have a mli alone if you have only types in it
<flux> ah, that is correct as well
<flux> I wonder if it works with plain include for both files then?
<flux> maybe not? try ;-)
<Drup> iirc, plain include work for both
kakadu_ has joined #ocaml
<MercurialAlchemi> lu324: it's pretty common in the Haskell works as well to have a Types module that you import wherever you need it
<MercurialAlchemi> convenient
<lu324> i'll try using include, and maybe just have some standalove mli files just for types
<lu324> thanks
kakadu_ has quit [Ping timeout: 255 seconds]
expo873 has joined #ocaml
zpe has joined #ocaml
bytbox has quit [Remote host closed the connection]
dsheets_ has quit [Ping timeout: 244 seconds]
jwatzman|work has quit [Quit: jwatzman|work]
zpe has quit [Ping timeout: 244 seconds]
freling has left #ocaml [#ocaml]
BitPuffin has quit [Ping timeout: 264 seconds]
BitPuffin has joined #ocaml
thomasga has quit [Quit: Leaving.]
MrScout has joined #ocaml
jwatzman|work has joined #ocaml
badkins has quit []
chambart has joined #ocaml
George__ has joined #ocaml
badon_ is now known as badon
MrScout has quit [Remote host closed the connection]
kakadu has quit [Ping timeout: 246 seconds]
MrScout has joined #ocaml
ggole has quit []
yomimono has quit [Ping timeout: 258 seconds]
rand000 has joined #ocaml
zpe has joined #ocaml
cesar_ has joined #ocaml
cesar_ is now known as Guest99330
jwatzman|work has quit [Quit: jwatzman|work]
mort___ has quit [Ping timeout: 265 seconds]
chambart has quit [Ping timeout: 245 seconds]
Guest99330 has quit [Ping timeout: 245 seconds]
enitiz has joined #ocaml
slash^ has left #ocaml [#ocaml]
slash^ has joined #ocaml
slash^ has quit [Read error: Connection reset by peer]
larhat1 has joined #ocaml
larhat has quit [Ping timeout: 272 seconds]
zpe has quit [Remote host closed the connection]
Thooms has joined #ocaml
rand000 has quit [Quit: leaving]
claudiuc has joined #ocaml
_andre has quit [Quit: leaving]
govg has joined #ocaml
asmanur has quit [Ping timeout: 240 seconds]
kakadu has joined #ocaml
jwatzman|work has joined #ocaml
jwatzman|work has quit [Changing host]
jwatzman|work has joined #ocaml
Simn has quit [Ping timeout: 265 seconds]
ikaros has quit [Quit: Ex-Chat]
badkins has joined #ocaml
lordkryss has joined #ocaml
asmanur has joined #ocaml
George__ has quit [Ping timeout: 246 seconds]
Anarchos has joined #ocaml
samuel02 has joined #ocaml
chambart has joined #ocaml
Thooms has quit [Quit: WeeChat 1.0.1]
manud_ has joined #ocaml
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
enitiz has quit [Ping timeout: 258 seconds]
badkins_ has joined #ocaml
Anarchos has joined #ocaml
badkins has quit [Ping timeout: 250 seconds]
BitPuffin has quit [Ping timeout: 264 seconds]
enitiz has joined #ocaml
pgomes has joined #ocaml
thomasga has joined #ocaml
mfp_ is now known as mfp
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
zpe has joined #ocaml
samrat has quit [Quit: Computer has gone to sleep.]
olauzon has quit [Quit: olauzon]
thomasga has quit [Ping timeout: 255 seconds]
enitiz has quit [Ping timeout: 258 seconds]
Anarchos has joined #ocaml
zpe has quit [Ping timeout: 250 seconds]
jonludlam has joined #ocaml
cesar_ has joined #ocaml
cesar_ is now known as Guest94549
ollehar has joined #ocaml
<ollehar> can a module have an "init" function which set up variables?
badon has quit [Quit: Leaving]
<Drup> what would it mean ?
<mrvn> yes.
Trin00 has joined #ocaml
<mrvn> just don't forget to call it.
<mrvn> e.g. let () = init ()
<ollehar> module M
<ollehar> let x = (* defined at init *)
<ollehar> end
<Drup> you need to use references for that, but it's really not nice.
<ollehar> or functor?
<Drup> a better solution is to use classes (with initializer) of a functor
<Drup> s/of/or/
<ollehar> yeah
<mrvn> module M = struct let init () = (1,2,3,...) let (x,y,z,.....) = init () end
<Drup> ollehar: the functor approach is not bad in fact, you can even use the new feature with generative functors, if needed.
<ollehar> I will have nested functors
<mrvn> just wait for higher order functors
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
<Drup> why wait ? :D
<ollehar> :P
<ollehar> vim syntax highlightning can't keep track anymore
<ollehar> it's all red
<ollehar> but compiles
Anarchos has joined #ocaml
<adrien> C-l
enitiz has joined #ocaml
<ollehar> small L?
<ollehar> I have ctrl-l mapped
<adrien> it'll make vim redraw and it can help syntax highlighting at times :)
<adrien> and, yes, small l
<ollehar> ok
<ollehar> thanks
<ollehar> still red though
<ollehar> no big deal
<adrien> ='(
<ollehar> wait, if I do init in functor I can't use types defined within the module
<mrvn> why do you need init at all? Just set the values directly.
<ollehar> they need to be random
<mrvn> so?
<mrvn> module M = struct let x = Random.int () end;;
<ollehar> oh
<ollehar> OK
<ollehar> did not think of that
<ollehar> thanks!
<Drup> well, it can be useful to delay the execution.
<Drup> I though that what ollehar wanted :>
<mrvn> but then you have to manually call init or the functor.
badon has joined #ocaml
<Drup> sure
michael_lee has quit [Quit: Ex-Chat]
<Drup> that's the point, the init is explicit
govg has quit [Quit: leaving]
<ollehar> and I feel like the implementation of the module would spill over
<ollehar> anyway, I'm impressed by OCaml's module system
<ollehar> let m = struct ... end
<ollehar> awesome
<ollehar> or let module M = ...
<ollehar> does anyone here actually work with OCaml? non-academically
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
<whitequark> um, sure
<ollehar> nm, gotta go
<Drup> I do only non-useful things, academically :D
Anarchos has joined #ocaml
nojb has joined #ocaml
manud_ has quit [Quit: Be back later ...]
Submarine has quit [Ping timeout: 264 seconds]
enitiz has quit [Ping timeout: 258 seconds]
ollehar has quit [Ping timeout: 240 seconds]
govg has joined #ocaml
hbar has quit [Ping timeout: 272 seconds]
govg has quit [Quit: leaving]
hbar has joined #ocaml
Submarine has joined #ocaml
enitiz has joined #ocaml
dsheets_ has joined #ocaml
Simn has joined #ocaml
tane has quit [Quit: Verlassend]
govg has joined #ocaml
Guest94549 has quit [Remote host closed the connection]
badkins_ is now known as badkins
<companion_cube> whitequark: there's no plan in ppx_deriving_yojson, to support Yojson.Basic.json (the standard one)?
<whitequark> companion_cube: what's the use case?
<whitequark> oh
<whitequark> I remember why I used safe
<whitequark> integer literals.
<whitequark> you would get broken semantics
<companion_cube> well you can put the integer literals into strings, I guess
<whitequark> and why is this useful?
manud_ has joined #ocaml
<companion_cube> I was thinking about using jsonm, but anyway it's not even the same type as Yojson.Basic, so never mind
<companion_cube> (jsonm should work better with lwt)
avsm has joined #ocaml
<whitequark> yeah, deriving_jsonm would be one cool plugin
<whitequark> I think you can actually write it now mostly as a clone of _yojson
<companion_cube> not right now, I'm going to try to write a minimalistic actor system on top of Lwt
ollehar has joined #ocaml
samuel02 has quit [Remote host closed the connection]
Thooms has joined #ocaml
dsheets_ has quit [Ping timeout: 240 seconds]
dsheets_ has joined #ocaml
pgomes has left #ocaml ["Leaving"]
bytbox has joined #ocaml
badkins has quit [Ping timeout: 255 seconds]
thomasga has joined #ocaml
samuel02 has joined #ocaml
thomasga has quit [Quit: Leaving.]
samuel02 has quit [Ping timeout: 240 seconds]
kakadu has quit [Quit: Konversation terminated!]
Hannibal_Smith has quit [Quit: Sto andando via]
cesar_ has joined #ocaml
cesar_ is now known as Guest25324
Thooms has quit [Quit: WeeChat 1.0.1]
Guest25324 has quit [Ping timeout: 255 seconds]
avsm has quit [Quit: Leaving.]
MercurialAlchemi has quit [Ping timeout: 264 seconds]
claudiuc has quit [Quit: Leaving...]
claudiuc has joined #ocaml
Simn has quit [Quit: Leaving]
dsheets_ has quit [Ping timeout: 258 seconds]
ruoso has joined #ocaml
<ruoso> Is there a documentation on how to build ocaml from source control without using the distribution tarball?
<nojb> ruoso: just clone, configure and make world
<ruoso> oh, ok... that already has the .depend
<ruoso> I got confused by the fact that .depend is also on .gitignore
WraithM has quit [Quit: leaving]
<nojb> dont worry about it
<nojb> read the README
<ruoso> I incorrectly removed the stuff that was in .gitignore
<ruoso> then the instructions don't work, as you would expect
<nojb> just clone again :)
<whitequark> git checkout .
<nojb> right
ollehar has quit [Ping timeout: 258 seconds]
enitiz has quit [Ping timeout: 258 seconds]
<ruoso> hmm... I'm trying to build off of 4.02.1 and it's complaining that boot/ocamlyacc is not there...
<ruoso> and it's actually not there
<ruoso> wait... let me double check something
<whitequark> you really do osmething weird with the checkout
<whitequark> it's in the VCS
badkins has joined #ocaml
q66[lap] has quit [Read error: Connection reset by peer]
q66[lap] has joined #ocaml
testcocoon has quit [Ping timeout: 264 seconds]
samuel02 has joined #ocaml
cdidd has quit [Ping timeout: 255 seconds]