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
girrig_ has quit [Ping timeout: 245 seconds]
girrig has joined #ocaml
ontologiae has quit [Ping timeout: 258 seconds]
fezghoul has quit [Remote host closed the connection]
manud has quit [Ping timeout: 260 seconds]
struktured has joined #ocaml
oriba has quit [Quit: oriba]
manud has joined #ocaml
jao has joined #ocaml
jao has quit [Changing host]
jao has joined #ocaml
jao has quit [Ping timeout: 272 seconds]
badon has joined #ocaml
WraithM has quit [Ping timeout: 246 seconds]
WraithM has joined #ocaml
ygrek has joined #ocaml
AltGr has joined #ocaml
araujo has quit [Quit: Leaving]
huza has joined #ocaml
huza has quit [Quit: WeeChat 0.3.8]
huza has joined #ocaml
jave has joined #ocaml
Ptival_ is now known as Ptival
ygrek has quit [Ping timeout: 272 seconds]
huza has quit [Ping timeout: 240 seconds]
tac_ has joined #ocaml
larhat has quit [Quit: Leaving.]
tac_ has quit [Quit: Leaving]
WraithM has quit [Ping timeout: 245 seconds]
simulacrum has joined #ocaml
natrium1970 has joined #ocaml
<natrium1970> I’m confused about the Print module of Batteries Included. When I first searched, I found a Print and Printf module, and Printf said I should be using the Print module instead. Then I look at a different version of Batteries, and Print is gone, and Printf is there.
philtom has joined #ocaml
<natrium1970> It gets worse. When I try “open BatPrintf”, I get “Unbound module BatPrintf”
<natrium1970> I finally the REPL to find batteries, but even things from the docs like printf "Here's the result: %s.\n\tComputation took %i seconds.\n" fail. “Reference to undefined global BadPrintf"
WraithM has joined #ocaml
<natrium1970> Actually, it can’t find anything at all in Batteries.
taion809 has quit [Remote host closed the connection]
thetabyte has left #ocaml [#ocaml]
WraithM has quit [Ping timeout: 272 seconds]
manud has quit [Ping timeout: 260 seconds]
simulacrum has quit [Remote host closed the connection]
natrium1970 has left #ocaml [#ocaml]
yacks has quit [Quit: Leaving]
yacks has joined #ocaml
contempt has quit [Ping timeout: 260 seconds]
philtom has quit [Remote host closed the connection]
pyon has joined #ocaml
contempt has joined #ocaml
contempt has quit [Ping timeout: 240 seconds]
koderok has joined #ocaml
simulacrum has joined #ocaml
koderok has quit [Client Quit]
contempt has joined #ocaml
MercurialAlchemi has joined #ocaml
waneck has joined #ocaml
<AltGr> undefined global "Ba_d_Printf" ?
<dmbaturin> Your printf is bad and you should feel bad.
<dmbaturin> Do batteries actually have BadPrintf? The rest of that question sounds like a valid library usage error.
<adrien> it's 't', not 'd'
<dmbaturin> Well, I guess.
<dmbaturin> Also, do batteries redefine anything from the pervasives, or they just add to it and keep everything in a separate namespace?
axiles has joined #ocaml
siddharthv_away is now known as siddharthv
ysz has joined #ocaml
contempt has quit [Ping timeout: 260 seconds]
contempt has joined #ocaml
ysz has quit [Client Quit]
rand000 has joined #ocaml
contempt has quit [Ping timeout: 260 seconds]
ysz has joined #ocaml
ygrek has joined #ocaml
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
zpe has quit [Read error: Connection reset by peer]
zpe has joined #ocaml
badon has quit [Ping timeout: 244 seconds]
oscar_toro has joined #ocaml
oscar_toro has quit [Ping timeout: 272 seconds]
wiml has joined #ocaml
MercurialAlchemi has quit [Remote host closed the connection]
MercurialAlchemi has joined #ocaml
<dmbaturin> Is it possible to do partial application at runtime?
<flux> ?
<flux> not sure what you mean by that.
<flux> you can do partial application, the compiler compiles it for you, it's evaluated at runtime :)
<flux> much like all other code :)
<dmbaturin> Well, e.g. write a string -> string -> string function, read a string from user, and make a string -> string function based on it.
<flux> you mean compile the user-entered string and then use it in your program?
<flux> or use variables when constructing a partially applied function?
<dmbaturin> No, not compile, but use it at runtime. The use case I'm thinking about is like this: an API needs to be initialized with a session token before we can make any calls.
<flux> partial application works with variables, yes
<flux> the idea behind partial application is this:
<flux> all functions take exactly one argument
<dmbaturin> So can we do something like let get_token () = <some side effects here>;; let make_call token args = ...;; let my_call args = make_call (get_token ()) ;;
<flux> yes you can
<dmbaturin> Yeah, I understand that it relies on currying, I was wondering if it's all resolved at compile time or not.
<dmbaturin> Will try with a toy example.
<flux> well, let's say you wrote this function:
<flux> let add = fun a -> fun b -> a + b
<flux> would you ned think you can just call add 5 and get the return value fun b -> a + b, ie. your return value is a function?
<flux> ned->not
<flux> so, let add5 = add 5
<flux> and then you can call add5 3 and you get the actual sum
<flux> the perhaps the key point here is that return values (and arguments) can be functions in OCaml
<dmbaturin> Well, I guess. I just still have very vague understanding of what machine code it really compiles into.
<flux> and they can remember they environment (ie. they are closures)
<flux> I don't think there's an example (beyond format strings and even there it can be done) of a thing you can put inside expressions that works only with constants
sagotch has joined #ocaml
<dmbaturin> Also, would that way to deal with that API be any idiomatic?
c74d has quit [Remote host closed the connection]
<flux> perhaps, if the API is just one function
<flux> but if it's a bunch of them, it could become a chore
<dmbaturin> With multiple functions I'd better use a functor?
<flux> you would have a module that provides type t signifying an established session
<flux> let session = Session.create token in ..
badon has joined #ocaml
<flux> and then Session.call "somesome"
<flux> Session.t would hide the session token inside itself
<dmbaturin> Yeah, that's what I mean.
<flux> well, no functors involved here
<dmbaturin> I'm still not fluent in ocaml jargon. :)
<flux> when writing that session.ml you would then accompany it with session.mli where you define what the users of that module are able to see and access
<dmbaturin> I thought this kind of module manipulation is always done with functors.
<flux> typically such type t would be left abstract (plain "type t" in the .mli)
<flux> usually when using functors constructing types is at play (not a requirement, though)
c74d has joined #ocaml
hhugo has joined #ocaml
<sagotch> hey
<sagotch> https://gist.github.com/sagotch/3a036d4ffa550b63bc13 <- opam (1.2.0) wants to downgrade ocamlfind when trying to install my package, but I did not specified any version contraint. Why?
<dmbaturin> flux: What the create function would look like in this case? Any simple example of constructing modules this way available?
<flux> maybe xml-light has such a version constraint?
<adrien> xml-light
<adrien> ph34r
ggole has joined #ocaml
<flux> dmbaturin, the module look something like this: type t = { token : string } let create token = { token = token }
<adrien> too many bugs
<flux> plus Obj.magic :-o
<flux> though didn't know about the bugs
<adrien> sagotch: harass author of the software to move away from xml-light
<flux> too bad xmlm is a bit more complicated to use, but after setting things up it's pretty ok
<adrien> xml-light has been unmaintained for 10 years
<dmbaturin> flux: Ah, so I can modify data inside a module with functions from the same module?
<adrien> its package should be removed from everywhere
<flux> dmbaturin, well, you can only modify it it you put for example type t = { token : ref string } ..
<flux> records are immutable by default
<dmbaturin> Well, not really modify in this case. That is, define data in the instance.
<flux> (actually they remain immutable in that case as well, but there is a field modifier 'mutable' you can use to have really mutable fields)
<AltGr> sagotch, 'opam config report' ?
<flux> dmbaturin, yes, records are a nice way to put all associated data into one place
<dmbaturin> Yeah, I know about mutable fields, but I didn't use them yet.
<flux> dmbaturin, and then you can easily have multiple Session.ts around
wiml has quit [Quit: wiml]
skchrko has joined #ocaml
<flux> my xml-light does not have any dependencies, though
<flux> so perhaps it is not the package to blame?
<dmbaturin> flux: So what really happens when we call Session.create? A new instance of the Session module is created with t defined as { token = token_from_arg }?
<flux> dmbaturin, no new module instances are created. just an instance of the record.
<flux> and the record type has the name t
sagotch has quit [Ping timeout: 246 seconds]
sagotch_ has joined #ocaml
<flux> module instances are created with functors. you will see that it's different when you get there :)
<sagotch_> and no version constraint in xml-light package
<flux> sagotch_, I wonder, does 'opam upgrade' do the same?
<flux> sagotch_, also do you have a solver installed?
<sagotch_> Nothing to do. The following aren't at their latest version due to constraints, conflicts or pinnings: - camlp4.4.03.0
<sagotch_> no external solver
<flux> ie. aspcud
<flux> it's funny how it says though "downgrade ocamlfind from 1.5.3 to 1.5.2 [required by gpx]", but to me it would look like gpx doesn't care about the version
<flux> is is perhaps the only reason whe this resolution is given
<flux> perhaps it's a bug in opam 1.2?-o
wiml has joined #ocaml
<flux> but nice, I would have had use to such a gpx library some time ago :-)
<flux> (instead I whipped up code that only served the needs I had)
<flux> critique: version: float; (* Must be 1.1 *) - I would rather use version : (int * int);
<dmbaturin> flux: Ah, ok. Or that "let my_session = Session.create token" binding creates a closure that contains the record we defined and it's available when we call my_session.some_method ()?
hhugo has quit [Quit: Leaving.]
<flux> dmbaturin, it doesn't create a closure, it only creates a record :)
<sagotch_> I now use to make a library for anything I need which could be more general than my need, even if I do not always release it :-)
<dmbaturin> Wait. How subsequent calls know what the record they need to use is?
<flux> dmbaturin, you have the 't' passed as the first argument for them
<flux> dmbaturin, you will notice this is how for example Hashtbl works
<sagotch_> (and good point for version type)
<flux> and most any OCaml libraries. except its immutable data types :-)
<flux> (they put the 't' argument last)
<ggole> It's a bit inconsistent, really
<flux> sagotch_, while at it, put a license file there as well ;-)
<ggole> For instance Queue.add operates on a mutable structure but takes the data structure argument last
<ggole> But Hashtbl.add takes it first -_-
<sagotch_> sure
oscar_toro has joined #ocaml
<flux> I see someone likes to use the field name disambiguation feature of 4.02 ;)
<dmbaturin> I guess I should just make some you modules and play with them.
<dmbaturin> * toy modules
<flux> dmbaturin, good luck :)
<sagotch_> flux: installing aspcud solved the issue
sagotch has joined #ocaml
marynate has quit [Quit: Leaving]
cago has joined #ocaml
pyon has quit [Ping timeout: 272 seconds]
<flux> sagotch_, great. though I didn't know the builtin solver could really fail in situations that looked this easy.. what did aspcud decide to do?
<flux> were downgrades involved?
<sagotch> as expected, the only intruction was to install gpx 1.0, that's it
<sagotch> no more downgrade
sagotch_ has quit [Ping timeout: 246 seconds]
larhat has joined #ocaml
<flux> hmm, it still is a bug I think, why would not opam find that kind of simple resolution, regardless how simple its algorithm is?-o
<AltGr> sagotch, no timeout on the internal solver ?
ebzzry has quit [Ping timeout: 245 seconds]
ebzzry has joined #ocaml
<AltGr> on the explanation, it's computed afterwards (solver is a black box, motly), so if the action makes no sense the explanation won't.
<AltGr> here it just sees the dependency link so that's the only possible explanation :p
<sagotch> how to know if there was a timeout?
<AltGr> well there _should_ be a message, but --debug would tell you more anyway
<AltGr> you can use --use-internal-solver
<AltGr> to temporarily disable aspcud
badon has quit [Ping timeout: 272 seconds]
<sagotch> AltGr: https://gist.github.com/sagotch/3a036d4ffa550b63bc13 : updated with `opam pin add gpx . --use-internal-solver --debug` output.
<AltGr> thanks
ollehar1 has joined #ocaml
yacks has quit [Ping timeout: 272 seconds]
lordkryss has joined #ocaml
<ysz> anybody has auto-complete with merlin working "as you type"? :)
huza has joined #ocaml
<flux> I had some auto-completion but I think it was not merlin-directed
<flux> the most bloody annoying thing was let asdf = asdf in<enter> and the 'in' would expand into something else :-)
<flux> so, nowadays, explicit expansion, that works.
<ysz> i see
<flux> who knows, perhaps it's possible to make it work better
wiml has quit [Quit: wiml]
<ysz> yeah i would expect merlin to be smarter than that
eikke has joined #ocaml
sagotch has quit [Ping timeout: 246 seconds]
oscar_toro has quit [Ping timeout: 244 seconds]
octachron has joined #ocaml
eikke has quit [Ping timeout: 250 seconds]
ollehar1 has quit [Ping timeout: 245 seconds]
jonludlam has joined #ocaml
eikke has joined #ocaml
<Drup> dmbaturin: you could just drop the record
<Drup> "type token = string" and just make it abstract
<flux> well, I was thinking he might want to extend the record at some point, but that is a good suggestion if nothing else is required
<flux> after all, if it's abstract, it could be changed later as well without affecting the client code
<Drup> it's abstract anyway. Anything can change :D
<flux> regardless, this way it's more difficult to mix strings with tokens internally ;)
huza has quit [Ping timeout: 244 seconds]
George__ has joined #ocaml
<dmbaturin> Drup: Playing with it now. Also, the paper you linked earlier looks interesting, thanks!
zpe has quit [Remote host closed the connection]
elfring has joined #ocaml
<elfring> The tool "Findlib" can also work with the variable "requires" in META files. How should detailed software dependencies be specified there?
<ygrek> man META
<George__> Question about Hashtbl: In a hash table with keys that may have multiple bindings, how a specific key-value binding can be deleted/replaced?
<Drup> George__: you can only touch the last one
<George__> I was thinking the same, but wanted to get sure there is no mechanism for that
<Drup> remove all of them one by one, then insert them again, but changing the one you want to modify ? :D
<George__> :D yes
<Drup> George__: more seriously though, if you want multimap, there are things more appropriate than Hashtbl
<Drup> Hashtbl's weird persistent feature is mostly there to be able to backtrack, sort of.
<George__> I look for fast table access, which has table provides me
<George__> what is your suggestion?
<Drup> I think there are multimaps in batteries and in containers
<elfring> ygrek: I have read the small description for the variable "requires" again. I am still searching for the possibiliy to require a minimum version for some software.
<George__> Great! I will have a look at it
<Drup> elfring: findlib is not the right tool, use opam.
<George__> By the way, again about hashtbl, is there any way to exit an iteration when a key-value is reached?
<Drup> raise an exception.
Simn has joined #ocaml
<George__> hmmm, good
<elfring> Drup: Does the Findlib interface support the specification of version constraints?
<ygrek> elfring, one cannot specify that in findlib
Kakadu has joined #ocaml
AltGr has left #ocaml [#ocaml]
iorivur has quit [Ping timeout: 272 seconds]
iorivur has joined #ocaml
cespinoza has quit [Ping timeout: 260 seconds]
huza has joined #ocaml
zpe has joined #ocaml
cespinoza has joined #ocaml
sepp2k has joined #ocaml
mort___ has joined #ocaml
huza has quit [Ping timeout: 244 seconds]
iorivur has quit [Ping timeout: 260 seconds]
NoNNaN has joined #ocaml
girrig has quit [Ping timeout: 260 seconds]
girrig has joined #ocaml
huza has joined #ocaml
igstan has joined #ocaml
siddharthv is now known as siddharthv_away
ddosia has quit [Ping timeout: 244 seconds]
huza has quit [Ping timeout: 260 seconds]
eizodo_ has joined #ocaml
shallow is now known as fialor
eizodo has quit [Ping timeout: 246 seconds]
x4e has joined #ocaml
braibant has joined #ocaml
iorivur has joined #ocaml
hhugo has joined #ocaml
ygrek has quit [Ping timeout: 245 seconds]
Thooms has joined #ocaml
dav_ has joined #ocaml
dav has quit [Ping timeout: 260 seconds]
ontologiae has joined #ocaml
araujo has joined #ocaml
Submarine has joined #ocaml
huza has joined #ocaml
tane has joined #ocaml
Thooms has quit [Quit: WeeChat 0.4.3]
tac_ has joined #ocaml
oscar_toro has joined #ocaml
huza has quit [Quit: WeeChat 0.3.8]
ontologiae has quit [Ping timeout: 260 seconds]
toolslive has joined #ocaml
mort___ has quit [Quit: Leaving.]
<dmbaturin> When do I need the sig part in a module and when I don't need it?
<toolslive> most of the times it's because you want to hide (part of) the implementation of the module
<dmbaturin> So it's just like not including certain names in the .mli if I have one module in file?
<Drup> it's exactly the same as .mli
Submarine has quit [Ping timeout: 240 seconds]
<Drup> it's mandatory for recursive modules
<dmbaturin> Recursive modules?
lordkryss has quit [Quit: Connection closed for inactivity]
<dmbaturin> Mutually recursive, or a module that refers to itself may also be useful?
<ggole> Abstract and private types are also expressed in terms of signatures
<Drup> it's an arcane feature that you don't want to use :D
darkf has quit [Quit: Leaving]
mort___ has joined #ocaml
<acieroid> dmbaturin: mutually recursive
<Drup> (self recursive works too, in fact :D)
<acieroid> indeed, but is there any application of a self recursive module ?
<acieroid> for mutually recursive modules I can understand why one would need it, but for a self-recursive module, not really
Submarine has joined #ocaml
tane has quit [Quit: Verlassend]
<Drup> you can do haskell like declarations :D
<Drup> everything mutually recursive
<Drup> (it's a terrible idea)
<Drup> (but I've seen it done)
<flux> acieroid, it allows to have object definitions and type definitions to refer to each other
<flux> (in a recursive fashion)
<flux> perhaps there are other cases.
ebzzry has quit []
ebzzry has joined #ocaml
<dmbaturin> Drup: Haskell-like declarations?
<Drup> in haskell, declarations can refer both to thing before and after
<Drup> and everything is recursive by default
<dmbaturin> Ah, this. I see waht you mean.
<dmbaturin> I never learnt haskell other than basic syntax. My friend suggested that I should learn it but I didn't like it much.
ebzzry has quit [Client Quit]
ebzzry has joined #ocaml
iorivur has quit [Quit: No Ping reply in 180 seconds.]
iorivur_ has joined #ocaml
<kaustuv> You definitely should learn Haskell. Everyone should.
<kaustuv> But you don't have to learn all of it at once.
<dmbaturin> Why everyone should learn it?
<tac_> Haskell has a lot of interesting ideas that don't show up much of anywhere else.
toolslive has quit [Ping timeout: 260 seconds]
<tac_> If not for anything else, knowing what it feels like to be locked inside the straightjacket of purity.
<kaustuv> The way I see it, it's a matter of basic programmer literacy these days. You have to have at least tried Haskell, Erlang, Rust, maybe Julia
<kaustuv> Oh and Scala
<companion_cube> if you tried haskell and ocaml, why bother with scala?
<dmbaturin> It shows up in papers sometimes so I sort of used the little knowledge I have.
<dmbaturin> For the same reason I learnt scheme and CL a little.
<kaustuv> Scala's implicits are not seen in any other language AFAIK (not counting the modular-implicits branch)
mcclurmc has joined #ocaml
<tac_> Implicits are also available in Idris
<companion_cube> implicits should be used mostly for typeclasses
<companion_cube> using them to hide the database connection or similar things is pretty ugly imho
<dmbaturin> All my formal programming education was in imperative languages. And most of it was pascal, lol.
<kaustuv> "imperative langauge" is as much as nonsensical concept as "functional language". Imperative and functional are programming patterns that are available in pretty much every language
<dmbaturin> Well, not most, but a substantial part.
igstan has quit [Read error: Connection reset by peer]
bytbox has quit [Remote host closed the connection]
<tac_> kaustuv: I would agree with that statement if you used "Object oriented" there, but there's a fairly clear division between imperative and functional styles.
<tac_> And many imperative languages have really bad support for functional features (and often, vice versa)
<kaustuv> The only clear division I see is with something like higher-order functions
<tac_> No tail call support, no closures or lambdas, sometimes no garbage collection, no types or immutable data structures
<tac_> No pattern-matching is one that bugs me all the time in Python.
toolslive has joined #ocaml
<dmbaturin> tac_: Mutable lists in python are annoying too.
<companion_cube> kaustuv: well haskell really doesn't have imperative features
<companion_cube> it merely have some magical monads (IO, St) that simulate imperative programming, but it's not in the language itself
<dmbaturin> And the fact the only feasible way to avoid having the list mangled is to copy it.
<dmbaturin> tac_: I seem to recall someone emulated pattern matching in python with decorators. ;)
<kaustuv> companion_cube: The fact that you sequester IO actions in their own monad doesn't change the fact that the IO monad gets executed by the Haskell runtime
<kaustuv> So it's an academic distinction for most use cases
<dmbaturin> And there was some preprocessor by INRIA that sort of adds it to any language, but I never tried it.
<tac_> dmbaturin: Whenever I see "pattern-matching in Python" or "Monads in Ruby", I think of this gifset:
<tac_> You can do it... and people will be amazed.... but that doesn't mean you should be proud of yourself for doing it ;P
<dmbaturin> Someone emulated goto in python too.
<companion_cube> kaustuv: well that's it, haskell isn't imperative, its runtime is
<companion_cube> same as ocaml doesn't change immutable values or move them, but its GC does
<companion_cube> (change e.g. with lazy values)
<dmbaturin> Did anyone add goto to ocaml with camlp4? If not, I'm going to do it. ;)
<kaustuv> By that argument no language is imperative, only their runtimes are
<companion_cube> the language doesn't have a concept of mutation
<companion_cube> whereas in C, a = b; pretty much is a mutation
<Drup> of course haskell has the concept of mutation ...
<companion_cube> Drup: really?
<Drup> companion_cube: don't mistake IdealHaskell for Haskell
igstan has joined #ocaml
<companion_cube> unsafePerformIO ? ^^
<kaustuv> Every thunk evaluation is a mutation, technically. Also, writeIORef/readIORef etc.
<Drup> disguising a caveman in a 3 piece suit doesn't make it a gentleman.
badkins has joined #ocaml
vervic has joined #ocaml
tane has joined #ocaml
<Drup> (or, if you prefer something more to the point : It's not because you wrap mutation in typing trickery that it's not mutation anymore)
<companion_cube> you mean IO?
<Drup> and every other related things
<companion_cube> well it's still a world of values
<Drup> (Vector, IORef, etc)
ygrek has joined #ocaml
<kaustuv> Look, as long as the entry point of any Haskell program is an execution of an IO () value, it's *completely moot* whether IO happens or not. It happens.
<companion_cube> I mean that for evaluating haskell expressions, you shouldn't require a representation of mutable references ("store")
sheijk has joined #ocaml
SethTIsue has joined #ocaml
<companion_cube> what happens in the runtime is a different thing
<companion_cube> I don't know any other language (proof assistants excepted) where this is the case
<companion_cube> that's the point of the whole "equational reasoning"
<companion_cube> +idea
<ggole> Prolog?
<toolslive> and Mercury and friends.
<toolslive> the whole IO in Mercury is based on uniqueness typing IIRC.
<companion_cube> prolog isn't equational ?
<companion_cube> it performs side effects for evaluating certain terms
<companion_cube> mercury is strongly inspired from haskell afaik, but I barely know about it (it's really obscure)
<kaustuv> Uniqueness is a fundamentally broken concept imho. Rust's notion of "ownership" is more defensible, even though I am stilly dubious of its logical meaning.
<kaustuv> Anyway both uniqueness and ownership interact badly with closures
<ggole> It does interfere with some pretty basic things
<flux> kaustuv, why is it a broken concept?
<flux> too difficult to maintain?
skchrko has quit [Quit: Leaving]
<kaustuv> Basically you can't stuff a unique value in a closure, so say good bye to List.fold_left and friends
<Drup> companion_cube: you can also give a semantic to ref with a pure langage (and a state monad)
<Drup> and ?
<Drup> it doesn't change anything
<kaustuv> Also IIRC uniqueness is incompatible with exceptions
<tac_> kaustuv: I would imagine in a well-designed language, you would just get a uniquely typed closure
<kaustuv> That's what Mercury tries to do, but it's very messy
<tac_> I can't speak much about that kind of thing, though, since I've never used it.
<tac_> It does worry me a bit when Idris is going to have uniqueness types as an experimental feature
nuki has joined #ocaml
nuki has quit [Client Quit]
<kaustuv> I'm not saying that it cannot be done. I mean there are people who claim that Clean is a better Haskell than Haskell
<flux> does Rust resource management work at all with a tracing GC?
<flux> I thought its resource management is not much different from shared_ptr and unique_ptr
<flux> (but I really should look into it)
<kaustuv> I am not sure how Rust uses block headers. If they have a pointer mask then a tracing GC should be doable.
toolslive has quit [Ping timeout: 260 seconds]
<kaustuv> From brief attempts, Rust structs have 1 word of overhead, which should be sufficient for a mask for most normal sized blocks
<kaustuv> Of course Rust also allows pointing to the middle of blocks, so...
<ggole> I don't think structs have headers at all: allocations are what have headers
<ggole> Could be wrong though
<kaustuv> I tried it out just last week. enum foo { Foo1(i32) } has size 8 bytes
<kaustuv> err, you probably need more than one field
<sheijk> so it's probably just a pointer?
<companion_cube> enums should have overhead, structs shouldn't
<tane> yeah.. how to pattern match an enum type without some variant indicator..
mcclurmc has quit [Remote host closed the connection]
<companion_cube> Drup: about the state monad, is that really that easy? you'd need a fresh name generator for local variables, and so on...
<Drup> companion_cube: that's how it's done in the ML paper
<Drup> (at least the one I read some years ago)
<kaustuv> well, if pointers are not indicated in any way in Rust structs, then the answer about tracing GC is obviously "no"
<companion_cube> at school, when I was taught the featherweight scala model (at EPFL), lambda-calculus with mutations had a store
<Drup> kaustuv: Gc<T> is made for that.
mcclurmc has joined #ocaml
<ggole> My understanding is that layout info has to be generated, it isn't just there automatically
shinnya has joined #ocaml
<tane> aren'T rusts's structs compatible with C's?
<kaustuv> You mean maintain the "points to" relation somewhere else? How can that be squared with parallelism?
<Drup> tane: iirc, not by default, only if you ask for it
<companion_cube> gc<T> would be task-local
<ggole> No, I mean that the usual Rust struct is just a binary blob which the runtime is oblivious to the internal structure of
<tane> Drup, alright
<kaustuv> well, gcing binary blobs is a "hard problem", but I wouldn't put it past clever people
<ggole> (Although there *are* schemes that maintain layout info separately from the objects.)
<ggole> Appel's and that other bloke's papers on tagless GC come to mind
bytbox has joined #ocaml
<ousado> we store a layout id in the header
<ggole> Yeah, that's very common
Thooms has joined #ocaml
<ggole> MLton, Java, Haskell etc all do something like that
ontologiae has joined #ocaml
toolslive has joined #ocaml
<kaustuv> MLton is not tagless! It uses the headers to store a pointer mask
<ggole> Headers are nice because they make generational GC easy without an external queue structure
<ousado> so we're in good company, at least in part :)
<kaustuv> What MLton does is sort the fields of a variant so that the pointers are at one end, and then stores an offset
<ggole> You've misunderstood, I just stated that it uses headers.
<ggole> I don't think anybody is tagless because it has some issues.
<kaustuv> Right, sorry
<kaustuv> Anyway, there is also the pointing into the middle of structs issue with Rust. All in all, these are not good features for GC
<ggole> Let me rephrase that: I don't think anybody with a generational copying GC is using tagless GC.
<ggole> It's possible, a number of systems have supported it.
<ggole> Go, Rust, D, the Lisp Machines way back when.
<ggole> There are costs involved though.
<kaustuv> How do you find block headers if you point to the middle though? Magic numbers?
eikke has quit [Remote host closed the connection]
ontologiae has quit [Ping timeout: 245 seconds]
SethTIsue has quit [Quit: SethTIsue]
<kaustuv> Or store "child of" relationships in the types somehow?
<ggole> I'm not actually sure how each of those systems approaches the problem.
<ggole> One possibility is to store interior pointers as a pair base, offset
<ggole> That has an obvious representation overhead, but makes things pretty simple.
<kaustuv> Ah. OK.
eikke has joined #ocaml
<ggole> It might also be possible to have a table/bitset/something that indicates which pointer is a header or not, without giving the means to determine the header from an interior pointer
BitPuffin has joined #ocaml
<ggole> I'm pretty sure this would rule out relocation
<kaustuv> It also feels a bit ugly, especially for a chain of middle pointers
<ggole> I can't disagree.
badkins has quit [Ping timeout: 260 seconds]
badkins has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
ft_ has joined #ocaml
ft_ has quit [Client Quit]
hockpa2e has joined #ocaml
morphles has joined #ocaml
oscar_toro has quit [Ping timeout: 272 seconds]
mcclurmc has joined #ocaml
bytbox has quit [Remote host closed the connection]
ysz has quit [Quit: This computer has gone to sleep]
ddosia has joined #ocaml
larhat has quit [Quit: Leaving.]
x4e has quit [Quit: Leaving]
sinelaw has quit [Ping timeout: 272 seconds]
tac_ has quit [Quit: Leaving]
slash^ has joined #ocaml
badkins has quit [Ping timeout: 240 seconds]
Thooms has quit [Quit: WeeChat 0.4.3]
eikke has quit [Ping timeout: 250 seconds]
badkins has joined #ocaml
cago has left #ocaml [#ocaml]
iZsh has quit [Quit: ZNC - http://znc.in]
iZsh has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
eikke has joined #ocaml
bezirg has joined #ocaml
bezirg has quit [Client Quit]
mcclurmc has joined #ocaml
bezirg has joined #ocaml
bezirg has quit [Remote host closed the connection]
bezirg has joined #ocaml
Submarine has quit [Remote host closed the connection]
bezirg has quit [Client Quit]
mcclurmc has quit [Remote host closed the connection]
zpe has quit [Remote host closed the connection]
bezirg has joined #ocaml
mcclurmc has joined #ocaml
ygrek has quit [Ping timeout: 258 seconds]
toolslive has quit [Ping timeout: 260 seconds]
mort___ has quit [Ping timeout: 272 seconds]
toolslive has joined #ocaml
marynate has joined #ocaml
cespinoza has quit [Ping timeout: 250 seconds]
bezirg has quit [Quit: Leaving.]
cespinoza has joined #ocaml
mbac has joined #ocaml
rand000 has quit [Ping timeout: 272 seconds]
eugene_klm has joined #ocaml
octachron has quit [Quit: Leaving]
ontologiae has joined #ocaml
yomimono has joined #ocaml
ygrek has joined #ocaml
badkins has quit [Ping timeout: 272 seconds]
boogie has joined #ocaml
ontologiae has quit [Ping timeout: 272 seconds]
Kakadu has quit [Quit: Page closed]
Anarchos has joined #ocaml
jwatzman|work has joined #ocaml
zpe has joined #ocaml
WraithM has joined #ocaml
onetwo has joined #ocaml
<onetwo> Hey I was trying to figure out some syntax problems with ocaml, mainly involving mapping and folding over Maps
<onetwo> general idea over here: http://pastebin.com/X2616wSR
<onetwo> Wondering if its a lack of syntax or a logic problem
<Drup> onetwo: what is it suppose to do ?
<Drup> onetwo: if you want to modify m, then it's a logic problem :)
<ggole> onetwo: let m = ... isn't a complete phrase (except at toplevel, which is a bit of a special case).
<onetwo> basically take a List of strings
<onetwo> And make a List of (String, Int) tuples that have the words and their count in the string
<onetwo> and print them
<onetwo> Yeah, I'm sort of confused about how Maps work, I know that It creates a new map each time (immutable) but kind of lost to how to update the reference to "m" in the List.Map
<Drup> you don't
<Drup> mostly because it's not a reference, just a name
Submarine has joined #ocaml
<ggole> Usually you would use a fold here
<onetwo> Would I just get of rid of the let m ='s in the function and just pass in the Map as an additional argument?
<ggole> Although the Map interface does its best to make the job clumsier than necessary :/
<Drup> yes. As ggole, your List.map would need a fold
<Drup> need to become*
<onetwo> Yeah, I am currently trying to pick up the language so all the proper idioms might not be apparent to me
<Drup> onetwo: since you're not using any persistent feature, an Hashtbl would be more appropriate here
bytbox has joined #ocaml
larhat has joined #ocaml
rand000 has joined #ocaml
<ggole> Map really needs a "modify with default if not present" operation, sigh
ollehar1 has joined #ocaml
<Drup> ggole: and an exceptionless find.
<onetwo> haha awesome thanks ggole!
<onetwo> I thought though that Map would return same type, a List, where as fold reduces the array into a single value of sorts?
ollehar has quit [Ping timeout: 244 seconds]
<ggole> Yeah, option is much nicer than an exception there.
iorivur_ has quit [Ping timeout: 272 seconds]
<onetwo> List sorry
<ggole> Yes, fold is a reduction operation
<Drup> ggole: both are in BatMap :3
<ggole> Maybe I should wean myself off the stdlib...
<onetwo> Haha awesome, but what If I wanted the return to be a List of (String, Map) tuples instead of Type Map(String)
<onetwo> Here don't I just iterate through the updated Map
<onetwo> Pedantic, and it serves the function -- but if you have time just for learning purposes haha
shinnya has quit [Ping timeout: 245 seconds]
<onetwo> List (String, Int)**
<ggole> You would probably create the Map, and then fold over it to create the list.
BitPuffin has quit [Read error: Connection reset by peer]
<Drup> onetwo: WordMap.bindings, but you are free to reimplement it ;)
<onetwo> Haha okay, thanks so much guys!
<ggole> Oh yeah, .bindings. Forgot that one.
ollehar has joined #ocaml
<Drup> onetwo: try, it's not difficut and it's a good exercise
iorivur has joined #ocaml
jao has joined #ocaml
jao has quit [Changing host]
jao has joined #ocaml
SethTIsue has joined #ocaml
pyon has joined #ocaml
badkins has joined #ocaml
eikke has quit [Ping timeout: 272 seconds]
<Leonidas> Drup: regarding that token type: Real World OCaml recommends putting types into their own modules, so should I make a Token.t type or should I just go for a simple `token` type?
mcclurmc has quit [Remote host closed the connection]
<Leonidas> I kinda lean toward making a Token.t…
<Drup> depends, do you have operation that goes with them (and only them) ?
<Drup> other than creating a token
cespinoza has quit [Ping timeout: 245 seconds]
mcclurmc has joined #ocaml
<Drup> if the answer is no, then don't create a module just for that.
<Drup> creating a module just to put 2 things in it (type t and val create : unit -> t) is just useless cognitive load, in my opinion
<Leonidas> Drup: I need a method to get the string out of it too. Besides this, not much.
<Drup> do you really need to get the string out ? :)
<Leonidas> yeah, I kinda need to stick it to the API, but I don't need to expose that function
<Leonidas> (to the REST API I am targetting, that means)
cespinoza has joined #ocaml
marynate has quit [Quit: Leaving]
Kakadu has joined #ocaml
ygrek has quit [Ping timeout: 244 seconds]
George__ has quit [Ping timeout: 246 seconds]
lordkryss has joined #ocaml
Submarine has quit [Remote host closed the connection]
sheijk_ has joined #ocaml
ollehar has quit [Ping timeout: 240 seconds]
jao has quit [Ping timeout: 258 seconds]
sheijk has quit [Ping timeout: 244 seconds]
hockpa2e has quit [Quit: Leaving]
malo has joined #ocaml
igstan has quit [Read error: Connection reset by peer]
Thooms has joined #ocaml
slash^ has quit [Read error: Connection reset by peer]
ollehar has joined #ocaml
elfring has quit [Quit: Konversation terminated!]
ontologiae has joined #ocaml
zpe has quit [Remote host closed the connection]
ontologiae has quit [Ping timeout: 258 seconds]
macdice` has joined #ocaml
mbac has quit [Quit: Lost terminal]
macdice has quit [Ping timeout: 260 seconds]
manizzle has quit [Ping timeout: 260 seconds]
zpe has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
yomimono has quit [Ping timeout: 250 seconds]
yomimono has joined #ocaml
SethTIsue has quit [Ping timeout: 244 seconds]
boogie has quit [Remote host closed the connection]
boogie has joined #ocaml
mcclurmc has joined #ocaml
MercurialAlchemi has quit [Remote host closed the connection]
boogie has quit [Ping timeout: 240 seconds]
jave has quit [Ping timeout: 240 seconds]
MercurialAlchemi has joined #ocaml
jave has joined #ocaml
Submarine has joined #ocaml
morphles has quit [Ping timeout: 260 seconds]
hhugo1 has joined #ocaml
onetwo has quit [Ping timeout: 246 seconds]
q66 has joined #ocaml
boogie has joined #ocaml
<flux> gah, using the ocaml debugger can be quite frustating
manizzle has joined #ocaml
<adrien> nah
<adrien> it's part of the path to zen
<flux> let's say my vectors are made with Gg
<flux> fine, ocamldebug has a way to install printers
<flux> but apparently it cannot load .cma files where the printers would be
<flux> but even then I'm not yet sure if their signature is correct
boogie has quit [Ping timeout: 250 seconds]
<flux> better just do it the printf way ;)
<flux> not to mention the program is -very- slow when running under debugger..
sepp2k has quit [Quit: Konversation terminated!]
<flux> and apparently I cannot evaluate expressions in program context
<flux> and now that even gdb has reverse stepping, there's not much to be rejoiced with ocamldebug :(
girrig has quit [Ping timeout: 244 seconds]
girrig has joined #ocaml
boogie has joined #ocaml
yomimono has quit [Ping timeout: 260 seconds]
patojo has joined #ocaml
patojo has quit [Read error: Connection reset by peer]
boogie has quit [Ping timeout: 272 seconds]
boogie has joined #ocaml
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
manud has joined #ocaml
boogie has quit [Remote host closed the connection]
boogie has joined #ocaml
boogie has quit [Ping timeout: 258 seconds]
ontologiae has joined #ocaml
<flux> I suppose there is no trick to have 'all' opam modules built with .cmt, it's up to the individual packages to support that?
hhugo1 has quit [Quit: Leaving.]
hhugo1 has joined #ocaml
_andre has quit [Quit: leaving]
cespinoza has quit [Ping timeout: 260 seconds]
cespinoza has joined #ocaml
yomimono has joined #ocaml
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
cespinoza has quit [Max SendQ exceeded]
cespinoza has joined #ocaml
boogie has joined #ocaml
parcs has quit [Remote host closed the connection]
larhat has quit [Quit: Leaving.]
parcs has joined #ocaml
boogie has quit [Remote host closed the connection]
boogie has joined #ocaml
WraithM has quit [Ping timeout: 272 seconds]
<tobiasBora> Bonjour !
<tobiasBora> Hello !-
<tobiasBora> *
<tobiasBora> Do you know why I can't install any program with opam ? When I try to install a new one I got this error :
x4e has joined #ocaml
<nlucaroni> run a opam update to pull a new urls.txt file.
boogie has quit [Ping timeout: 258 seconds]
toolslive has quit [Ping timeout: 260 seconds]
<tobiasBora> nlucaroni: It seems to works, thank you !
toolslive has joined #ocaml
Submarine has quit [Remote host closed the connection]
mcclurmc has quit [Remote host closed the connection]
dav_ has quit [Remote host closed the connection]
<whitequark> flux: OCAMLPARAM=_,g
<whitequark> err, _,bin-annot
<flux> whitequark, hmm, so that affects compilation? nice
<whitequark> note that it's not OCAMLRUNPARAM
<flux> right :)
<whitequark> OCAMLRUNPARAM affects runtime, OCAMLPARAM affects compiler
<flux> doesn't seem superbly documented
<whitequark> I was about to say, yes
<whitequark> Drup: talking about OCAMLPARAM.
<Drup> ah, indeed
<flux> apparently it needs to be _,bin-annot=1
<flux> or at least it doesn't complain about Warning 46: illegal environment variable OCAMLPARAM : missing '=' in bin-annot
<whitequark> ah yes
<flux> too bad it doesn't solve the 'how to make the packages install the .cmt files as well'-part of the equation :)
hhugo1 has quit [Quit: Leaving.]
<whitequark> oh
<flux> so I just did it by hand for that particular package
hhugo1 has joined #ocaml
<flux> hmm, maybe if ocamlfind install also installed matching .cmt files for .cmi files if found..
badkins has quit [Read error: Connection reset by peer]
jonludlam has quit [Quit: Coyote finally caught me]
tane has quit [Quit: Verlassend]
tane has joined #ocaml
tane has quit [Remote host closed the connection]
manizzle has quit [Remote host closed the connection]
manizzle has joined #ocaml
rand000 has quit [Quit: leaving]
mcclurmc has joined #ocaml
Kakadu has quit [Quit: Konversation terminated!]
<smondet> whitequark: about OCAMLPARAM do you know how to set wran-error from that?
<smondet> *warn-error
<companion_cube> isn't warn-error a compile time option?
<smondet> yes like bin-annot
<smondet> it would be cool to be able to set it from "outside" your build system
<sheijk_> is there a way to install an ocaml version built with custom ./configure switches using opam?
lordkryss has quit [Quit: Connection closed for inactivity]
<sheijk_> i need a 32-bit version of ocaml on a 64-bit system. it's easy enought to build from source but i'd like to have it managed by opam
<Drup> sheijk_: yes, you need to create a custom opam repository
<Drup> you can use it locally, it's rather easy
<Drup> basically, it's a directory with a compiler/ directory and some stuff inside
<sheijk_> yeah, i just cloned the official one. will using that mess with my opam installation in any funny way?
<Drup> no no, don't clone the official one
<Drup> create a new, almost empty, one
<Drup> and add it with "opam repo add path/to/my/personal/repo
<sheijk_> and then both the official one an my local one will get used?
<smondet> (nothing really forbids you cloning from the morthership opam-repo, it's just more annoying to maintain in the long run)
<Drup> yes
<Drup> smondet: having both set of packages interact will provide some !FUN!
eikke has joined #ocaml
<smondet> that's how I test before pull-requesting to the mothership, it just works™
<Drup> smondet: as long as they are in sync :D
<smondet> but yes it's cleaner to have small opam-repos that interact well
<smondet> no opam can set priorities to opam-repos
<Drup> yes, I know
zpe has quit [Remote host closed the connection]
MercurialAlchemi has quit [Ping timeout: 260 seconds]
lordkryss has joined #ocaml
ggole has quit []
<sheijk_> is adding a compiler and/or creating a custom repo documented somewhere? only found this but it seems to be for packages only http://opam.ocaml.org/doc/Packaging.html
<sheijk_> the format seems to be straight-forward enough, though. should i expect error checking/handling to be good enough so i can just use trial and error?
<Drup> sheijk_: opam-admin is your friend
<Drup> (and the new and shiny "opam lint" is everyone's friend)
axiles has quit [Quit: Quitte]
<Drup> (except adrien, but that's because he's not nice)
ollehar has quit [Quit: ollehar]
spacebat has quit [Quit: WeeChat 0.3.2]
Simn has quit [Quit: Leaving]
hhugo1 has quit [Quit: Leaving.]
jabesed has joined #ocaml
eugene_klm has quit [Ping timeout: 250 seconds]
tac_ has joined #ocaml
Thooms has quit [Quit: WeeChat 0.4.3]
manud is now known as manudd
cespinoza has quit [Ping timeout: 260 seconds]
yomimono has quit [Ping timeout: 244 seconds]
WraithM has joined #ocaml
zpe has joined #ocaml
zpe has quit [Ping timeout: 240 seconds]
cespinoza has joined #ocaml
xyh has joined #ocaml
jabesed has quit [Quit: Konversation terminated!]
madroach has quit [Ping timeout: 250 seconds]
madroach has joined #ocaml
xyh has quit [Remote host closed the connection]
NoNNaN has quit [Remote host closed the connection]
darkf has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
badkins has joined #ocaml