flux changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | 3.11.0 out now! Get yours from http://caml.inria.fr/ocaml/release.html
Yoric[DT] has joined #ocaml
m3ga has joined #ocaml
itewsh has quit [Remote closed the connection]
Yoric[DT] has quit ["Ex-Chat"]
Camarade_Tux has quit ["Leaving"]
slash_ has quit ["leaving"]
crink has joined #ocaml
oriba has left #ocaml []
vuln has quit ["leaving"]
bohanlon has quit [Remote closed the connection]
psnively has quit []
bohanlon has joined #ocaml
ched_ has quit [Read error: 110 (Connection timed out)]
ched_ has joined #ocaml
jamii_ has quit [Read error: 60 (Operation timed out)]
mwhitney__ has quit [Read error: 104 (Connection reset by peer)]
mwhitney__ has joined #ocaml
hastake_ has joined #ocaml
hastake has quit [Read error: 104 (Connection reset by peer)]
willb has joined #ocaml
mwhitney__ has quit [Read error: 104 (Connection reset by peer)]
mwhitney__ has joined #ocaml
palomer has joined #ocaml
<palomer> http://pastebin.com/m471087a5 <--could someone explain what this functor error is?
willb has quit [Read error: 110 (Connection timed out)]
<thelema_> palomer: maybe unit is special and doesn't generalize to 'a
<palomer> but 'a is a parameter
<thelema_> generate wants node -> 'a, but you're giving it node->unit
<thelema_> maybe abi-wise there's a difference
<palomer> http://pastebin.com/m77d7a7d3 <--simpler example
<palomer> oh, I know what to do
<thelema_> This is the opposite - you have to give it a 'a, you can't give it an int
<thelema_> your expectation on covariance seems wrong
<thelema_> anyway, good night
<palomer> night!
m3ga has quit ["disappearing into the sunset"]
palomer has quit [Remote closed the connection]
pierre_m has joined #ocaml
mwhitney__ has quit [Read error: 110 (Connection timed out)]
mwhitney__ has joined #ocaml
mwhitney__ has quit [Read error: 110 (Connection timed out)]
Camarade_Tux has joined #ocaml
mwhitney__ has joined #ocaml
jeremiah has quit [Read error: 104 (Connection reset by peer)]
mwhitney__ has quit [Read error: 110 (Connection timed out)]
jeremiah has joined #ocaml
jeremiah has quit [Read error: 104 (Connection reset by peer)]
Camarade_Tux has quit ["Leaving"]
mwhitney__ has joined #ocaml
_zack has joined #ocaml
jeremiah has joined #ocaml
mwhitney__ has quit [Read error: 110 (Connection timed out)]
mwhitney__ has joined #ocaml
Palace_Chan has joined #ocaml
Palace_Chan has quit ["Palace goes to sleep"]
verte has joined #ocaml
Alpounet has joined #ocaml
s4tan has joined #ocaml
pierre_m has left #ocaml []
rwmjones_ has joined #ocaml
rwmjones_ has quit ["Closed connection"]
petchema has quit [Remote closed the connection]
seafood has joined #ocaml
hkBst has joined #ocaml
Yoric[DT] has joined #ocaml
seafood has quit []
seafood has joined #ocaml
filp has joined #ocaml
jeanbon has joined #ocaml
jeanbon has quit [Client Quit]
crink has left #ocaml []
_andre has joined #ocaml
petchema has joined #ocaml
seafood has quit []
willb has joined #ocaml
Camarade_Tux has joined #ocaml
_zack has quit ["Leaving."]
willb1 has joined #ocaml
willb has quit [Read error: 110 (Connection timed out)]
palomer has joined #ocaml
<palomer> ocaml isn't doing SoC?
mwhitney__ has quit [Read error: 110 (Connection timed out)]
Alpounet is now known as mlbot
mlbot is now known as Alpounet
mwhitney__ has joined #ocaml
<thelema_> palomer: ocaml hasn't ever done GSoC, although Jane Street runs something similar.
<hcarty> Yoric[DT], thelema_: Will the exceptions thrown by the Batteries modules be changed between now and the beta release?
Alpounet is now known as mlbot
mlbot is now known as Alpounet
saml has joined #ocaml
mwhitney__ has quit [Remote closed the connection]
mwhitney__ has joined #ocaml
<thelema_> hcarty: the seq exceptions are fixed now
<_andre> when i create a custom toplevel, is there a way to specify commands that are always run when it is executed? (like #load for example)
Jeff_ober has joined #ocaml
<Alpounet> with the -init option ?
<flux> _andre, if you mean like internally, then I don't think so.. except! There is the Toplevel (TopLevel?) module which afaik has functions like 'evaluate expressin', that might be able to do it. no experience on that, though.
<Alpounet> -init <file> Load <file> instead of default init file
<rwmjones> <repost> anyone seen zack around recently?
<_andre> thanks Alpounet and flux
<flux> what could reproduce this error message? "Error: error while parsing ocamldep output"
<flux> ah, ocamldsort
mwhitney__ has quit [Read error: 110 (Connection timed out)]
<thelema_> rwmjones: sorry, not recently.
* rwmjones really needs to release the ocaml-autoconf package ...
<Alpounet> via godi ?
maxote has quit [calvino.freenode.net irc.freenode.net]
mal`` has quit [calvino.freenode.net irc.freenode.net]
kg4qxk has quit [calvino.freenode.net irc.freenode.net]
saml has quit [calvino.freenode.net irc.freenode.net]
petchema has quit [calvino.freenode.net irc.freenode.net]
_andre has quit [calvino.freenode.net irc.freenode.net]
palomer has quit [calvino.freenode.net irc.freenode.net]
hkBst has quit [calvino.freenode.net irc.freenode.net]
bohanlon has quit [calvino.freenode.net irc.freenode.net]
OChameau has quit [calvino.freenode.net irc.freenode.net]
thelema has quit [calvino.freenode.net irc.freenode.net]
jonafan has quit [calvino.freenode.net irc.freenode.net]
Mr_Awesome has quit [calvino.freenode.net irc.freenode.net]
svenl_ has quit [calvino.freenode.net irc.freenode.net]
TaXules has quit [calvino.freenode.net irc.freenode.net]
kelaouchi has quit [calvino.freenode.net irc.freenode.net]
r0bby has quit [calvino.freenode.net irc.freenode.net]
mfp has quit [calvino.freenode.net irc.freenode.net]
holgr has quit [calvino.freenode.net irc.freenode.net]
mrvn has quit [calvino.freenode.net irc.freenode.net]
gildor has quit [calvino.freenode.net irc.freenode.net]
ertai has quit [calvino.freenode.net irc.freenode.net]
filp has quit [calvino.freenode.net irc.freenode.net]
authentic has quit [calvino.freenode.net irc.freenode.net]
tab has quit [calvino.freenode.net irc.freenode.net]
bartiosze has quit [calvino.freenode.net irc.freenode.net]
sbok has quit [calvino.freenode.net irc.freenode.net]
Ori_B has quit [calvino.freenode.net irc.freenode.net]
ched_ has quit [calvino.freenode.net irc.freenode.net]
smimou has quit [calvino.freenode.net irc.freenode.net]
manju has quit [calvino.freenode.net irc.freenode.net]
fremo has quit [calvino.freenode.net irc.freenode.net]
burton_ has quit [calvino.freenode.net irc.freenode.net]
delroth has quit [calvino.freenode.net irc.freenode.net]
Amorphous has quit [calvino.freenode.net irc.freenode.net]
jlouis has quit [calvino.freenode.net irc.freenode.net]
sgnb has quit [calvino.freenode.net irc.freenode.net]
haelix has quit [calvino.freenode.net irc.freenode.net]
ido has quit [calvino.freenode.net irc.freenode.net]
patronus has quit [calvino.freenode.net irc.freenode.net]
infoe|wk has quit [calvino.freenode.net irc.freenode.net]
tarbo2 has quit [calvino.freenode.net irc.freenode.net]
<Alpounet> aouch
Amorphous has joined #ocaml
jlouis has joined #ocaml
sgnb has joined #ocaml
tarbo2 has joined #ocaml
haelix has joined #ocaml
infoe|wk has joined #ocaml
patronus has joined #ocaml
ido has joined #ocaml
mal`` has joined #ocaml
kg4qxk has joined #ocaml
saml has joined #ocaml
palomer has joined #ocaml
petchema has joined #ocaml
_andre has joined #ocaml
hkBst has joined #ocaml
bohanlon has joined #ocaml
OChameau has joined #ocaml
thelema has joined #ocaml
jonafan has joined #ocaml
Mr_Awesome has joined #ocaml
kelaouchi has joined #ocaml
mfp has joined #ocaml
svenl_ has joined #ocaml
TaXules has joined #ocaml
authentic has joined #ocaml
holgr has joined #ocaml
gildor has joined #ocaml
ertai has joined #ocaml
mrvn has joined #ocaml
filp has joined #ocaml
sbok has joined #ocaml
bartiosze has joined #ocaml
tab has joined #ocaml
Ori_B has joined #ocaml
manju_ has joined #ocaml
manju_ has quit [Killed by brown.freenode.net (Nick collision)]
manju_ has joined #ocaml
ched_ has joined #ocaml
smimou has joined #ocaml
delroth has joined #ocaml
burton_ has joined #ocaml
fremo has joined #ocaml
manju_ has quit [Remote closed the connection]
manju_ has joined #ocaml
ched_ has quit [calvino.freenode.net irc.freenode.net]
smimou has quit [calvino.freenode.net irc.freenode.net]
burton_ has quit [calvino.freenode.net irc.freenode.net]
delroth has quit [calvino.freenode.net irc.freenode.net]
fremo has quit [calvino.freenode.net irc.freenode.net]
ched_ has joined #ocaml
smimou has joined #ocaml
delroth has joined #ocaml
burton_ has joined #ocaml
fremo has joined #ocaml
jamii_ has joined #ocaml
jlouis has quit [Remote closed the connection]
ched_ has quit [calvino.freenode.net irc.freenode.net]
smimou has quit [calvino.freenode.net irc.freenode.net]
burton_ has quit [calvino.freenode.net irc.freenode.net]
fremo has quit [calvino.freenode.net irc.freenode.net]
delroth has quit [calvino.freenode.net irc.freenode.net]
jlouis has joined #ocaml
<hcarty> thelema_: Is there a decision on what to do with List's exceptions?
<flux> there are plans to go away with exceptions by default, or are there other issues with it?
ched__ has joined #ocaml
burton_ has joined #ocaml
fremo_ has joined #ocaml
delroth_ has joined #ocaml
delroth_ is now known as delroth
smimou has joined #ocaml
<hcarty> flux: Inconsistency in which exceptions are used
<hcarty> List.reduce raises a different exception for an empty list than List.hd or List.tl, for example
verte has quit ["http://coyotos.org/"]
maxote has joined #ocaml
Camarade_Tux has quit ["Leaving"]
Amorphous has quit [Read error: 110 (Connection timed out)]
Amorphous has joined #ocaml
fremo_ is now known as fremo
fremo is now known as Guest27635
<hcarty> Yoric[DT], thelema_: Are the Exceptionless and Labels submodules intended to be used together (for List, Array and possibly others)?
<hcarty> Some functions would currently be masked
<Yoric[DT]> Unfortunately not quite.
Guest27635 is now known as fremo
* Yoric[DT] can't think of a way of doing this without the masking issue.
<hcarty> Would having Array.Labels.Exceptionless work? Similar to how Array.Cap has Exceptionless and Labels submodules?
<mrvn> And then all functions that now raise an exception would return a bool or option type instead?
<hcarty> mrvn: That is what the current Foo.Exceptionless modules do, as I understand it
<Yoric[DT]> Well, we could write additional combinations, with Labels.Exceptionless.
<thelema> I can't see any good way to compose Labels and Exceptionless automatically, but if people really want exceptionless, labeled functions, batteries can provide
<mrvn> I hate that when the exception is really exceptional.
<hcarty> Batteries promises (and is quite close to delivering) the world on that front :-)
<mrvn> like let str = Aio.get_string buffer 16 in match Uuidm.of_string str with None -> raise WhatTheFuck | Some x -> x
<mrvn> Uuidm throws an exception if the string isn't 16 bytes and I know it always is.
<Yoric[DT]> hcarty: :)
<thelema> hmm... I wonder about generating *.Labels programatically
<mrvn> Wouldn't it be easier the other way around?
<thelema> mrvn: generating non-labeled functions automatically... yes, that would be easier
<thelema> hmm, I wonder what would come out of a debate to have batteries default to labeled arguments
<thelema> I guess the backwards-compatibility dragon would rear its head
<mrvn> Why? the conversion would givethe old api
maxote has quit [calvino.freenode.net irc.freenode.net]
<thelema> mrvn: yes, that's right. I'm thinking about having *.Unlabeled, and having the default api be labeled
<mrvn> That would suck
maxote has joined #ocaml
<thelema> complete applications of a function don't need labels
<Yoric[DT]> Yeah, but partial ones do.
<thelema> eta expansion is a good thing.
<palomer> eta's overrated
* thelema wonders if the overhead for allowing non-complete function application everywhere is worth the syntax savings vs. having to do explicit partial application.
<palomer> labels rock!
_zack has joined #ocaml
r0bby has joined #ocaml
rhar has joined #ocaml
* thelema agrees that optional labels are great. The current ocaml syntax for labels blows. Tilde? who uses tilde?
willb1 has quit [Read error: 54 (Connection reset by peer)]
maxote has quit [calvino.freenode.net irc.freenode.net]
maxote has joined #ocaml
maxote has quit [calvino.freenode.net irc.freenode.net]
maxote has joined #ocaml
maxote has quit [calvino.freenode.net irc.freenode.net]
maxote has joined #ocaml
maxote has quit [calvino.freenode.net irc.freenode.net]
<hcarty> For List.Labels, adding an Exceptionless module seems to be pretty straightforward
<hcarty> List.Exceptionless is missing the find function though
jeremiah has quit [Read error: 104 (Connection reset by peer)]
maxote has joined #ocaml
* thelema would fix this right now if he weren't at work
<hcarty> http://ocaml.pastebin.com/m4e47f321 -- Does this patch look reasonable (untested)
itewsh has joined #ocaml
Jeff_ober has left #ocaml []
<thelema> it looks fine to me. Can you use git?
<hcarty> thelema_: I'm finishing up and testing the patch now. I'll submit a git-diff as soon as it's ready?
<hcarty> Should I submit to the list or the bug tracker?
<hcarty> Drat, that does not seem to work
maxote has quit [calvino.freenode.net irc.freenode.net]
<hcarty> Error: Multiple definition of the module name Exceptionless. -- when trying "module List = List with Labels, Exceptionless;;"
mwhitney__ has joined #ocaml
maxote has joined #ocaml
<hcarty> I'll try to look at it again later
jeremiah has joined #ocaml
thelema_ has quit [Read error: 110 (Connection timed out)]
maxote has quit [calvino.freenode.net irc.freenode.net]
ched__ has quit ["Ex-Chat"]
Ched has joined #ocaml
<_andre> is it possible to get a string representation of a given expression in camlp4?
Ogedei has joined #ocaml
maxote has joined #ocaml
s4tan has quit []
<palomer> hrmph
willb1 has joined #ocaml
jeanbon has joined #ocaml
itewsh has quit [Connection timed out]
maxote has quit [calvino.freenode.net irc.freenode.net]
itewsh has joined #ocaml
maxote has joined #ocaml
<mrvn> How do I specify an open variant type ala type data = [> `NIL | `ERR ];; ?
|jedai| has joined #ocaml
jlouis has quit ["lamergamery"]
jedai has quit [Read error: 110 (Connection timed out)]
itewsh has quit [Read error: 60 (Operation timed out)]
itewsh has joined #ocaml
<Alpounet> why do you need it ?
<Alpounet> with such use, normal variants aren't enough ?
jeremiah has quit [Read error: 104 (Connection reset by peer)]
<mrvn> Because the data structure does not know what will be stored there in the end, like a `Foo 1
<olegfink> can someone suggest a functional (in both meanings) implementation of a type inference algorithm, preferably Hindley-Milner one?
<olegfink> the implementation in ocaml compiler is a bit scary.
willb1 has quit [Remote closed the connection]
willb has joined #ocaml
<_andre> mfp: i'll have a look, thank you!
<mrvn> type 'a t = { dev : int; block : int64; mutable data : 'a data; }
<mrvn> val make : int -> int64 -> 'a t
<mrvn> let nil = make 0 Int64.zero
<mrvn> val nil : '_a t
<mrvn> gives me The type of this module contains type variables that cannot be generalized.
<mrvn> How do I get "nil" to be generalized?
<mfp> let nil () = make 0 Int64.zero
<mfp> ;)
<mrvn> It is supposed to be a value, not a function.
<mrvn> Like "None"
<mfp> then it cannot be polymorphic
<mrvn> # None;;
<mrvn> - : 'a option = None
<mfp> what would happen if you did t.data <- Data "x" and then t.data <- Data 42
<mfp> *mutable*
<mrvn> right.
<mrvn> Without mutable it works.
<Alpounet> does anyone know why the following exception is thrown : exception Sys_error("_none_: No such file or directory")
<Alpounet> ?
<thelema> Alpounet: trying to open the file "_none_"?
Snark has joined #ocaml
<Alpounet> dont think so...
<mfp> Alpounet: camlp4 trying to ... ?
<Alpounet> I try to open ".log" and ".err"
<Alpounet> that's all
<mrvn> mfp: Any idea why I can't define a type data = [> `Nil | `Err ]?
<petchema> Alpounet: try stracing your program
<mfp> mrvn: it's the >
<thelema> Alpounet: get an exception backtrace?
<petchema> Alpounet: or backtraces, yes
<mrvn> mfp: but why?
jeremiah has joined #ocaml
<Alpounet> ok, gonna go this way
<mfp> there's an implicit type variable that you need to make explicit
<mfp> similar to the row variable in < foo: bar; ..> (the ..)
<mfp> type 'a data = 'a constraint 'a = [> `Err | `Nil];;
filp has quit ["Bye"]
<mrvn> mfp: That would make different data values different types.
<Alpounet> Ok, I get :
<Alpounet> Time : 220042 - pc : 2484 - module Pervasives
<Alpounet> 280 <|b|>open_descriptor_in(open_desc name mode perm)
<mfp> you can't have it both ways, an open type and exhaustiveness
<mfp> should any `Foo also be : data?
itewsh has quit [Read error: 60 (Operation timed out)]
<mrvn> mfp: yes
<thelema> Alpounet: print name
itewsh has joined #ocaml
<Ogedei> how does O'Caml's garbage collector find pointer on the stack and in registers? a separate stack and special-purpose registers?
<mfp> mrvn: and then you give it to some [> `Nil | `Err] function?
<mrvn> mfp: yes.
mwhitney__ has quit [Read error: 110 (Connection timed out)]
<mrvn> mfp: I just noticed that I can put a "foo data" and "bar data" into a single list.
<mfp> why do you need to declare the type then then? it doesn't add anything the functions don't have
<mrvn> mfp: It is part of a record.
<mfp> k
<mfp> anyway since `A is [> `A], ([`A; `B] : _ data list) will become [`A | `B | `Err | `Nil] data list
<mrvn> let x = `Nil let y : 'a data = `Foo 1 let z : 'a data = `Var 1.0
<mrvn> # [x;y;z];;
<mrvn> - : [> `Err | `Foo of int | `Nil | `Var of float ] data list =
<mrvn> [`Nil; `Foo 1; `Var 1.]
<mrvn> I assumed one couldn't do that as y and z have different types.
<mfp> but they don't, they're both [> `something]
<mfp> so the types unify nicely
<mrvn> Actualy why are they [> ] and not [ ]?
<mfp> if `A were : [`A], how would you create a value of type [`A | `B]?
<mfp> (`A : [`A] :> [`A | `B]) ugh
<mrvn> mfp: I wouldn't, a [`A] can be passed to a function expecting a [`A | `B] or not?
<Alpounet> I'll see tomorrow.
<mfp> there's no implicit subsumption, it'd have to be explicit
<Alpounet> I have more interesting things to do :-p
<mrvn> mfp: Seems silly to hide the [> `NIL | `ERR ] in a 'a but I guess it will work.
<mfp> # let a : [`A] = `A;; # let f (x : [`A | `B]) = x;;
<mfp> val f : [ `A | `B ] -> [ `A | `B ] = <fun>
<mfp> # f a;;
<mfp> Error: This expression has type [ `A ] but is here used with type [ `A | `B ]
<mfp> The first variant type does not allow tag(s) `B
Yoric[DT] has quit ["Ex-Chat"]
<mrvn> mfp: still doesn't work perfectly: val nil : _[> `Buf of Aio.buffer | `ERR | `NIL ] t
<mrvn> mfp: even without mutable now
<mrvn> val make : int -> int64 -> [> `Buf of Aio.buffer | `ERR | `NIL ] t
<mrvn> Why does "make 0 Int64.zero" have type _[> `Buf of Aio.buffer | `ERR | `NIL ] t?
_zack has quit ["Leaving."]
<mrvn> Or in other words: Why does "let nil = { dev = 0; block = Int64.zero; cksum = Checksum.nil; data = `NIL; }" work but "let nil = make 0 Int64.zero" does not?
<thelema> Why are you trying to recreate NULL in a language with option types?
<thelema> mrvn: record typing is special.
<thelema> record fields can have types that values can't.
<thelema> because record fields are explicitly typed.
<mrvn> thelema: because I have `NIL (data is not loaded), `ERR (can't be loaded), `Buf x (loaded but not parsed) and `whatever (parsed data)
<thelema> do you have a type for `whatever?
<mrvn> If I put it in then I have a circulat dependency.
<mrvn> circular even
<thelema> sounds like you need to factor your types into a separate module
<mrvn> Can't. This is the lowesttype that references a structure on disk. Pretty much all the other structures have a bunch of them.
<mrvn> Only thing I could do is dump them all into one HUGE module.
<thelema> functorize?
<thelema> this type builds on another type - pass that other type in through a functor
<mrvn> How does that solvethe circularity?
<thelema> it allows you to build this "lowesttype" without referring directly to the other structures
itewsh has quit [Success]
<mrvn> But the higher types contain the lower type. So to define the higher type I then need to resolve the functor first.
itewsh has joined #ocaml
thelema_ has joined #ocaml
mwhitney__ has joined #ocaml
<hcarty> thelema: Would "module List = List.Labels with Exceptionless" working but not "module List = List with Labels, Exceptionless" working be acceptable?
<thelema> mrvn: your types are that recursive?
<thelema> hcarty: yes, with sufficient documentation
<mrvn> thelema: A tree node has an array of tree block references. And a tree block reference has a tree node once it is loaded.
<mrvn> thelema: It is kind of a lazy type.
<mrvn> thelema: load from disk when needed
<thelema> and you can have Nil, Err, Buf or some parsed value at every step?
Ogedei has left #ocaml []
<thelema> s/step/point/
<mrvn> thelema: yes. And loading from disk is asynchron.
<thelema> and you have different kinds of trees, each with different `whatever types?
<mrvn> thelema: 2 kinds probably. But the tree is an 'a BTree.
<thelema> hmm, maybe writing it out isn't so bad.
itewsh has quit [Connection timed out]
itewsh has joined #ocaml
infoe|wk has quit ["brb"]
itewsh has quit [SendQ exceeded]
itewsh has joined #ocaml
<mrvn> thelema: I eventualy might have to use a functor actually. I think I want the Block.t have the ability to write out data to disk and that would require calling M.to_buffer on the 'a.
gildor has quit [Remote closed the connection]
<mrvn> How do I call a functor with a polymorphic type?
_zack has joined #ocaml
OChameau has quit ["Leaving"]
<mrvn> I have types 'a Block.Meta.t and Block.Data.t and a functor Stripe. I now need an 'a Stripe.Meta and Stripe.Data type.
<mrvn> aeh. module I mean.
<thelema> your functor has to expect a ['a t] if you want to give it that.
<mrvn> I want to give it either a 'a t or just t.
itewsh has quit [Success]
itewsh has joined #ocaml
<thelema> you'd need two different functors, or maybe you could end up with 'a Block.Meta.t Stripe.Meta.t
<mrvn> The 'a in line 24 is unneccessary. But if I remove it then I can't call the Stripe functor on both modules.
<thelema> I guess that would work.
<mrvn> How do I get a 'a Block.Meta.t Stripe.Meta.t?
<_andre> say i have a function "let foo (x:Ast.expr) = <:expr< ... >>". can i access x as an Ast.expr inside the quotation?
<_andre> what i'm actually trying to do is calling "string_of_expr x"
<thelema> mrvn: 'a Stripe.Meta.t
<mrvn> thelema: how do I tell the functor that?
<mrvn> The functor should have type t = 'a Block.Meta.t giving me an 'a Stripe.Meta.t
<thelema> mrvn: it's a non-functor solution, if you really don't do anything to the contained values
<mrvn> I'm calling Block.into_buffer buffer
<thelema> then you need your functor
<thelema> keep the useless 'a
<mrvn> val into_buffer : Aio.buffer -> 'a t -> unit
<thelema> _andre: sorry, it seems there's no camlp4 gurus here
* _andre looks at mfp :P
<mrvn> thelema: I need a polymorphic module.
gildor has joined #ocaml
<hcarty> thelema: My proposed idea will not work, as List.Labels does not contain all of the List module functions, only the labeled ones.
<thelema> hcarty: oh yeah, I forgot about that.
<thelema> hcarty: rename Labels.Exceptionless -> Labels.LExceptionless
<hcarty> thelema: And then Array.Exceptionless -> Array.AExceptionless?
<hcarty> thelema: Sorry, I misread
<thelema> just LExceptionless for exceptionless labeled functions
<hcarty> That makes sense. I read "Labels" as "List" when I replied
<thelema> no problem
<_andre> found a workaround :)
itewsh has quit [Read error: 110 (Connection timed out)]
itewsh has joined #ocaml
infoe|wk has joined #ocaml
<hcarty> thelema: If you have time, would you mind looking over this patch: http://ocaml.pastebin.com/m106b70f7
<hcarty> It add the Labels.LExceptionless modules to Array and List, and adds List.Exceptionless.find
<thelema> hcarty: looks good on visual inspection - assuming the compiler likes it, I'd commit.
<hcarty> It compiles and seems to work cleanly here.
<hcarty> I don't have commit access, so I'll submit it to the mailing list
<thelema> Do you have an account on ocamlforge?
<hcarty> Yes
_zack has quit ["Leaving."]
<thelema> want commit access?
<hcarty> Sure
<hcarty> Yes
_PenPen_ has joined #ocaml
slash_ has joined #ocaml
ttamttam has joined #ocaml
fontana has joined #ocaml
rhar has quit [Read error: 110 (Connection timed out)]
<mrvn> I want prefix suport for records.
<thelema> mrvn: record inheritance?
<mrvn> yes
jeremiah has quit [Read error: 104 (Connection reset by peer)]
<mrvn> type foo = { x : int } and bar = { inherit foo; y : int } let get_x t = t.x let x = get_x { x = 1; y = 2; } That sort of code.
_PenPen_ has quit ["Leaving"]
ttamttam has left #ocaml []
mwhitney__ has quit [Read error: 110 (Connection timed out)]
<thelema> needs more complex type system...
<mrvn> thelema: mee too. I want type modifiers like "const" and more inheritance.
<flux> mrvn, pft, just make do what with you have!
<flux> ;)
<flux> s/what with/with what/
<mrvn> module Foo = struct inherit Bar type t = { inherit Bar.t z : int } ... would be nice
<mrvn> flux: I hate code duplication.
<flux> constness can be mostly emulated with phantom types
<flux> type t = { parent : Bar.t; z : int } ..
<mrvn> flux: let f (x : const) = ... should work for both const and non-const types.
<flux> let f (x : 'a value) = would work for both of them too
<mrvn> flux: and then you have "mutable value" and "const value" types?
<flux> yes
<itewsh> I am trying to build a library, but I don't really know how to do. For instance, I have a file "test.ml" with this function : "let myfunc a b = a + b", and then, I tried this command : "ocamlmklib test.ml -o test" is it hitherto good ?
<flux> or possibly read-only, write-only and read-write values
<mrvn> flux: and how do you write a function that only works on "mutable values" inside the value module?
<flux> mrvn, if it is possible to see the real type of the value, it doesn't work
<flux> maybe it can work more decently with private type abbreviations
<mrvn> flux: e.g. length : const 'a array -> int, get : const 'a array -> int -> const 'a | 'a array -> int -> 'a
<mrvn> set : 'a array -> int -> 'a -> unit definetly not const.
<flux> set : (const, 'a) array -> int -> 'a -> unit, no?
<mrvn> You can not set values in a const array. That violates the constness.
<flux> oh, right, I obviously meant something like set : (mutable, 'a)
<mrvn> flux: yes. but how do you write length and get?
<flux> length : (_, 'b) array -> int
<flux> get : (_, 'a) array -> int -> const 'a
<flux> const 'a value
seafood has joined #ocaml
<flux> doesn't batteries have this kind of thing?
<mrvn> get : ('b, 'a) array -> int -> 'b 'a value more likely.
<flux> that's essentially the same
<mrvn> no, get from a mutable array should give mutables back.
<mrvn> flux: Interesting approach. have to try that.
<flux> oh, right
<flux> I've used it once I think
<flux> it worked ok
<mrvn> Although one could have a mutable array of const values.
jeremiah has joined #ocaml
<mrvn> ('a, 'b, 'c) array.t
<flux> I think it quickly leads into something that nees functors
<hcarty> itewsh: "ocamlbuild test.cma" or "ocamlbuild test.cmxa" is one way. http://ocaml-tutorial.org/ has more information
<mrvn> get: (const, 'b , 'c) array -> int -> 'b 'c value
<mrvn> flux: functors don't give interchangable types.
<hcarty> itewsh: I think you'd want to use "ocamlc -c test.ml" (or ocamlopt) rather than ocamlmklib though
<mrvn> As to your type t = { parent : Bar.t; z : int } that needs let f t = Bar.f t.parent for every function. Not ideal.
<mrvn> Here is another type attibute that might be usefull: temporary. A temporary value may not stored in values that have a longer life span than the value itself.
<mrvn> For 'M.unsafe_string t' functions.
<flux> linear typing would be a nice thing to see in ocaml environment
<mrvn> linear typing?
<flux> in linear typing you use a value exactly once
<itewsh> hcarty: okay, but when I got my ".cma" file, am I able to use it (with "ocaml -I +test.cma")? Moreover, How do I have to declare the function inside the library? (I suppose with a ".mli" file?)
<flux> of course, the party providing the type can possibly see 'inside' the type and do other things
<mrvn> flux: With functional types, i.e. copy-on-write, that is pretty useless.
<flux> no, not really
<flux> for example with that you can guarantee an opened file descriptor gets closed
<flux> because you can't get rid of the fd without closing it :)
<hcarty> itewsh: This is all covered in the OCaml manual intro and the tutorial. To sum up though, "ocamlc test.cma foo.ml -o foo" and "Test.myfunc 1 2"
<flux> I think it might also cover your use case
<mrvn> flux: let f x = let fd = Unix.open_file x .. in 17
<mrvn> flux: where does it get closed?
<flux> it doesn't, and it won't compile either
<flux> because you don't call Unix.close fd which would 'eat' the fd
<mrvn> flux: so with linear types you would have to always unbind certain types?
<hcarty> mrvn: There is an OCaml compiler patch around somewhere that adds the ability to use multiple record types with the same field names. But I think it's for an older version of OCaml
<flux> in a way, yes
<flux> here's a bunch of white papers on the topic: http://homepages.inf.ed.ac.uk/wadler/topics/linear-logic.html
<mrvn> flux: For FDs I use an abstract type with a finalize function that closes it.
<flux> mrvn, so what happens if you open 2000 files in a loop and let the GC handle them?
<mrvn> flux: Only problem is that at exit the GC isn't run but Linux closes all FDs on exit.
<flux> really, don't do that
<mrvn> flux: close closes the FD and sets it to -1 internally. read on -1 gives an error.
<flux> mrvn, but if gc doesn't get run until you run out of fds..
<mrvn> flux: finalize outputs a warning to stderr and closes it.
<flux> oh, that kind of finaliser
<flux> that can be useful
<mrvn> flux: You can just not close FDs but as you said: if gc doesn't get run until you run out of fds ...
<mrvn> flux: the open call could run the GC if it fails and retry once.
<flux> gc is no good for managing resources other than memory
<mrvn> I basically just use it for checking that I don't leak.
<flux> mrvn, so what kind of object do you have, you can't use Unix.file_descr?
<mrvn> flux: Aio.file_descr
<itewsh> hcarty: which section relates to the building of a library? (http://ocaml-tutorial.org/)
<flux> ah
<flux> itewsh, I quickly browsed it through the index and none of them seemed to, but the manual does touch the subject
<flux> possibly only in the context of interfacing with C, though
<mrvn> What does the mmap module in batteries do? Does it have a finalizer to unmap()?
<hcarty> itewsh: "Modules" and "Compiling OCaml Projects" -- also, read part 1 of http://caml.inria.fr/pub/docs/manual-ocaml/ as it has several simple examples
<itewsh> ok thanks
bzzbzz has quit ["leaving"]
Yoric[DT] has joined #ocaml
<mrvn> One thing I'm missing in ocaml is an unmovable tag and helper functions. I want to allocate a ocaml string outside the GC heap that wont be compacted.
<mrvn> Or a record with some data and a callback that won't be moved so I can use its address in C.
mwhitney__ has joined #ocaml
<flux> mrvn, the ancient module is related to that a bit..
<mrvn> but only works with imutable types.
<hcarty> mrvn: Does the existing C callback structure not work for what you are doing?
<mrvn> Or a tag for a custom block that contains only ocaml data. I want custom_operations but the GC should scan the block and may move it.
<hcarty> It would be nice if it were simpler though
<mrvn> hcarty: you mean exporting a symbol globally?
<hcarty> mrvn: Yes
<mrvn> hcarty: exporting a symbol still lets the GC move it around.
<mrvn> hcarty: caml_named_value(n) gives you a pointer to the value. I can get a pointer to the string that way but in libaio the kernel writes directly into the string. If the GC moves it at that point then bad stuff happens.
itewsh has quit [Connection timed out]
itewsh has joined #ocaml
<hcarty> mrvn: Isn't that what the "if (foo = NULL) ..." deals with?
<mrvn> hcarty: why should it be NULL?
<hcarty> Or perhaps I am misunderstanding the issue
<mrvn> CAMLprim value read(value fd, value buf) { async_read(Int_val(fd), String_val(buf)); return Val_unit; }
<mrvn> hcarty: you call that, it emidiatly returns. 10s later the kernel starts getting the data and dumps it into the string.
<mrvn> If the "buf" has moved at that point the data goes to the wrong place.
<hcarty> mrvn: Ah, ok
<hcarty> Yoric[DT]: Do you know the directory to git clone for dev access?
<hcarty> Yoric[DT]: For Batteries on the forge
<Yoric[DT]> iirc, it's written on the batteries homepage.
<Yoric[DT]> Ah no, it isn't.
rhar has joined #ocaml
<Yoric[DT]> Might be
<Yoric[DT]> git+ssh://git.ocamlcore.org/gitroot/batteries/batteries.git
fontana has quit [Read error: 113 (No route to host)]
<hcarty> If you weren't around, thelema suggested using Foo.Labels.LExceptionless to allow "module Foo = Foo with Labels, LExceptionless" to avoid the value masking issue
<hcarty> Yoric[DT]: That is it, thank you
<Yoric[DT]> Why the L?
fontana has joined #ocaml
<hcarty> Otherwise OCaml complains about multiple modules names Exceptionless
Snark has quit ["Ex-Chat"]
<hcarty> Foo.Labels.LExceptionless rather than Foo.Labels.Exceptionless avoids that. LExceptionless are labeled, exceptionless functions
<Yoric[DT]> ok
<hcarty> If this is acceptable to both of you then I can push the changes for Array, List and Enum
<Yoric[DT]> That would be nice.
<thelema> hcarty: push onwards.
_andre has quit ["Lost terminal"]
mwhitney__ has quit [Read error: 110 (Connection timed out)]
mwhitney__ has joined #ocaml
Narrenschiff has joined #ocaml
<hcarty> What is the proper localbranch -> master -> forge process? (on master) "git merge local && git push"?
itewsh has quit [Connection timed out]
<hcarty> I remember some discussion on here a while ago about avoiding extraneous merge messages, but I don't remember the result
itewsh has joined #ocaml
<hcarty> Nevermind, it seems to have worked properly
Narrenschiff has quit []
<hcarty> thelema, Yoric[DT]: Thank you for your assistance in getting this setup
m3ga has joined #ocaml
Narrenschiff has joined #ocaml
itewsh has quit [Success]
itewsh has joined #ocaml
<thelema> hcarty: thank you for your patch
<mfp> hcarty: (in local) git rebase -i master git push origin local:master to rebase your patches
<mfp> or git rebase -i master git checkout master git merge local git push
<thelema> sometimes when you push, someone else has pushed already, so you need to fetch (not pull), rebase, and then push
<hcarty> mfp, thelema: Ok, thank you
mwhitney__ has quit [Read error: 110 (Connection timed out)]
mwhitney__ has joined #ocaml
<Yoric[DT]> hcarty: well, thanks for doing the actual job.
Ppjet6 has joined #ocaml
seafood_ has joined #ocaml
dartelin has joined #ocaml
<dartelin> hello
jonafan_ has joined #ocaml
<dartelin> i have a question
<dartelin> type ('a,'b) ab = A of 'a | B of 'b;;
<dartelin> xemacs trows syntax error
Camarade_Tux has joined #ocaml
<dartelin> Characters 34-36:
<dartelin> type ('a,'b) ab = A of 'a | B of ';;
<dartelin> ^^
<dartelin> Error: Syntax error
<dartelin> #
<dartelin> can anyone tell me why ?
<mrvn> because you forgot a "b"
<dartelin> so how should id look like ?
<mrvn> # type ('a,'b) ab = A of 'a | B of 'b;;
<mrvn> type ('a, 'b) ab = A of 'a | B of 'b
<dartelin> but i didn't forget it
<dartelin> it's there a the end
<mrvn> Not in what you pasted
<dartelin> type ('a, 'b) ab = A of 'a | B of 'b
<dartelin> this trows me also syntax error
<dartelin> it's what you've pasted :)
<mrvn> did you put ';;' into a file and tried to compile it?
<dartelin> no and yes
<dartelin> either way the same exception
<mrvn> ;; is only for the toplevel.
<mrvn> what is before or after the type?
<dartelin> nothing
<dartelin> it's a blank file
<dartelin> type ('a, 'b) ab = A of 'a | B of int
<dartelin> this works like a charm
<dartelin> but not with 'b instead of int
<mrvn> works here
hkBst has quit [Read error: 104 (Connection reset by peer)]
<dartelin> hmm, could it be something with my enviroment ?
<dartelin> xemacs
<dartelin> and newest ocaml
<dartelin> tcl also
<mrvn> not really
seafood has quit [Read error: 110 (Connection timed out)]
<dartelin> this is weird
<dartelin> i have no idea what could be worng
<dartelin> wrong*
* dartelin is confused
fontana has quit [Read error: 110 (Connection timed out)]
fontana has joined #ocaml
jonafan has quit [Read error: 110 (Connection timed out)]
jonafan has joined #ocaml
jonafan_ has quit [Read error: 110 (Connection timed out)]
itewsh has quit ["There are only 10 kinds of people: those who understand binary and those who don't"]
jlouis has joined #ocaml
fontana has quit ["Leaving"]
mwhitney__ has quit [Read error: 110 (Connection timed out)]
Camarade_Tux has quit ["Leaving"]
mttobks has joined #ocaml
willb has quit [Read error: 110 (Connection timed out)]
dartelin has quit [Read error: 110 (Connection timed out)]
slash_ has quit ["leaving"]