mfp changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 3.11.2 released | Inscription for OCaml Meeting 2010 is opened http://wiki.cocan.org/events/europe/ocamlmeetingparis2010
tmaedaZ is now known as tmaeda
tmaeda is now known as tmaedaZ
DaveS has quit [Ping timeout: 240 seconds]
pad has joined #ocaml
wu27 has joined #ocaml
wu27 has left #ocaml []
threeve has joined #ocaml
Associat0r has quit [Quit: Associat0r]
krankkatze_ has joined #ocaml
enthymene has quit [Quit: rcirc on GNU Emacs 23.1.1]
yakischloba has quit [Quit: Leaving.]
thrasibule has quit [Ping timeout: 252 seconds]
valross has joined #ocaml
EliasAmaral is now known as dark
derdon has quit [Quit: derdon]
joewilliams is now known as joewilliams_away
maskd has quit [Quit: leaving]
Drk-Sd has joined #ocaml
yakischloba has joined #ocaml
srcerer has joined #ocaml
enthymene has joined #ocaml
srcerer has quit [Read error: Connection reset by peer]
srcerer has joined #ocaml
thrasibule has joined #ocaml
Drk-Sd has quit [Quit: {'EXIT', Drk-Sd, "bye"}]
valross has quit [Ping timeout: 240 seconds]
joewilliams_away is now known as joewilliams
valross has joined #ocaml
pad has quit [Remote host closed the connection]
dark has quit [Remote host closed the connection]
ulfdoz has quit [Ping timeout: 276 seconds]
ulfdoz has joined #ocaml
threeve has quit [Quit: threeve]
ztfw has joined #ocaml
thrasibule has quit [Ping timeout: 245 seconds]
ygrek has joined #ocaml
joewilliams is now known as joewilliams_away
Ori_B has quit [Ping timeout: 260 seconds]
Ori_B has joined #ocaml
tmaedaZ is now known as tmaeda
Gooffy has joined #ocaml
Submarine has joined #ocaml
Yoric has joined #ocaml
jcaose has joined #ocaml
ikaros has joined #ocaml
<sfuentes> is it possible to add a type signature to a function definition?
<flux> yes. you can do it in two ways:
<flux> a) let f (a : int) (b : int) : int = a + b
<flux> b) let f : int -> int -> int = fun a b -> a + b
<sfuentes> aww. i thought it would require its own line
<sfuentes> from the bit of haskell that i know
<sfuentes> thanks flux
<flux> sfuentes, happy to help. btw, note that 'a isn't really guaranteed to stay 'a. for example this is legal: let f : 'a -> 'b = fun a b -> a + b - but 'a and 'b just become ints
<flux> for that you need module signatures or the ocaml 3.12 (not released yet)
ttamttam has joined #ocaml
<sfuentes> aww. good to know
Submarine has quit [Ping timeout: 240 seconds]
f[x] has joined #ocaml
Associat0r has joined #ocaml
npouillard has quit [Quit: leaving]
npouillard has joined #ocaml
npouillard has quit [Client Quit]
npouillard has joined #ocaml
Yoric has quit [Quit: Yoric]
jcaose has quit [Ping timeout: 256 seconds]
tmaeda has quit [Ping timeout: 265 seconds]
jcaose has joined #ocaml
ygrek has quit [Ping timeout: 245 seconds]
ztfw has quit [Remote host closed the connection]
ikaros has quit [Quit: Leave the magic to Houdini]
tmaeda has joined #ocaml
Yoric has joined #ocaml
_zack has joined #ocaml
tmaeda is now known as tmaedaZ
enthymene has quit [Quit: router hop!]
tmaedaZ is now known as tmaeda
Submarine_ has joined #ocaml
Submarine_ has quit [Client Quit]
enthymene has joined #ocaml
pimmhogeling has joined #ocaml
<Camarade_Tux> hmmmm, BER MetaOcaml sounds nice :-)
<mrvn> hmm, breakfast
<Camarade_Tux> sounds nice too ;-)
<mrvn> Fridge.get food -> Not_found
<Camarade_Tux> doesn't sound as nice suddenly =/
<mrvn> Luckily I got the last of it.
valross has quit [Quit: Ex-Chat]
ygrek has joined #ocaml
hto has quit [Ping timeout: 260 seconds]
avsm has joined #ocaml
hto has joined #ocaml
maskd has joined #ocaml
pimmhogeling has quit [Ping timeout: 245 seconds]
hto has quit [Ping timeout: 264 seconds]
<olegfink> why does a -custom toplevel want pervasives.cmi and how can I make it more self-sufficient?
<flux> hmm, I wonder if you can avoid .cmi-dependencies in general at all?
<flux> so I guess you could use an "exe-packer"
<flux> which does magic and puts any files go along with the executable
<olegfink> I thought ocamlc -custom basically did exactly that
enthymene has quit [Quit: sleep!]
<flux> well, it doesn't?-)
<olegfink> so there is no way in ocaml to statically compile a library without the need for a .cmi?
<Alpounet> you need it for the compilation
<flux> AFAIK this always holds true: if you need to access the interface of a module, you need the interface file (cmi-file) regardless of where the .cmo-file is put
<flux> for example ocamlc -a -o foolib foo.cmo works but if you put foo.cmi there, it says: /usr/bin/ocamlc: don't know what to do with foo.cmi.
<olegfink> erm, so there should always be a .cmi present for any .cmo I ever linked in?
<flux> I think you need the cmi-file for produding a .cmo-file
<flux> but if the module you are using requires another module, you don't need that another module's cmi file
<olegfink> hm, then why do I need pervasives.cmi for toplevel?
<Alpounet> flux, but if you're building the first module, you may need the other's cmi, iirc
<flux> olegfink, maybe due to its runtime compilation capabilities
<flux> when it starts, it needs to know that print_endline is a symbol (or not): it just assumed pervasives is there, as it always is
<flux> just like ocamlc assumes
<flux> olegfink, so you don't want to use pervasives in the toplevel?
<olegfink> I guess I want, but I don't want the toplevel to depend on anything outside its bytecode
<flux> then AFAIK your only possibility is such an executable packer that can take auxiliary files with it
<Camarade_Tux> olegfink: btw, any reason?
<flux> indeed, that sounds quite an arbitrary requirement :)
<Camarade_Tux> for redistribution I guess but that seems a bit too much, and for which platform? windows?
shr3kst3r has quit [Ping timeout: 252 seconds]
<Alpounet> an archive could be sufficient for redistribution
<olegfink> well, I want a limited functionality version
<olegfink> the requirement on not having any external dependencies is not strict, but is somehow appealing to me
shr3kst3r has joined #ocaml
pimmhogeling has joined #ocaml
tmaeda is now known as tmaedaZ
alp has joined #ocaml
Alpounet has quit [Ping timeout: 276 seconds]
alp has quit [Quit: ``Do what you think you can't do.'']
Alpounet has joined #ocaml
hto has joined #ocaml
olegfink has quit [Read error: Operation timed out]
jcaose_ has joined #ocaml
jcaose has quit [Ping timeout: 245 seconds]
olegfink has joined #ocaml
_zack has quit [Quit: Leaving.]
jcaose_ has quit [Read error: Connection reset by peer]
jcaose_ has joined #ocaml
jcaose_ has quit [Read error: Connection reset by peer]
thrasibule has joined #ocaml
_zack has joined #ocaml
thrasibule has quit [Ping timeout: 258 seconds]
tmaedaZ has quit [Ping timeout: 245 seconds]
Gooffy has quit [Read error: Connection reset by peer]
tmaedaZ has joined #ocaml
derdon has joined #ocaml
ztfw has joined #ocaml
threeve has joined #ocaml
_andre has joined #ocaml
tmaedaZ is now known as tmaeda
<_zack> thelema: the top-level with #help has gone in new batteries, right? (just to understand what debian patches I can remove ...)
M| has quit [Read error: Operation timed out]
M| has joined #ocaml
<_zack> oh no, it is still compiler ...
bzzbzz has joined #ocaml
<mrvn> *sigh* decisions, decisions. Do I use a greedy DList or a detached one`
<mrvn> ?
<Camarade_Tux> could toss a coin :-)
<mrvn> A detached DList uses 3 extra values per item.
<mrvn> Maybe I can write a GreedyDList functor to be reusable.
<mrvn> Next decision: Use option type in DList and terminate the ends with None, link the ends to themself or terminate with Obj.magic 0?
pimmhogeling has quit [Ping timeout: 245 seconds]
MrHeavy has joined #ocaml
<MrHeavy> Quick question: how do I list files in a directory in OCaml?
<thelema> Sys.readdir
<MrHeavy> Thanks a bunch
<thelema> np
boscop has joined #ocaml
ulfdoz_ has joined #ocaml
ulfdoz has quit [Ping timeout: 240 seconds]
pimmhogeling has joined #ocaml
joewilliams_away is now known as joewilliams
bzzbzz has quit [Quit: Lost terminal]
pimmhogeling has quit [Ping timeout: 245 seconds]
_unK has joined #ocaml
Drk-Sd has joined #ocaml
<mrvn> Args, now I've added the DList to the wrong structure. I need the parent of that.
_andre has quit [Quit: Lost terminal]
_andre has joined #ocaml
_zack has quit [Quit: Leaving.]
hcarty has joined #ocaml
pimmhogeling has joined #ocaml
joewilliams is now known as joewilliams_away
pimmhogeling has quit [Ping timeout: 265 seconds]
f[x] has quit [Ping timeout: 240 seconds]
_andre has quit [Quit: leaving]
joewilliams_away is now known as joewilliams
Associat0r has quit [Ping timeout: 245 seconds]
avsm has quit [Ping timeout: 252 seconds]
ttamttam has quit [Quit: Leaving.]
Associat0r has joined #ocaml
ztfw has quit [Remote host closed the connection]
mutewit has joined #ocaml
yakischloba has quit [Quit: Leaving.]
matthieu has quit [Ping timeout: 248 seconds]
pimmhogeling has joined #ocaml
yziquel has joined #ocaml
<yziquel> I tried "let module M = Map.Make (struct type t = string let compare = compare end) in M.empty;;" in the toplevel. I got "Error: This `let module' expression has type 'a M.t\nIn this type, the locally bound module name M escapes its scope". What does this mean here? looks like the common class ['a] klass problem, but how do you get around it?
<flux> what are you trying to achieve?
yakischloba has joined #ocaml
<yziquel> flux: declare the module locally in a function that i want to memoize.
<flux> use Hashtbl or a defunctorized version of Map. or wait 3.12 which has those kind of features.
<thelema> If there's any way for your string map values to escape the scope of your "let module", it's no good.
travisbrady has joined #ocaml
<thelema> because outside the scope of the [let module], M isn't defined - there's no type for M.empty.
<flux> oh, right, the type for the module you requires is always the same?
<flux> I somehow inferred your function would be polymorphic which I have no reason to assume
<thelema> flux: that's the common use case for this kind of construct
<flux> well, this doesn't escape the scope of let module yet it's illegal:
<flux> let f = let module M = Map.Make (struct type t = float let compare = compare end) in M.empty in fun a -> a;;
pimmhogeling has quit [Ping timeout: 265 seconds]
<thelema> flux: the M.empty does escape the scope of the [let module], it just doesn't escape the enclosing scope of that.
<flux> oh, right
<flux> must've forgotten what I was writing in the end :)
<MrHeavy> Another dumb question: how do I represent character escapes (e.g. '\0' in C) in OCaml?
<flux> this works: let f = let module M = Map.Make (struct type t = float let compare = compare end) in let cache = ref M.empty in fun x -> if not (M.mem x !cache) then cache := M.add x (x *. x) !cache; M.find x !cache;;
lokydor has joined #ocaml
<flux> mrheavy, "\000"
<MrHeavy> Ahh, thanks
<thelema> flux: yes. This works because no value of type M.t escapes, only floats
<yziquel> thanks
Yoric has quit [Quit: Yoric]
bzzbzz has joined #ocaml
WuJiang` has quit [Remote host closed the connection]
Drk-Sd has quit [Quit: {'EXIT', Drk-Sd, "bye"}]
lokydor has quit [Ping timeout: 245 seconds]
ttamttam has joined #ocaml
fraggle_ has joined #ocaml
tmaeda is now known as tmaedaZ
ttamttam has quit [Quit: Leaving.]
pimmhogeling has joined #ocaml
ccasin has joined #ocaml
<mrvn> module type T = sig end module F = functor (T : T) -> struct include T end module T = struct let foo () = print_string "foo\n" end module M = F(T) let _ = M.foo ();;
<mrvn> Error: Unbound value M.foo
<mrvn> Why doesn't the include work? Is there a way to make it work?
<thelema> because module T is cast down to having type T, which has no member foo.
<thelema> change [module type T = sig foo : unit -> unit end]
* Alpounet wishes mlbot was still there
<mrvn> thelema: but then every incantation would have to have foo
<thelema> true.
<mrvn> Can't I not cast the module down?
<mrvn> functor (T :> T) ... or something?
<thelema> Not that I know of.
<thelema> you'll have to not use a functor to get at T
<thelema> from with F
<thelema> *within
<mrvn> module M = struct module M = F(T) include M include T end
<mrvn> or that. In my case that works.
<thelema> yup, that gets T within M.
<mrvn> Error: Multiple definition of the type name t. Names must be unique in a given structure or signature.
<thelema> yes, T can't define any types
<thelema> or modules
<mrvn> ahh, forgor to rmove the include in the functor
<mrvn> forgot
sgnb has quit [Read error: Connection reset by peer]
sgnb has joined #ocaml
bzzbzz has quit [Quit: leaving]
Alpounet has quit [Ping timeout: 265 seconds]
Submarine has joined #ocaml
Submarine_ has joined #ocaml
Alpounet has joined #ocaml
yziquel has quit [Ping timeout: 252 seconds]
Submarine_ has quit [Quit: Leaving]
Submarine has quit [Quit: Leaving]
matthieu has joined #ocaml
pad has joined #ocaml
sepp2k has joined #ocaml
fraggle_ has quit [Ping timeout: 276 seconds]
yakischloba has quit [Quit: Leaving.]
solistic has joined #ocaml
joewilliams is now known as joewilliams_away
fraggle_ has joined #ocaml
enthymene has joined #ocaml
<Camarade_Tux> rrrrhhhhhhaaaaaaaaaaa, on windows, my native program can't lstat() a file with its full and absolute path but I can do it in the toplevel ><
_zack has joined #ocaml
cmeme has joined #ocaml
solistic has quit [Read error: Operation timed out]
solistic has joined #ocaml
demitar has quit [Ping timeout: 245 seconds]
ccasin has quit [Quit: Leaving]
slash_ has joined #ocaml
demitar has joined #ocaml
ygrek has quit [Ping timeout: 245 seconds]
seanmcl has joined #ocaml
sepp2k1 has joined #ocaml
sepp2k has quit [Ping timeout: 252 seconds]
yakischloba has joined #ocaml
joewilliams_away is now known as joewilliams
<Camarade_Tux> found my bug: a string had a \r in it, it wouldn't be displayed of course but I couldn't stat("somefile\r")! doh
<Camarade_Tux> I'm about to cry
<thelema> blah!
<olegfink> Camarade_Tux: so much for using an indecent terminal/editor. :-P
<Camarade_Tux> olegfink: I'm trying to support windows: doing that in cmd.exe ='(
ulfdoz_ has quit [Ping timeout: 245 seconds]
<Camarade_Tux> hopefully it should be that last bug I encounter but I've been completely burnt out by the portability issue (windows/others, gnu tar/bsdtar, ...)
Drk-Sd has joined #ocaml
brendan has quit [Ping timeout: 256 seconds]
brendan has joined #ocaml
pimmhogeling has quit [Ping timeout: 256 seconds]
enthymene has quit [Quit: wirk!]
solistic has left #ocaml []
pimmhogeling has joined #ocaml
Alpounet has quit [Ping timeout: 240 seconds]
Alpounet has joined #ocaml
enthymene has joined #ocaml
seanmcl has quit [Quit: seanmcl]
seanmcl has joined #ocaml
threeve has quit [Quit: threeve]
seanmcl has quit [Client Quit]
avsm has joined #ocaml
pimmhogeling has quit [Ping timeout: 248 seconds]
_zack has quit [Quit: Leaving.]
sepp2k1 has quit [Quit: Leaving.]
pimmhogeling has joined #ocaml
Amorphous has quit [Ping timeout: 245 seconds]
avsm has quit [Quit: Leaving.]
avsm has joined #ocaml
derdon has quit [Quit: derdon]
Amorphous has joined #ocaml
jao has joined #ocaml
boscop has quit [Quit: Gxis revido!]
pimmhogeling has quit [Ping timeout: 265 seconds]