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
AltGr has joined #ocaml
bytbox has joined #ocaml
bytbox has quit [Remote host closed the connection]
BitPuffin has joined #ocaml
Simn has quit [Quit: Leaving]
thomasga has joined #ocaml
Denommus has quit [Ping timeout: 264 seconds]
enitiz has joined #ocaml
ivan\ has quit [Read error: Connection reset by peer]
ivan\ has joined #ocaml
thomasga has quit [Quit: Leaving.]
nullcat has joined #ocaml
araujo has joined #ocaml
araujo has joined #ocaml
<nullcat> Hi. I got a question about the module system. I copied my .mli here: https://gist.github.com/anonymous/d40881662c47f26d8320. How should I write the server module's signature in main.mli like I wrote the signature of Negotiation and Transfer in the same file? I am trying to do it like cohttp's style of defining modules. and some background: module Server will use module Negotiation and module Transfer.
<nullcat> I guess it should be something like "module type Server = with type 'a t = 'a Deferred.t and ... and ..."
jcdyer has joined #ocaml
jwatzman|work has quit [Quit: jwatzman|work]
nullcat has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
badon has quit [Quit: Leaving]
antkong has joined #ocaml
ygrek_ has joined #ocaml
tnguyen has joined #ocaml
destrius has joined #ocaml
skinkitten has quit [Quit: Leaving]
jcdyer has quit [Quit: Leaving.]
jcdyer1 has joined #ocaml
pyon-k is now known as pyon-fw
nullcat has joined #ocaml
rgrinberg has quit [Quit: Leaving.]
<nullcat> em... seems that most people here are still sleeping...
bytbox has joined #ocaml
q66 has quit [Quit: Leaving]
Puffin has joined #ocaml
BitPuffin has quit [Ping timeout: 246 seconds]
yminsky has joined #ocaml
rgrinberg has joined #ocaml
yaewa has joined #ocaml
moei has quit [Ping timeout: 272 seconds]
enitiz has quit [Ping timeout: 246 seconds]
yaewa has quit [Read error: Connection reset by peer]
moei has joined #ocaml
yminsky has quit [Quit: yminsky]
yaewa has joined #ocaml
yminsky has joined #ocaml
moei has quit [Ping timeout: 264 seconds]
<pippijn> nullcat: or already
enitiz has joined #ocaml
ivan\ has quit [Read error: Connection reset by peer]
<pippijn> why is Async so much more efficient than Lwt? am I doing something wrong?
<pippijn> the same program with the same network load takes 18% cpu with Async and 100% with Lwt
ivan\ has joined #ocaml
<yminsky> What’s the example? We have done a lot of optimization on Async over the years, so that may explain it.
<pippijn> well, I have a rather simple udp echo loop, basically
<yminsky> But that’s a big difference…
<pippijn> it's slightly more than that:
<yminsky> Can you point to a gist with the core loops in both lwt and async?
pyon-fw has quit [Quit: fix]
<pippijn> I ping network nodes, they send me 4 other nodes, and then I ping those 4, etc. recursively
yaewa has quit [Read error: Connection reset by peer]
pyon has joined #ocaml
<yminsky> That sounds nicely exponential...
<pippijn> sort of, yes
moei has joined #ocaml
<pippijn> although there are not that many nodes :) in my current probe, there are 71, not all of which actually responded
<pippijn> https://paste.xinu.at/BiXqc/ <- async
<yminsky> It’s hard to see how pinging 71 nodes could peg either LWT or Async for very long...
<pippijn> after a while, it's just maxing out my (quite slow) connection
<pippijn> with around 200kb/s upload
<pippijn> I probably did something else badly in the lwt implementation
darkf has joined #ocaml
<pippijn> with the new implementation, I don't copy strings around that much (more use of Bytes.unsafe_to_string when I just created a new bytes and the only reference to it is my return value)
swgillespie has joined #ocaml
IbnFirnas has quit [Read error: Connection reset by peer]
<yminsky> The code is different in all sorts of ways, which makes it hard to compare the Async/Lwt differences.
<pippijn> yeah
<pippijn> it's probably not lwt to blame, but rather my bad first prototype
swgillespie has quit [Client Quit]
swgillespie has joined #ocaml
<yminsky> Indeed. As much as I like Async, it’s hard for me to imagine that Async’s inherent virtues are the issue here.
<pippijn> it's actually only actively pinging 5 nodes right now
<pippijn> I'll try Lwt again, later
<pippijn> the plan is to keep the IO part small, so that shouldn't be a big task to do later
yminsky has quit [Quit: yminsky]
yminsky has joined #ocaml
jcdyer1 has left #ocaml [#ocaml]
lordkryss has quit [Quit: Connection closed for inactivity]
chouser has quit [Ping timeout: 252 seconds]
AlexRussia has quit [Ping timeout: 246 seconds]
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<nullcat> hi yminsky , I read your (and Anil's) book and started my OCaml programming :)
<nullcat> oh and there is a third author
jabesed has quit [Ping timeout: 240 seconds]
yminsky has quit [Quit: yminsky]
yminsky has joined #ocaml
shinnya has quit [Ping timeout: 264 seconds]
<yminsky> nullcat: Jason Hickey
<nullcat> yep
<yminsky> I hope you liked the book.
<nullcat> I liked it very much. seems you do not appear here often. So, I'd like to catch this chance to ask you some questions?
manizzle has quit [Ping timeout: 244 seconds]
<yminsky> Sure, although I’m going to disappear in just a few minutes.
rz has quit [Quit: Ex-Chat]
<nullcat> does Core team want to fix this issue?
<yminsky> i..e, allow DNS lookups to be done in parallel?
<nullcat> yeah
<yminsky> That sounds reasonable on the face of it. The winbind issue looks like an old one to me. I think we don’t rely on winbind anymore, but I’m not sure. In any case, we can probably make the degree of parallelism tuneable.
<yminsky> Can you file an issue on github?
<nullcat> yep.
<nullcat> now i have to use Mirage's OCaml-DNS to bypass this limitation
<nullcat> thanks
<nullcat> and by the way, i saw lots of Jane Street's poster in my school recently lol
<yminsky> On the Mirage side, we’re working on making Async_kernel not depend on Core (but only on Core_kernel), so it can be used be lwt.
<yminsky> Which school?
<nullcat> UCLA
<yminsky> Nice.
<nullcat> :) and recently heard PhDs in lab talking about the brutal interview they had with your company
<nullcat> anyway, thanks a lot
<whitequark> brutal, hah
<whitequark> yminsky: any plans to get rid of camlp4 dependency?
<yminsky> Yes.
<nullcat> yep that's my another question actually if you have time
<whitequark> say, using ppx_deriving instead of type_conv? :]
<yminsky> Nick Chapman is going to start on that soon.
<nullcat> yeah just wondering if gonna use ppx on sexp
<nullcat> ok cool
<whitequark> we talked about that with Jérémie Dimino but it seems to have went nowhere
<yminsky> I’m not sure if ppx_deriving solves a problem we have. Much of the ppx_deriving framework is about build-system integration and dynamic loading, which is not the path we want to take.
<yminsky> Our internal build will not use ocamlfind.
<whitequark> oh.
<yminsky> Sharing the syntax itself might make sense. We’re about to start talking about this internally.
<whitequark> fwiw, ppx_deriving allows to build static ppx binaries as well
<whitequark> but I see your point
<yminsky> Yeah, dynamic isn’t really what I meant.
<whitequark> I take it you're worried about the overhead of Dynlink?
<whitequark> or something else?
<yminsky> So, I’m probably botching this because I don’t remember the details...
<yminsky> but my memory is that ppx_deriving has a lookup mechanism that is about figuring out which ocamlfind package you need based on the name of the extension.
<whitequark> you are correct, this mechanism used to exist
<yminsky> But is now gone?
<whitequark> it was very awkward and I got rid of it before 1.0.
<nullcat> and any continuation on this mail about lwt and async? It will be good if we can have only one in the future. http://lists.ocaml.org/pipermail/wg-parallel/2013-April/000000.html
<yminsky> Ah, so maybe we should take a second look. I think our primary issue was that it seemed awkward...
<whitequark> yes, I in fact removed it based on diml's feedback :)
<whitequark> (and from others as well)
<whitequark> it was really not a good mechanism
<yminsky> You should email diml and ask him. He and Nick Chapman are going to start working on this project Real Soon Now.
<whitequark> will do!
<yminsky> The Async/Lwt thing is surely awkward.
<whitequark> in a nutshell, ppx_deriving plugins now works much like camlp4 used to
<yminsky> There’s no way we’re switching to Lwt. It’s just too baked into our 3m line codebase.
<yminsky> We’re trying to make Async more suitable for other people’s uses.
<yminsky> The key issue now is portability. There’s an easy and a hard part.
<whitequark> you activate a plugin (like ppx_deriving.std or ppx_deriving_yojson), it pulls in ppx_deriving -ppx option, and passes the right .cma/.cmxs to it.
<whitequark> absolutely no magic.
<nullcat> yep. make sense
<yminsky> The easy part is cutting the dependency on Unix. We’re very close to having that.
<yminsky> In particular, there will soon be a release where Async_kernel depends on Core_kernel, but not Core.
zwer_b is now known as zwer
<yminsky> The hard part is actually porting to other platforms. I suspect the Mirage folk will have an easy time if they decide to do it.
<yminsky> But proper support for Windows takes real work, and I don’t know who is going to do that bit. Probably not us.
<yminsky> But Async has a pretty modularity story (stolen from Lwt! Credit where credit is due), so it shoudln’t be too bad for someone else to contribute.
<yminsky> I’m particularly hopeful about someday being able to use Async from Javascript.
<nullcat> i see. thanks
MrScout_ has joined #ocaml
<nullcat> and I am expecting to use the Core.Applicative :)
siddhart1v has joined #ocaml
<nullcat> to *play with*, actually
<yminsky> I’m looking forward to it too.
<yminsky> Alright, and now I’m off to bed. Cheers all.
<nullcat> see u
yminsky has quit [Quit: yminsky]
siddhart1v has quit [Client Quit]
badkins has quit []
<nullcat> well, although you already left, i just want to say the bug I reported on `rpc_parallel' has been ignored for a month...seems no one gonna fix it
Denommus has joined #ocaml
MrScout_ has quit [Read error: Connection reset by peer]
MrScout_ has joined #ocaml
Puffin has quit [Ping timeout: 276 seconds]
manud has quit [Ping timeout: 265 seconds]
larhat has quit [Quit: Leaving.]
IbnFirnas has joined #ocaml
<struktured> nullcat: +1 for continued discussion on lwt/async
swgillespie has joined #ocaml
billlody has joined #ocaml
<billlody> hello
enitiz has quit [Ping timeout: 255 seconds]
orbitz has quit [Ping timeout: 264 seconds]
orbitz has joined #ocaml
Denommus has quit [Remote host closed the connection]
ivan\ has quit [Read error: Connection reset by peer]
ivan\ has joined #ocaml
ivan\ has quit [Changing host]
ivan\ has joined #ocaml
billlody has quit [Quit: Leaving]
MrScout__ has joined #ocaml
MrScout_ has quit [Ping timeout: 246 seconds]
ygrek_ has quit [Ping timeout: 276 seconds]
rgrinberg has quit [Quit: Leaving.]
IbnFirnas has quit [Ping timeout: 244 seconds]
FrankieDux has joined #ocaml
MrScout__ has quit [Ping timeout: 245 seconds]
rgrinberg has joined #ocaml
ygrek has joined #ocaml
siddhart1v has joined #ocaml
AlexRussia has joined #ocaml
IbnFirnas has joined #ocaml
ygrek has quit [Ping timeout: 252 seconds]
antkong has quit [Quit: antkong]
ivan\ has quit [Read error: Connection reset by peer]
ivan\ has joined #ocaml
ivan\ has quit [Changing host]
ivan\ has joined #ocaml
destrius has quit [Quit: Leaving.]
<struktured> is there any way to reference the last thing returned in utop ?
ebzzry has joined #ocaml
<whitequark> no
<struktured> CTRL-D, restart utop it is then :)
<struktured> if only closing the plotter using the mouse didn't wipe out utop
ygrek has joined #ocaml
MercurialAlchemi has joined #ocaml
AltGr has left #ocaml [#ocaml]
MrScout has joined #ocaml
<nullcat> i guess some people woke already, so I'd like to put my question here again.
antkong has joined #ocaml
<nullcat> It's about the module system. I copied my .mli here: https://gist.github.com/anonymous/d40881662c47f26d8320. How should I write the server module's signature in main.mli like I wrote the signature of Negotiation and Transfer in the same file? I am trying to do it like cohttp's style of defining module types. And here is some background: module Server will use module Negotiation and module Transfer.
<nullcat> should it be something like "module type Server = with type 'a t = 'a Deferred.t and ... and ..."?
<MercurialAlchemi> why don't you use functors?
MrScout has quit [Ping timeout: 255 seconds]
<nullcat> main.mli's19-22 is the type of functor
<nullcat> the functor should return newly defined Server module type
Simn has joined #ocaml
<MercurialAlchemi> nullcat: well, you have two problems
<MercurialAlchemi> it's 'with type foo = bar', not 'with type foo := bar'
<MercurialAlchemi> the second problem is that in your server module, your type is not "t", it's "'a t"
<MercurialAlchemi> if you replace your "type t := t" with "type 'a t = 'a t", it will work
<MercurialAlchemi> assuming Crypto is defined
<MercurialAlchemi> Do you use Merlin ?
<nullcat> no
<nullcat> but when do u use type t := some_other_type?
<nullcat> I should use merlin
<MercurialAlchemi> If you use vim/emacs, I strongly suggest you try, it will make your life much easier
<nullcat> thanks! I should
<MercurialAlchemi> hm, turns out := works too
<MercurialAlchemi> must be old leftover syntax
<MercurialAlchemi> stick with = :)
<nullcat> so in this .mli file
<nullcat> it uses "=" sometime, and then ":=" sometime
<nullcat> I don't quite understand their difference
<nullcat> but yeah... still for my question, how should I fill up the "???" in the .mli file?
<nullcat> in the main.mli file
<MercurialAlchemi> What "???"?
<nullcat> on line 17 of main.mli in the link
rgrinberg has quit [Quit: Leaving.]
<nullcat> if you scroll down the webpage you can see it
<def`> := is destructive
<MercurialAlchemi> the manual says '='
<MercurialAlchemi> def`: destructive?
<MercurialAlchemi> nullcat: I see
rgrinberg has joined #ocaml
<def`> all occurences of t are replaced by rhs, and declaration is removed
<def`> = just mark t as an alias
antkong has quit [Read error: Connection reset by peer]
<nullcat> thanks. it is clearer to me now.
<MercurialAlchemi> def`: you mean that if you use 'with type t := foo' in module Bar, you don't have Bar.t?
_5kg has quit [Read error: Connection reset by peer]
<MercurialAlchemi> nullcat: usually, you'd have a Make module inside your server module
<def`> MercurialAlchemi: yes
_5kg has joined #ocaml
<MercurialAlchemi> def`: interesting but a bit subtle
<MercurialAlchemi> nullcat: look at how Map (from Pervasives) is done: http://caml.inria.fr/pub/docs/manual-ocaml/libref/Map.html
<nullcat> thanks for the reference!
<MercurialAlchemi> def`: it's unfortunate that http://caml.inria.fr/pub/docs/manual-ocaml-4.02/modtypes.html doesn't think it's important enough to talk about it :(
<nullcat> oh merging signature is a good example
FrankieDux has left #ocaml ["WeeChat 1.1.1"]
<MercurialAlchemi> def`: thanks
<nullcat> def` thanks
<MercurialAlchemi> I think I'll stick to '=' until I find a good reason to use ':=' :)
<nullcat> and I guess in my case, both are fine
<def`> := makes shorter signature in the typed ast, it's easier to read from tool like merlin
<def`> = is useful to satisfy functor argument signatures
<def`> depends on the intended audience :). If it is for factoring first-order signatures, I prefer :=, otherwise =
<struktured> you guys are way more sophisticated than me. I follow the whatever compiles first paradigm
<def`> … which is fine ;). You'll have more success using = first in your DFS ;)
<struktured> def`: noted :)
AlexRussia has quit [Ping timeout: 245 seconds]
Haudegen has quit [Ping timeout: 240 seconds]
<MercurialAlchemi> = wins on account on having one less character
AlexRussia has joined #ocaml
<MercurialAlchemi> also, I like the "ModuleName.t" convention
IbnFirnas has quit [Read error: Connection reset by peer]
<nullcat> lol
reem has joined #ocaml
dsheets has joined #ocaml
<MercurialAlchemi> If I liked to type a lot of code I wouldn't be using OCaml :)
marynate has joined #ocaml
larhat has joined #ocaml
Haudegen has joined #ocaml
AlexRussia has quit [Ping timeout: 240 seconds]
dsheets has quit [Ping timeout: 264 seconds]
siddhart1v has quit [Quit: leaving]
siddharthv has quit [Quit: Lost terminal]
siddharthv has joined #ocaml
siddharthv has left #ocaml [#ocaml]
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
siddharthv has joined #ocaml
siddharthv has left #ocaml [#ocaml]
MrScout has joined #ocaml
rgrinberg has quit [Quit: Leaving.]
MrScout has quit [Ping timeout: 256 seconds]
zwer has quit [Ping timeout: 250 seconds]
hellofunk has joined #ocaml
sigjuice_ has quit [Quit: Lost terminal]
pii4 has quit [Quit: [-.-]...]
IbnFirnas has joined #ocaml
pii4 has joined #ocaml
avsm has joined #ocaml
yomimono has joined #ocaml
dsheets has joined #ocaml
ivan\ has quit [Remote host closed the connection]
ivan\ has joined #ocaml
<imslavko> I want to create a type with a constructor of record, how can I do this? type t = A of { x:int; y:string } didn't work :(
<dsheets> imslavko, name the record type
<imslavko> I see, thanks!
<dsheets> i think inline record types are being contemplated for inclusion soon but naming isn't so bad
<MercurialAlchemi> dsheets: makes for more readable type signatures at any rate
<imslavko> yeah, and that would be far more intuitive
<MercurialAlchemi> mm, never mind, it actually doesn't
<dsheets> yes, also easier to talk about the type of the content of the constructor
planetlarg has joined #ocaml
<imslavko> another question, why doesn't this work?
<imslavko> type a = {field: T list;} ;;
<imslavko> type b = | T | D ;;
ggole has joined #ocaml
<imslavko> I get a syntax error on "field: T list"
<flux> T isn't a type
<flux> it's a way to make a type (constructor)
<flux> well, to make an instance of a type that is, so to make a value
<flux> ..of that certain type :)
bobry has joined #ocaml
<imslavko> is there a way to tell compiler that "field" is expected to be of constructor T but not D?
<dsheets> imslavko, make type b a gadt and ascribe the T constructor
<flux> well, you would do: { field : unit list } in this case
<flux> or if it was: type b = T of string | D
<flux> then you would do: { field : string list }
<flux> or possibly: type t = string type b = T of t type a = { field : t list }
<imslavko> dsheets: sorry, didn't catch that at all?
<imslavko> flux: makes sense, I will try, thanks
<ggole> It'd be nice for that to be possible without GADTs
MrScout has joined #ocaml
<flux> well, the situation would need to be complicated for gadts to be of benefit?
<flux> more likely they will just cause trouble ;-)
<dsheets> type t;; type d;; type 'a b = T : t b | D : d b;; type a = { field : t b list; }
<ggole> Which is why it would be nice to be able to do it without resorting to them
<flux> imslavko, I wouldn't worry about GADTs at this point of learning OCaml.
<dsheets> but it *is* possible
<dsheets> alternatively, polymorphic variants
hannes has quit [Quit: Coyote finally caught me]
<imslavko> yeah, I didn't realize GADT is a special term
<dsheets> type t = `T;; type d = `D;; type b = [ t | d ];; type a = { field : t list };;
<dsheets> perhaps easier (but difficult in different ways)
MrScout has quit [Ping timeout: 240 seconds]
ollehar has joined #ocaml
<MercurialAlchemi> dsheets: what does T : t b do, as opposed to T of t b?
<flux> just out of curiousty: what would this look like in OCaml?-) static inline void Pow10(float *f) { *(int32_t *)f = *f * 27866352.6 + 1064866808.0; };
<dsheets> MercurialAlchemi, T : t b says that constructor T is always a t b but T of t b means that constructor T contains a t b (recursively)
<dsheets> T of t b == T : t b -> 'a b
planetlarg has quit [Remote host closed the connection]
<MercurialAlchemi> mm
<companion_cube> hmmmmm, I missed a discussion lwt/async this night ;?
<companion_cube> :/
<MercurialAlchemi> dsheets: is this an extension? the manual claims that constr-decl is 'constr-name | constr-name of typexpr { * typexpr }'
<MercurialAlchemi> (I don't really understand the point of splitting extensions in their own sections...)
nullcat has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<companion_cube> did anyone show http://rgrinberg.com/blog/2014/12/11/abandoning-async/ to yminsky?
mort___ has joined #ocaml
avsm has quit [Quit: Leaving.]
ingsoc has joined #ocaml
claudiuc has quit [Remote host closed the connection]
claudiuc has joined #ocaml
thomasga has joined #ocaml
claudiuc has quit [Ping timeout: 272 seconds]
planetlarg has joined #ocaml
IbnFirnas has quit [Read error: Connection reset by peer]
keen__________46 has joined #ocaml
keen__________45 has quit [Ping timeout: 276 seconds]
larhat has quit [Read error: Connection reset by peer]
larhat1 has joined #ocaml
yomimono has quit [Ping timeout: 246 seconds]
jonludlam has joined #ocaml
reem has quit [Remote host closed the connection]
Haudegen has quit [Ping timeout: 240 seconds]
AlexRussia has joined #ocaml
Haudegen has joined #ocaml
avsm has joined #ocaml
mort___1 has joined #ocaml
mort___ has quit [Ping timeout: 265 seconds]
_andre has joined #ocaml
uris77 has joined #ocaml
thomasga has quit [Quit: Leaving.]
IbnFirnas has joined #ocaml
axiles has joined #ocaml
thomasga has joined #ocaml
ivan\ has quit [Read error: Connection reset by peer]
ivan\ has joined #ocaml
ivan\ has quit [Changing host]
ivan\ has joined #ocaml
hellofunk has quit [Remote host closed the connection]
yomimono has joined #ocaml
vanila has joined #ocaml
AlexRussia has quit [Ping timeout: 276 seconds]
mort___1 has quit [Quit: Leaving.]
aluuu has joined #ocaml
marynate has quit [Ping timeout: 264 seconds]
MrScout has joined #ocaml
marynate has joined #ocaml
mort___ has joined #ocaml
MrScout has quit [Ping timeout: 256 seconds]
marynate has quit [Ping timeout: 244 seconds]
marynate has joined #ocaml
hellofunk has joined #ocaml
lordkryss has joined #ocaml
yminsky has joined #ocaml
psy_ has quit [Ping timeout: 272 seconds]
yomimono has quit [Ping timeout: 244 seconds]
yomimono has joined #ocaml
aluuu has quit [Ping timeout: 245 seconds]
psy_ has joined #ocaml
marynate has quit [Ping timeout: 244 seconds]
marynate has joined #ocaml
avsm has quit [Quit: Leaving.]
marynate has quit [Ping timeout: 244 seconds]
uris77 has quit [Quit: leaving]
thomasga has quit [Quit: Leaving.]
moei has quit [Read error: Connection reset by peer]
moei has joined #ocaml
IbnFirnas has quit [Read error: Connection reset by peer]
jonludlam has quit [Ping timeout: 256 seconds]
yminsky has quit [Quit: yminsky]
ebzzry has quit [Remote host closed the connection]
avsm has joined #ocaml
avsm1 has joined #ocaml
avsm has quit [Read error: Connection reset by peer]
ygrek has quit [Ping timeout: 246 seconds]
IbnFirnas has joined #ocaml
skinkitten has joined #ocaml
psy_ has quit [Read error: Connection reset by peer]
psy_ has joined #ocaml
psy_ has quit [Max SendQ exceeded]
psy_ has joined #ocaml
AlexRussia has joined #ocaml
ivan\ has quit [Remote host closed the connection]
ivan\ has joined #ocaml
avsm1 has quit [Quit: Leaving.]
larhat has joined #ocaml
larhat1 has quit [Ping timeout: 240 seconds]
badkins has joined #ocaml
avsm has joined #ocaml
avsm1 has joined #ocaml
avsm has quit [Ping timeout: 256 seconds]
MrScout has joined #ocaml
bytbox has quit [Remote host closed the connection]
Puffin has joined #ocaml
Submarine has joined #ocaml
Submarine has quit [Changing host]
Submarine has joined #ocaml
paradoja has joined #ocaml
antkong has joined #ocaml
mort___ has quit [Ping timeout: 265 seconds]
MrScout has quit [Ping timeout: 245 seconds]
IbnFirnas has quit [Read error: Connection reset by peer]
myst|work has quit [Quit: Lost terminal]
iago has joined #ocaml
billlody has joined #ocaml
<iago> Hi, I have a module defining a type `t', and in that very same module I'm trying to type a type `set' of `t' by instantiating the Set.Make functor, but this doesn't work because in Set.Make(struct type t = t ... end) , type t = t is considered a cyclic definition. Is there any way to tell ocaml that the second `t' refers to a type which is already in scope? Thanks
paradoja has left #ocaml ["Killed buffer"]
shinnya has joined #ocaml
<companion_cube> I don't know any clean solution to this (too bad "rec" wasn't used for types), so usually I write an alias
myst|work has joined #ocaml
<companion_cube> type foo = t
<companion_cube> module Set = Set.Make(struct type t = foo .... end)
thomasga has joined #ocaml
<ia0> or maybe
<ia0> Set.Make(struct type t_tmp = t type t = t_tmp ... end)
<ia0> this way you do not pollute any scope
jonludlam has joined #ocaml
<iago> yeah, thanks
<iago> I was thinking of declaring a submodule "module Elt = struct type t = ... end" so I could refer to Elt.t, and then "open Elt", but seems a bit excessive
bytbox has joined #ocaml
MrScout has joined #ocaml
enitiz has joined #ocaml
AlexRussia has quit [Ping timeout: 240 seconds]
AlexRussia has joined #ocaml
zwer has joined #ocaml
oriba has joined #ocaml
IbnFirnas has joined #ocaml
troydm has quit [Quit: What is hope? That all of your wishes and all of your dreams come true? (C) Rau Le Creuset]
rock_neurotiko has joined #ocaml
rock_neurotiko has quit [Remote host closed the connection]
thomasga has quit [Quit: Leaving.]
mort___ has joined #ocaml
Denommus has joined #ocaml
ivan\ has quit [Read error: Connection reset by peer]
ivan\ has joined #ocaml
pii4 has quit [Ping timeout: 245 seconds]
pii4 has joined #ocaml
Puffin is now known as BitPuffin
AlexRussia has quit [Ping timeout: 246 seconds]
uris77 has joined #ocaml
antkong has quit [Ping timeout: 246 seconds]
Hannibal_Smith has joined #ocaml
darkf has quit [Quit: Leaving]
Intensity has quit [Changing host]
Intensity has joined #ocaml
avsm1 has quit [Quit: Leaving.]
Kakadu has joined #ocaml
mobajm has joined #ocaml
mobajm has quit [Client Quit]
troydm has joined #ocaml
marynate has joined #ocaml
aubergines has joined #ocaml
avsm has joined #ocaml
Denommus has quit [Ping timeout: 265 seconds]
larhat has quit [Quit: Leaving.]
enitiz has quit [Ping timeout: 272 seconds]
thomasga has joined #ocaml
<flux> I don't think it is, though :)
<flux> you can put other stuff like to_string, of_string nicely under the module as well
jabesed has joined #ocaml
rand000 has joined #ocaml
bytbox has quit [Remote host closed the connection]
thomasga has quit [Quit: Leaving.]
keen__________47 has joined #ocaml
keen__________46 has quit [Ping timeout: 252 seconds]
swgillespie has joined #ocaml
bobry has quit [Quit: Connection closed for inactivity]
enitiz has joined #ocaml
chinglish has joined #ocaml
shinnya has quit [Ping timeout: 240 seconds]
shinnya has joined #ocaml
thomasga has joined #ocaml
enitiz has quit [Ping timeout: 272 seconds]
iago has quit [Ping timeout: 255 seconds]
ollehar has quit [Ping timeout: 255 seconds]
rgrinberg has joined #ocaml
ivan\ has quit [Read error: Connection reset by peer]
ivan\ has joined #ocaml
billlody has quit [Ping timeout: 256 seconds]
slash^ has joined #ocaml
arj has joined #ocaml
arj has quit [Client Quit]
chaptastic has joined #ocaml
Submarine has quit [Remote host closed the connection]
tane has joined #ocaml
struktured has quit [Remote host closed the connection]
ivan\ has quit [Ping timeout: 240 seconds]
struktured has joined #ocaml
ivan\ has joined #ocaml
oriba has quit [Quit: oriba]
mort___ has quit [Ping timeout: 265 seconds]
avsm has quit [Quit: Leaving.]
jonludlam has quit [Quit: Coyote finally caught me]
marynate has quit [Quit: Leaving]
leowzukw has joined #ocaml
olauzon has joined #ocaml
mobajm has joined #ocaml
yomimono has quit [Ping timeout: 245 seconds]
ebzzry has joined #ocaml
bytbox has joined #ocaml
dsheets has quit [Ping timeout: 264 seconds]
jwatzman|work has joined #ocaml
rand000 has quit [Ping timeout: 265 seconds]
ivan\ has quit [Read error: Connection reset by peer]
chinglish has quit [Quit: Nettalk6 - www.ntalk.de]
ivan\ has joined #ocaml
enitiz has joined #ocaml
Kakadu has quit [Quit: Page closed]
uris77 has quit [Ping timeout: 256 seconds]
Anarchos has joined #ocaml
<ingsoc> is it because I am just not yet that familiar with ocaml code and documentation or is the format for things like Core's docco awkward to read ?
<ingsoc> the API docs etc.
<ingsoc> be nice if there was an easy sortable/filterable way to find functions and moduels
<ingsoc> (unless I am just not looking in the right place)
<companion_cube> ocamldoc is a bit limited for big projects like Core
<companion_cube> dsheet is working on opam-doc, which would make doc better
<Drup> (and Core documentation sucks)
<companion_cube> ingsoc: if you want to navigate doc, you can give a try to ocp-browser
<ingsoc> ok
q66 has joined #ocaml
<companion_cube> well, signatures, rather, but it does both
aluuu has joined #ocaml
planetlarg has quit [Ping timeout: 272 seconds]
reem has joined #ocaml
<ingsoc> are there any tips for development workflow people use while developing in ocaml ?
jao has joined #ocaml
jao has quit [Changing host]
jao has joined #ocaml
<companion_cube> what do you mean exactly?
<Anarchos> ingsoc develop the interface first ; use noweb to code the latter and to document the code.
<companion_cube> right, write .mli first
<companion_cube> use defensive types if possible
<ingsoc> I have just alowed them to be auto created up til now but I have only been writing very simple stuff then tinkering with it in utop
<Drup> I actually don't write my .mli first unless I really know exactly the interface I want
<Drup> and that's not often the case
slash^ has quit [Read error: Connection reset by peer]
* companion_cube tends to alternate between .mli and .ml
<companion_cube> refining one by writing the other, and then swapping
slash^ has joined #ocaml
jao has quit [Remote host closed the connection]
jonludlam has joined #ocaml
jao has joined #ocaml
jao has quit [Changing host]
jao has joined #ocaml
bytbox has quit [Ping timeout: 255 seconds]
enitiz has quit [Ping timeout: 272 seconds]
<Anarchos> ingsoc does it fulfill your questions ?
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Hannibal_Smith has quit [Quit: Leaving]
bytbox has joined #ocaml
arj has joined #ocaml
bytbox has quit [Remote host closed the connection]
rgrinberg has quit [Quit: Leaving.]
rgrinberg has joined #ocaml
swgillespie has joined #ocaml
dsheets has joined #ocaml
jabesed has quit [Quit: Konversation terminated!]
jabesed has joined #ocaml
mort___ has joined #ocaml
jao has quit [Ping timeout: 276 seconds]
Haudegen has quit [Ping timeout: 244 seconds]
ygrek has joined #ocaml
Haudegen has joined #ocaml
swgilles_ has joined #ocaml
swgilles_ has quit [Client Quit]
swgillespie has quit [Ping timeout: 264 seconds]
enitiz has joined #ocaml
axiles has quit [Ping timeout: 264 seconds]
Kakadu has joined #ocaml
uris77 has joined #ocaml
mort___ has quit [Quit: Leaving.]
aluuu has quit [Ping timeout: 264 seconds]
ivan\ has quit [Remote host closed the connection]
<ingsoc> Anarchos: It was just a general question about tips/tricks/tools for going from idea to solution. e.g. I am kinda used to creating top level functions and then using a REPL (top level) to test/flesh them out then and maybe throw in some unit testing where required where I keep writing module code then testing in repl until I can pass the test
<ingsoc> (in other language)
<ingsoc> is this a similar thing for ocaml
ivan\ has joined #ocaml
<companion_cube> utop is fine for that
<companion_cube> and *do* use merlin
jonludlam has quit [Ping timeout: 244 seconds]
_andre has quit [Quit: leaving]
ggole has quit []
<Drup> in the ocaml emacs mode, you can send an expression directly to a REPL, but I personally never use that.
<MercurialAlchemi> how did I ever manage to live without polymorphic variants?
<Anarchos> ingsoc what is a REPL ?
<Drup> Anarchos: toplevel
<Drup> MercurialAlchemi: you didn't know you wanted it :D
<MercurialAlchemi> indeed
<flux> mercurialalchemi, you will find out they are not the best thing since sliced bread :)
<Drup> (beware, excess of polymorphic variant can cause nausea, headaches, huge unreadable error messages and confusing type errors)
<ingsoc> Drup: so you write a number of functions and then compile and run and check output ?, and do you add logging and print statements
<ingsoc> I have always found being constantly checking and probing within a repl invaluable
<ingsoc> (when one is available) which it is with the top level for ocaml
<ingsoc> just curious
<Drup> ingsoc: or I load the library I defined in a repl
<Drup> but I don't past the code to the repl
<Drup> it's unreadable too fast
<ingsoc> yeah that is what i mean
<ingsoc> mod_use
<ingsoc> or whatever it is ?
<MercurialAlchemi> Drup: noted
<companion_cube> +1 for writing a library and loading it in toplevel
<MercurialAlchemi> flux: they are not?
<ingsoc> mod_use*
WraithM has joined #ocaml
<Drup> ingsoc: I usually directly define a real library and use #require
<ingsoc> ok, i need to read more. how is a "real library" defined compared to just a <mod_name>.ml
<companion_cube> a library is a bunch of modules, and it can be used through ocamlfind (usually)
<flux> mercurialalchemi, you will get less friendly type errors
<ingsoc> i am currently writing amodules and in my and adding a mod_use for each on in my per project .ocamlinit as i write them
<Drup> flux: that's not necessarily the case, it depends a lot of what you are doing with them
<ingsoc> omg, keyboard fail
<MercurialAlchemi> flux: I can live with that
<Drup> MercurialAlchemi: yeah, actually, with some of them, you can't.
<ingsoc> *** I am currently writing modules and then adding a mod_use for each oen in my per project .ocamlinit as i write them
<ingsoc> one*
<Drup> ingsoc: when you start having dependencies and stuff, this does not scale well :D
<MercurialAlchemi> Drup: can't live with them?
manizzle has joined #ocaml
<Drup> MercurialAlchemi: I mean, I once obtained a several megabyte type error.
<ingsoc> Drup: oh yeah, of course, hence why the discussion :)
slash^ has quit [Read error: Connection reset by peer]
<MercurialAlchemi> Drup: awesome
<flux> drup, well, if you just use them for everything, they will come and hunt you.. ;-)
<MercurialAlchemi> generated code?
<Drup> (yes ...)
mort___ has joined #ocaml
<Drup> but still !
<ingsoc> this is just as I play with writing modules and then play with calling the functions passing data and checking returns
<MercurialAlchemi> figures
<Drup> you can obtain some quite hairy one with hand written code
<Drup> ingsoc: which build system are you using ?
<MercurialAlchemi> yeah, I can imagine
<MercurialAlchemi> but still
bytbox has joined #ocaml
<ingsoc> Drup: just have a makefile to drive stuff like...
<ingsoc> MAIN_MODULE obv. being the let () = containing module
<ingsoc> ocamlbuild -use-ocamlfind $(MAIN_MODULE).native
<MercurialAlchemi> I suppose that you can run into the same kind of issue if you abuse objects
<Drup> MercurialAlchemi: it's much easier to abuse poly variant, though
<ingsoc> I am just interested in peoples workflow
<ingsoc> just curious
<MercurialAlchemi> Drup: I'll watch my fingers
leowzukw has quit [Quit: Lost terminal]
<Drup> ingsoc: my workflow for a small new library is "define a library that is installable with opam (usually, with oasis) create a subdirectory src/ and tests/. Define *non-unit* tests (I usually don't bother to unit-test)." Then "pin locally with opam, install & load on utop/use in some dependency. Repeat until satisfaction".
Thooms has joined #ocaml
dmiles_afk has joined #ocaml
<Drup> MercurialAlchemi: look at tyxml
<MercurialAlchemi> at least if you shoot yourself in the foot, the worse that will happen is that your program won't compile but you won't understand why
<Drup> MercurialAlchemi: actually, not always
mort___ has quit [Quit: Leaving.]
<MercurialAlchemi> no?
<Drup> well, sure, in the end, that's it. But the issue with poly variants is that coherence of the type is not enforced anymore
<Drup> (well, there are other issues)
<MercurialAlchemi> I'm not sure what you mean by that
avsm has joined #ocaml
<ingsoc> Drup: I am interested in hearing more about what thsi entails..."""Then "pin locally with opam, install & load on utop/use in some dependency."""
<ingsoc> Maybe it is too early days in my ocaml journey to jump in to this just yet as I am only touching the surface but it would be good to hear how this is done
<MercurialAlchemi> unless you mean that it's a bit like duck typing, and that `Terminate can mean one thing in the Process module, and another in the Terminator module
<Drup> so, if you define a library and you define a function that produces `Zigouigoui and a function that consumes `Zigougoui
<Drup> you'll notice the typo only if you try to combine the functions
<Drup> basically, it forces you to add more tests.
<Drup> (or to expose yourself to typoes.)
tobiasBo1 has joined #ocaml
<MercurialAlchemi> hmm
<Drup> with non-poly variants, you can't do typoes that way
<MercurialAlchemi> but if you define a type zigouigoui = `Zigougoui, and use this in the signature, you won't have any problem
<Drup> don't annotate poly variants manually
<Drup> at least not if you want any sanity
englishm has joined #ocaml
englishm has quit [Changing host]
englishm has joined #ocaml
chaptast_ has joined #ocaml
<Drup> (and also, using poly variants and annotating makes the fact that you use them a bit pointless)
enitiz has quit [Ping timeout: 272 seconds]
<MercurialAlchemi> Drup: not entirely
dbrumley has joined #ocaml
<Drup> sure, not entirely, but still
<MercurialAlchemi> in my case, I'm essentially partitioning a domain
dmbaturin_ has joined #ocaml
<Drup> (the typo probably is something we had for a while in not-very-used parts of tyxml)
<Drup> problem*
ohama has quit [Disconnected by services]
<MercurialAlchemi> type foo = `Foo; type bar = `Bar ; type foo_bar = [ foo | bar ];;
ohama has joined #ocaml
dwoos_ has joined #ocaml
<Drup> sure
<MercurialAlchemi> which lets me create data which only accept foo, others which only accept bar, and sometimes pattern match into a foo_bar binding
<MercurialAlchemi> I could do that with normal variants, but it would be painful
<Drup> (note that you could probably do that with gadts :p)
<MercurialAlchemi> I need to spend more time with gadts before I convince myself that they're not worth the trouble :)
<Drup> that applies to poly variants too
uris77_ has joined #ocaml
dmiles has quit [Ping timeout: 264 seconds]
tobiasBora has quit [Ping timeout: 264 seconds]
psy_ has quit [Ping timeout: 264 seconds]
dmbaturin has quit [Ping timeout: 264 seconds]
englishm_ has quit [Ping timeout: 264 seconds]
bytbox has quit [Ping timeout: 264 seconds]
dbrumley_ has quit [Ping timeout: 264 seconds]
dwoos has quit [Ping timeout: 264 seconds]
chaptastic has quit [Ping timeout: 264 seconds]
chouser has joined #ocaml
uris77 has quit [Remote host closed the connection]
dwoos_ is now known as dwoos
<Drup> anyway, you'll see
<Drup> (and look at tyxml :D)
<MercurialAlchemi> yeah
psy_ has joined #ocaml
<MercurialAlchemi> I've seen the huge event list
<MercurialAlchemi> not sure it would look prettier with standard variants
<Drup> ahah
<Drup> it's not even possible with standard variants ...
rgrinberg has quit [Quit: Leaving.]
<chouser> Has anyone used a language with instance-typing? I find I wish for it a bit in OCaml.
<Drup> chouser: what is instance typing ?
<chouser> It's when the compiler tracks slightly more than just the named type for a particular usage (I'm sure I'm describing this poorly)
<Drup> that's a bit vague
<Drup> but I suppose you mean
<MercurialAlchemi> Drup: the event part - why couldn't you do with standard variables? I can see why you'd want that for html elements though
<Drup> match x with Foo _ -> .. (* the compiler knows it's a Foo *) ...
<chouser> For example, if you have already matched x to be a specific kind of variant Foo, and then a little later match on it again, the compiler could know it already has to be a Foo and not complain about an incomplete match when you don't account for other possibliities.
jabesed has quit [Ping timeout: 245 seconds]
<chouser> Drup: yes, I think that's right.
<Drup> yeah
<Drup> so, it's something you can do with gadts
<chouser> Would be especially useful in OCaml since it can infer types across function boundaries.
<chouser> Here's the instance-typing paper, fwiw: http://dl.acm.org/citation.cfm?id=2376341
<Drup> not in an univ right now, so can't read
jabesed has joined #ocaml
<MercurialAlchemi> chouser: doesn't that turn into weird error messages, though?
<Drup> chouser: the pdf is so broken it's not funny.
<nicoo> Drup: Yup :(
<chouser> My only experience with it is in clojure.core.typed, which is different in that function sigs must be annotated. But in that context, it seems to lead to very clear and pleasant errors.
<Drup> chouser: do you have a use cases in ocaml ?
<Drup> -a
Tekk_ has quit [Remote host closed the connection]
<Drup> because, except when imitating OOP style, you don't often really need that.
rgrinberg has joined #ocaml
<chouser> Drup: just a few places where the compiler insists I include match clauses for things that could never actually happen.
<Drup> (and when you do, well, gadts or assert false :D)
<chouser> such as helper functions that are only ever called for certain kinds variants, and yet need to handle the larger type.
<chouser> Drup: clearly I need to read about gadts
<Drup> (or poly variants)
<chouser> why not call them fist-class phantom types? Sounds so much cooler. ;-)
<Drup> ~phantom~
<Drup> MercurialAlchemi: I missed the occasion to answer about events: events are a negligeable and small part of tyxml poly variants
<MercurialAlchemi> Drup: I see how you could run into trouble easily with the HTML elements
oriba has joined #ocaml
<Drup> exactly
<MercurialAlchemi> but I don't understand why, even internally, you wouldn't want to type-alias a bunch of, say, block-level HTML elements to avoid typos
Rebelion has quit [Ping timeout: 256 seconds]
<Drup> that's what we do, but when there are so many elements, even when defining it like that, you can have issues
<MercurialAlchemi> well, you know what Peter Parker has to say about that
Rebelion has joined #ocaml
<MercurialAlchemi> with great polymorphic variants come great responsibilities
<Drup> :D
<MercurialAlchemi> What would be a type-safe(r) alternative anyway?
<Drup> gadt with subtyping :>
ygrek has quit [Ping timeout: 245 seconds]
<Drup> (also, proper row polymorphism)
<def`> don't know what you guys are talking about, but when I open IRC and see "gadt with subtyping", I know something wrong is happening
<companion_cube> the solution is never to close IRC
<Drup> def`: I want subtypings gadts <3
<MercurialAlchemi> def`: choose your poison, gadts or polymorphic variants
arj has quit [Quit: Leaving.]
<Drup> why choose ?
<Drup> Use both !
olauzon has quit [Quit: olauzon]
<MercurialAlchemi> I choose polymorphic variants, mostly because I don't think I understand gadts fully
<Drup> (and phantom type)
<Drup> (and functors)
<Drup> everything ! \O/
<MercurialAlchemi> phantom functors
<MercurialAlchemi> with subtyping
<MercurialAlchemi> then we could have a contest for the longest, least understandable type error
Stany has joined #ocaml
<Drup> MercurialAlchemi: don't forget implicits with HKTs.
<Drup> (just to make def` cringe :D)
<MercurialAlchemi> not fair, implicits are still living in their own fork
<MercurialAlchemi> and, hm, HKTs don't live at all, AFAIK...
mort___ has joined #ocaml
<Drup> well, with implicits, they sort of do.
Tamae has quit [Ping timeout: 256 seconds]
<MercurialAlchemi> how's that?
sinelaw has joined #ocaml
yomimono has joined #ocaml
<sinelaw> hi. how often are polymorphic record fields actually used? I mean higher-rank
IbnFirnas has quit [Ping timeout: 244 seconds]
<Drup> sinelaw: not often
<Drup> I've seen it 2 or 3 times
IbnFirnas has joined #ocaml
Nahra has joined #ocaml
<sinelaw> Drup, so for something like data structures, usually people just define normal polymorphic functions outside of records?
<sinelaw> when you want to pack a bunch of them, records would be useful
<def`> (Drup: implicits with subtyping… given the current implementation, you're not gonna win the error message contest, but your code will surely not typecheck :))
<Drup> (def`: I know)
<sinelaw> Drup, or perhaps using modules?
ivan\ has quit [Read error: Connection reset by peer]
<Drup> sinelaw: do you have an example ?
avsm has quit [Quit: Leaving.]
thomasga has quit [Ping timeout: 272 seconds]
ivan\ has joined #ocaml
ivan\ has quit [Changing host]
ivan\ has joined #ocaml
reem has quit [Remote host closed the connection]
<sinelaw> Drup, { x: X list , map: X -> (X -> 'a) -> 'a list }
reem has joined #ocaml
<MercurialAlchemi> does anyone use :ML and :MLI in merlin:
<MercurialAlchemi> ?
<def`> I do
<sinelaw> Drup, that's kinda dumb. The real example is that I'm implementing a type checker for object oriented methods, in which case the above example may make more sense.
<MercurialAlchemi> def`: do you often give it another argument that the current file?
<sinelaw> Drup, it's for a type system with some similarities to ocaml
<def`> MercurialAlchemi: of course, that's how I navigate most of the time
<MercurialAlchemi> right
<MercurialAlchemi> I'm a ctrl-p person :)
<def`> if you just want to switch between .ml/.mli better use :A /alternate
<Drup> (for emacs uses, what does it do ?)
<Drup> users*
<def`> Drup: merlin-switch-to-ml(i) List
<def`> M-x merlin-sw…
<sinelaw> Drup, sorry that was also wrong. Here it is: type 'b t = { x: (something internal) , map: 'b t -> ('b -> 'a) -> 'a list }
<sinelaw> t is a recursive type
<MercurialAlchemi> def`: what is :A?
<def`> MercurialAlchemi: I wrote them before having heard of ctrl-p… I am satisfied with that, but a ctrl-p binding was added recently, is that what you are using?
<sinelaw> and really one would want 'map' to be polymorphic: map: 'a. 'b t -> ('b -> 'a) -> 'a list
<MercurialAlchemi> doesn't work here...
<Drup> sinelaw: but, you can't do anything with such map function
<Drup> it's always going to return something you don't know anything about
<def`> MercurialAlchemi: it's not something provided by merlin, it's another vim plugin, wait
<MercurialAlchemi> def`: oh
<def`> "vim-a" on ArchLinux, switch between .c/.h, .ml/.mli, etc
<sinelaw> Drup, how so? the quantifier on 'a is on the map function, not on its result
<MercurialAlchemi> def`: I can see why you would to use that - I hadn't noticed the autocomplete
<Drup> sinelaw: can you show me an interesting inhabitant for that type
<Drup> def`: oh, didn't know this one ! :O
jave has quit [Ping timeout: 244 seconds]
<Drup> (I do use C-c C-a a lot, though)
<def`> yep, C-c C-a is exactly what vim-a provides
* MercurialAlchemi goes to install more vim crap
<Drup> MercurialAlchemi: one more steps towards OS inception.
<MercurialAlchemi> Drup: IDE inception, at least
<MercurialAlchemi> don't have a mail client just yet
<def`> héhé, vim crap… so useful but really deserve this name :D
jave has joined #ocaml
<MercurialAlchemi> yeah well
vincom2 has quit [Remote host closed the connection]
<MercurialAlchemi> vimscript
<MercurialAlchemi> :D
vincom2 has joined #ocaml
Tekk_ has joined #ocaml
uris77_ has quit [Ping timeout: 240 seconds]
<Tekk_> Anyone know why stuff like List.find throws an exception rather than return an option?
<Drup> Tekk_: because stdlib ? :D
<Tekk_> Drup: good point :D
<Tekk_> oh look, Core fixes that
<Tekk_> well then
<Tekk_> :P
<Drup> not only Core, but yes :)
<Tekk_> you know, when I saw yminsky in here before I was going to suggest that the next version of RWOC makes it clear what's Core behavior/functions and what's stdlib...
<Tekk_> but the more I do stuff the more it's just "yeah, you should just use core instead of stdlib all the time.."
dsheets has quit [Ping timeout: 264 seconds]
thomasga has joined #ocaml
<sinelaw> Drup
* MercurialAlchemi likes containers
<sinelaw> type 'b myList = { internal: 'b list ; map: 'a. 'b myList -> ('b -> 'a) -> 'a list };;
<sinelaw> let foo = { internal = [1;2;3];
<sinelaw> map = fun obj -> fun f -> List.map f obj.internal };;
<sinelaw> foo.map foo (fun x -> x + 1);;
<sinelaw> stupid List wrapper, but a better example would be where it stores the data internally in something that's not a list.
uris77 has joined #ocaml
<Tekk_> sinelaw: mhm
<Tekk_> but I'm using core anyway for stuff like result types
<companion_cube> MercurialAlchemi: \o/
<Tekk_> so I might as well just use the core list
<Tekk_> course result types aren't too hard to make either :)
<MercurialAlchemi> companion_cube: you should add more containers
<Drup> course *result* types aren't too hard to make *either*
<MercurialAlchemi> like cubes
* Drup does the pun dance.
<Tekk_> Drup: and that's where we get into the value of libraries
<Tekk_> oh
<companion_cube> Drup: 1/10
<MercurialAlchemi> hohoho
<Tekk_> I thought you were doing a life lesson there
<Tekk_> my bad
<companion_cube> MercurialAlchemi: there's a cube in the readme :]
<Tekk_> companion_cube: did you make it a nice 3d one?
<MercurialAlchemi> yes, but you can't compile the readme
<Drup> Tekk_: Not 3d, no :D
<Tekk_> Drup: aww, they're not that hard
<Drup> FOUR d
<Drup> much better
<Tekk_> little bit of /\, some | and a \/
<Tekk_> ah
jabesed has quit [Quit: Konversation terminated!]
<Drup> sinelaw: oh, sorry, so I misread the type
<Drup> sinelaw: hum, ok, I would clearly use a separated function here.
<companion_cube> MercurialAlchemi: so, you really need a cube ? :p
<MercurialAlchemi> let cube x = x * x
<companion_cube> *x ?
<MercurialAlchemi> yes
* MercurialAlchemi eats an x
claudiuc has joined #ocaml
<companion_cube> maybe it could go into CCFun
<companion_cube> but I'm not convinced :D
<sinelaw> Drup, of course, so would I. but in my type system these things show up inevitably. from what I understand this isn't a common thing to do in ocaml (I can't see good reasons to do it)
<Drup> companion_cube: I +1², containers should certainly contains a cube function.
<Drup> +1³ even.
<Drup> sinelaw: why does it show up ?
<MercurialAlchemi> companion_cube: it should go into CCPun
<sinelaw> Drup, objects. A list is an object and the 'map' function is a method of the list object.
<companion_cube> MercurialAlchemi: I like this more :D
<Drup> sinelaw: ah, polymorphic methods, yeah
<Drup> that's much more common.
aubergines has quit [Quit: leaving]
<sinelaw> Drup, in ocaml too?
<Drup> yeah
<Drup> it's just that nobody is using the OO system, so you don't see them
<companion_cube> almost nobody*
<companion_cube> can't ignore ocamlnet and cryptokit
<sinelaw> Drup, can ocaml infer anonymous object types ? and ones with polmorphic methods?
<MercurialAlchemi> lambda-term uses objects too
<Drup> actually, it's lambda-term that I can't ignor
<Drup> ignore*
<companion_cube> heh
<Drup> I can quite serenely ignore ocamlnet, thanks.
<sinelaw> *polymorphic
<Drup> sinelaw: yes, and no
<Drup> polymorphic methods are not inferable, iirc
thomasga has quit [Quit: Leaving.]
uris77_ has joined #ocaml
<MercurialAlchemi> I considered using them the other day to try out the row polymorphism thing and find out first hand how impossible to understand the error messages would be
<sinelaw> rank > 1 gets nasty for inference.
<Drup> if by nasty you mean indecidable
<Drup> then yes
<sinelaw> rank 2 is decidable
<Drup> really ? surprising
<sinelaw> rank 3 an up are undecidable
<sinelaw> *and
<sinelaw> Drup, yeah, but still nasty. not sure if it would be decidable in the context of objects, though.
uris77 has quit [Ping timeout: 246 seconds]
<Drup> MercurialAlchemi: did you ever used js_of_ocaml ? :]
<Drup> (I like the fact that in the ocsigen project, we use basically all the weird ocaml features in at least one of the projects)
<MercurialAlchemi> Drup: not yet, but I'm planning to, relatively shortly
<Drup> plenty of object types there :D
<MercurialAlchemi> :)
<Drup> (no object though, only the types)
<sinelaw> Drup, what is that good for?
<Drup> sinelaw: typing FFI to js_of_ocaml
<Drup> to js with js_of_ocaml
<sinelaw> Drup, interesting - I'm doing the same for Haskell
<sinelaw> source of all my weird questions.
<sinelaw> Drup, link?
<Drup> sinelaw: which js/haskell project ?
<Drup> (I sort of stopped counting them)
<sinelaw> Drup, it's very new. https://github.com/sinelaw/inferno
<Drup> ah, another new one
<sinelaw> Drup, it isn't a JS/Haskell thing. it's a type checker for JS
<Drup> oh, right
<Drup> (well, the remark applies too :D)
claudiuc has quit [Quit: Leaving...]
<sinelaw> but one possible usage is to type check the FFI
thomasga has joined #ocaml
<Drup> haskell and subtyping don't live happily together
<sinelaw> Drup, really? how many others do you know? closure, flow (and maybe tern, but not really) - what else?
<sinelaw> Drup, the type checker is implemented in haskell, doesn't implement A haskell type system though
<Drup> sinelaw: I know, but I mean from a FFI point of view
<Drup> FFI means another language to javascript, I would assume it will be haskell, in your case
claudiuc has joined #ocaml
<sinelaw> Drup, oh yes. but that's just a use case, not really the main problem I'm trying to solve. the GHCJS / Haste / etc. people will figure out what kind of wrapping makes sense for them
<Drup> there is typescript too, but it's rather a superset
* MercurialAlchemi wraps javascript in a bag and adds a big stone
<sinelaw> MercurialAlchemi, over the bridge I presume?
<MercurialAlchemi> over the ffi
<MercurialAlchemi> :D
<Drup> sinelaw: there are plenty others
<sinelaw> Drup, that's not JS, yeah.
<Tekk_> hmm...
<Drup> I just forgot their names because most of them don't go over the prototype phase
<Tekk_> how do you define a foreign function that returns an array in ctypes?
<Tekk_> I've tried playing around a bit and I can't seem to find it
<sinelaw> Drup, what do you mean by that
<Drup> Drup: returning (array int) ?
<Drup> Tekk_: ^
jabesed has joined #ocaml
<nicoo> Drup: Doesn't TyXML use all of the weird features ?
<Tekk_> Drup: nearly
<Tekk_> hrm
<Drup> nicoo: no objects, no gadts
<nicoo> Drup: And no rectypes
<nicoo> Drup: Ok, I'm convinces
<Tekk_> Drup: the int argument is the array length
<nicoo> d*
<Tekk_> and of course I don't know the length
<Tekk_> so if I try to make an array of u8s in that way
<Tekk_> it complains that the argument isn't an int
<Tekk_> utop # let scan = foreign "SDL_GetKeyboardState" (ptr int @-> returning (array uint8_t));;
<Tekk_> Error: This expression has type Unsigned.uint8 typ but an expression was expected of type int
<MercurialAlchemi> bah, Random.int 1000 is your friend
* Drup stares at MercurialAlchemi
<Tekk_> MercurialAlchemi: I suppose I could way overallocate :P
<MercurialAlchemi> (if it compiles, it works, right? right?)
<Tekk_> heh
<Tekk_> actually that doesn't even work
<Drup> Tekk_: ah, sorry, it's obvious
<Drup> return a ptr.
<Drup> (and the size with it, it's better)
<Tekk_> Drup: will that end up behaving properly when I convert it to an array to use in ocaml?
<Tekk_> ah
<Drup> Tekk_: look at the Carray module.
yomimono has quit [Ping timeout: 240 seconds]
<Drup> surprisingly, there is no predefined view.
rgrinberg has quit [Quit: Leaving.]
<Tekk_> Drup: carray in ctypes?
<Drup> yes
<Tekk_> that's what I was trying intiially
<Tekk_> right now I'm actually fighting to get utop to recognize that the Unsigned module is a thing..
<Drup> you go through a ptr and a size and construct a CArray
<Tekk_> mhm
<Tekk_> oh!
<Tekk_> I love SDL
<Tekk_> const Uint8* SDL_GetKeyboardState(int* numkeys)
<Tekk_> docs: if non-null, numkeys receives the length of the array
<Tekk_> :)
badon has joined #ocaml
<Tekk_> so it's ptr int returning ptr Unsigned.uint8, then in the wrapper you construct an array based on the length and contents. easy
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
rgrinberg has joined #ocaml
jabesed has quit [Quit: Konversation terminated!]
<Tekk_> Am I crazy or does Unsigned never want to work?
<Tekk_> I don't know what it is
<Tekk_> like I'm using Unsigned stuff *within the same module*
<Tekk_> yet Unsigned.uint8 mysteriously doesn't exist
<Drup> hum
<Drup> the *combinator* for uint8 is not in Unsigned
<Drup> the type is in Unsigned
<Drup> but the combinator is in Ctypes
<Tekk_> yeah
<Tekk_> and I'm trying to use it as the type
hilquias has joined #ocaml
badon has quit [Quit: Leaving]
Rebelion has quit [Quit: Saliendo]
rgrinberg has quit [Quit: Leaving.]
ivan\ has quit [Read error: Connection reset by peer]
ivan\ has joined #ocaml
hellofunk has quit [Ping timeout: 265 seconds]
antkong has joined #ocaml
MrScout has quit [Remote host closed the connection]
rgrinberg has joined #ocaml
pyon has quit [Quit: fix]
pyon has joined #ocaml
hellofunk has joined #ocaml
olauzon has joined #ocaml
steazzalini has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 265 seconds]
MrScout has joined #ocaml
WraithM has quit [Ping timeout: 264 seconds]
steazzalini_ has joined #ocaml
steazzalini has quit [Quit: Page closed]
steazzalini_ is now known as steazzalini
<steazzalini> Hi guys :)
<steazzalini> Is there any c-wapping expert around here?
<pippijn> steazzalini: don't ask meta-questions
<pippijn> just ask your question, someone might know, despite not being an expert
<pippijn> people will rarely say "yes, I'm an expert"
<steazzalini> u r right pippijn
sinelaw has quit [Ping timeout: 245 seconds]
<steazzalini> anyway
<steazzalini> what I’m trying to do is infer using the c api if a variable is a list, an array or a tuple
<pippijn> why?
<pippijn> you can infer that heuristically
<steazzalini> i wanna log them, but lists and arrays needs different approaches
<pippijn> you want to log arbitrary values in C?
fraggle-boate has quit [Ping timeout: 272 seconds]
<steazzalini> values coming from ocaml scenario
<steazzalini> my first doubt is: is it feasible?
<pippijn> yes
<pippijn> but e.g. type 'a t = Head of 'a | Tail of 'a t
<pippijn> is also a list
<pippijn> and (int * (int * (int * unit))) is also a list
<pippijn> and (int * int * int * int) is an array
<steazzalini> this makes sense
<pippijn> and ((0, None) : int * int option) is a list
<pippijn> these have the same runtime representations
MrScout_ has joined #ocaml
<pippijn> so it'll be heuristics
MrScout has quit [Read error: Connection reset by peer]
<mrvn> A list is a 2-tuple
uris77_ has quit [Quit: leaving]
<pippijn> it's a 2-tuple of (anything * pointer)
milosn has quit [Ping timeout: 245 seconds]
contempt has quit [Ping timeout: 255 seconds]
<pippijn> but you can heuristically infer that something is a list when it has more than 1 element
<mrvn> yes. some tuples you can determined not to be lists. A list also always has a tag of 0.
<mrvn> Or rather some blocks.
<pippijn> tuples also have tag 0, and arrays
<pippijn> except for float arrays
<mrvn> Constructors will be ints or blocks with tag.
<pippijn> right
<steazzalini> ok
<steazzalini> i’m following this
<mrvn> But wether a block with tag 0, 2 fields and the second field int(0) is a list, tuple or record you can't say.
<steazzalini> ok
<pippijn> mrvn: int(0) as in ocaml int or C int?
<mrvn> steazzalini: you can also do that from ocaml using Obj
<mrvn> pippijn: as in ocasmls []
<pippijn> because if it's ocaml int, that's 1, and it's definitely not a list
<pippijn> hmm
<mrvn> [] is encoded as C 1 iirc
<steazzalini> using Obj? i’m pretty new to ocaml :)
<pippijn> yeah, you're right
<pippijn> [], (), None, ...
<pippijn> all the same
<pippijn> C 1
<pippijn> steazzalini: yes, Obj lets you inspect the runtime representation of values
<pippijn> you can do the exact same thing in ocaml as in C (for this use case)
<steazzalini> probably “runtime representation” is the key
<pippijn> and it will be exactly as unsafe
<mrvn> steazzalini: The Obj module gives you access to the internal representation of ocaml values. You can check if they are ints or blocks or double arrays or strings or doubles
<pippijn> steazzalini: I would suggest using ppx_deriving
<mrvn> Do you need to print the values from C or from ocaml?
<pippijn> that gives you a type-safe printer that knows about the actual type and gives you a much more useful stringification
contempt has joined #ocaml
<steazzalini> mrvn: from C
<steazzalini> ppx_deriving is https://github.com/whitequark/ppx_deriving ?
<mrvn> So passing a pretty-printer function from ocaml to C is not an option?
<pippijn> steazzalini: yes
<mrvn> ppx_deriving would need to pass the printer to c
milosn has joined #ocaml
<pippijn> or it can register a global callback
<mrvn> pippijn: you still need to know the right printer for each value
<pippijn> yes
<pippijn> but C will usually know that
<pippijn> unless C takes 'a
<mrvn> Since he doesn't know if it is a list or not ...
<pippijn> his logger function doesn't know
<pippijn> but C can pass the appropriate pretty printer to the logger function
<pippijn> (I'm just guessing the architecture of this thing)
<mrvn> I would rewrite the logger in ocaml :)
<mrvn> n8
<pippijn> I agree, I don't know why the C code needs to log anything
<pippijn> good night
ingsoc has quit [Ping timeout: 252 seconds]
olauzon has quit [Quit: olauzon]
reem has quit [Remote host closed the connection]
chris2 has quit [Ping timeout: 276 seconds]
steazzalini has left #ocaml [#ocaml]
reem has joined #ocaml
milosn has quit [Ping timeout: 255 seconds]
milosn_ has joined #ocaml
vanila has quit [Quit: Leaving]
tane has quit [Quit: Verlassend]
milosn_ is now known as milosn
jonludlam has joined #ocaml
chouser has quit [Quit: Leaving.]
<pippijn> Error: The files crypto.cmi and crypto.cmi make inconsistent assumptions
<pippijn> over interface Crypto
Kakadu has quit []
<companion_cube> make clea
<companion_cube> n
Simn has quit [Quit: Leaving]
reem has quit [Remote host closed the connection]
chris2 has joined #ocaml
Thooms has quit [Quit: WeeChat 1.0.1]
chouser has joined #ocaml
AlexRussia has joined #ocaml
ivan\ has quit [Remote host closed the connection]
mort___ has quit [Quit: Leaving.]
ivan\ has joined #ocaml
MrScout_ has quit [Ping timeout: 245 seconds]
<nicoo> companion_cube: Is “clea” your pet name for Cleopatra or something?
strmpnk has quit []
strmpnk has joined #ocaml
jonludlam has quit [Ping timeout: 255 seconds]
IbnFirnas has quit []
IbnFirnas has joined #ocaml