<flux>
apparently GHC had implicit values as well, but people abhor them
<flux>
but perhaps they can be useful if only as a tool to perform some encoding
ftrvxmtrx has joined #ocaml
<jsk>
ski: by implicit value, I mean a function parameter that is implicitly bound to an identically-typed value defined within the same scope.
<jsk>
Instead of callers passing an explicit value to the function, the compiler finds an identically-typed value in the scope of the caller.
<jsk>
The compiler enforces the restriction that there must be exactly one such parameter.
<jsk>
First-class modules provide a nice way to pass a dictionary of "how to perform functions {f,g,h,...} for some type t" into a function.
<jsk>
If those could be passed implicitly, then there may be a nice way to encode type classes.
<ski>
hm, ok
<ski>
so there is a matching based on the type, then ?
<ski>
flux : GHC's implicit parameters are named, though
<jsk>
ski: yes, that's the idea
<jsk>
ski: there should be just one type-compatible value in scope
rixed has joined #ocaml
<jsk>
that value could be passed explicitly, if you wanted to override the one in scope.
<ski>
hm, interesting take
<ski>
yeah
<jsk>
I'm a bit rusty with Haskell, but I think that type class membership extends to the compilation unit
<ski>
yeah, instances are automatically exported (always)
<jsk>
with implicit values, things are a little more flexible, since you can choose which type class membership mapping to bring into scope
<ski>
(iiuc, one can hide type class instances in Mercury .. but i don't know enough about how that works, and whether they still can ensure instance unicity / coherence)
magthe has joined #ocaml
Yoric has joined #ocaml
avsm has quit [Quit: Leaving.]
ski has quit [Read error: Connection reset by peer]
ski has joined #ocaml
jonathandav has joined #ocaml
Yoric has quit [Read error: Connection reset by peer]
Yoric has joined #ocaml
Snark has joined #ocaml
ikaros has joined #ocaml
hcube has joined #ocaml
avsm has joined #ocaml
<hcube>
hi
<gildor>
hi
<hcube>
is there a good marshal library for ocaml what supoorts cross language data exchange
<gildor>
hcube: there are several
<hcube>
cool
<gildor>
hcube: pick your format: json or s-expression?
<hcube>
i prefer binary formats
<hcube>
because i'd like to exchange 3d model data and textures
<hcube>
i've found msgpack, but it is not supported by ocaml: http://msgpack.org/
<rwmjones>
or xdr
<rwmjones>
ocamlnet has xdr/rpcgen
<flux>
piqi uses google protocol buffers
<avsm>
piqi is decent too
<hcube>
just checking piqi :)
<flux>
apparently msgpack says it's faster than buffers, though :)
<flux>
msgpack has quite many languages supported though, perhaps implementing ocaml support wouldn't be a big task
<flux>
changes are it works, then. but the comments are in japan..
<hcube>
protocol buffer seems ok for me. haskell, ocaml, python are supported. thats what I need :)
Amorphous has quit [Ping timeout: 272 seconds]
<palomer>
hcube, binprot
<palomer>
makefiles are so nice
* palomer
wonders why he ever bothered using OMake
<flux>
:)
<adrien>
omake is nice too
<adrien>
makefiles are so full of kludges ;-)
Amorphous has joined #ocaml
sdj has joined #ocaml
rixed has quit [Ping timeout: 276 seconds]
robthebob has joined #ocaml
Yoric has quit [Read error: Connection reset by peer]
Yoric has joined #ocaml
<palomer>
I've seen some pretty bad omake kludges in my time
<palomer>
:P
<palomer>
hey Yoric
Yoric has quit [Read error: Connection reset by peer]
Yoric has joined #ocaml
gnuvince has quit [Ping timeout: 260 seconds]
kaustuv has joined #ocaml
hcube has quit [Ping timeout: 272 seconds]
<kaustuv>
To any ocaml DDs around: will 3.12 make it to unstable as soon as Debian 6.0 is released, or will you wait until stuff like jocaml to work first?
<kaustuv>
(modulo grammar)
mnabil_work has quit [Read error: Connection reset by peer]
hcube has joined #ocaml
rixed has joined #ocaml
hcube has quit [Ping timeout: 240 seconds]
hcube has joined #ocaml
joewilliams_away is now known as joewilliams
gnuvince has joined #ocaml
rgrig has joined #ocaml
gnuvince_ has quit [Ping timeout: 250 seconds]
hcube has quit [Ping timeout: 240 seconds]
yezariaely has joined #ocaml
hcube has joined #ocaml
yezariaely has left #ocaml []
magthe has quit [Quit: Going away]
joewilliams is now known as joewilliams_away
joewilliams_away is now known as joewilliams
fons has joined #ocaml
<fons>
Hi
<fons>
quick question
<fons>
imagine I want to redefine arithmetic operators in a module
<fons>
+,-,/ ...
<fons>
let's say that modules is called Module
<fons>
I can refer to those operators as Module.(-), Module.(+) ....
<fons>
the question is, is there a way to refer to those operators without the ability of using infix syntax with them?
<fons>
a Module.- b seems to be illegal
<thelema_>
fons: you have to either [open Module] or let (-) = Module.(-)
thelema_ is now known as thelema
<palomer>
yeah, I don't think we have a haskell equivalent to ``
<fons>
thelema_: but if I do "open Module" then there is no way to distinguish between Pervasives.(-) and Module.(-)
<fons>
right?
<palomer>
you can do a local open in 3.12
<fons>
not an option
<fons>
well, thanks guys
<palomer>
welcome
<fons>
I think Module.- works in Haskell, that's why I miss it
hcube has quit [Quit: leaving]
<palomer>
Haskell has modules? :P
<thelema>
Module.(-) a b
<thelema>
if you do open Module, both Pervasives.(-) and Module.(-) are still available
<palomer>
yeah, you can have fun switching between the two
<thelema>
but just plain a - b becomes Module.(-)
<palomer>
let (-) = M.(-) .... let (-) = Pervasives.(-) ...
<thelema>
[open Module ... open Pervasives ... open Module ...]
<hcarty>
Module.(-) doesn't seem that much worse than Module.-
gnuvince_ has joined #ocaml
<palomer>
even better!
sdj has quit [Ping timeout: 255 seconds]
<palomer>
hcarty, he wants infix
<hcarty>
palomer: Ah, it looked like he wanted to avoid infix - "is there a way to refer to those operators without the ability of using infix syntax with them?"
<hcarty>
And I missed the line after that :-)
<hcarty>
If 3.12 isn't an option, pa-do may be
<palomer>
what's pa_do?
<hcarty>
Delimited Overloading
<hcarty>
local open++ perhaps?
<palomer>
i think he meant that local open wasn't an option
<hcarty>
It's a syntax extension + a set of modules for OCaml
<palomer>
ahh yes, isn't that already in 3.12?
<hcarty>
Only some of it
<hcarty>
The local open part, specifically
<hcarty>
pa-do does a lot more, but the "a lot more" is perhaps not as generally useful as the local open portion
<palomer>
you can do Pervasives.(2+2)
<palomer>
what's the syntax for a local open?
<hcarty>
Module.(...) or let open Module in ...
<palomer>
ah, righto
<palomer>
I like the second syntax better
<hcarty>
palomer: The utility depends on what you are trying to do
<hcarty>
Module.( ... ) is nice because it limits the scope
Modius has joined #ocaml
<palomer>
don't they both limit the scope? (isn't that the point:P)
<hcarty>
palomer: M.(...) limits the scope more?
<hcarty>
let open Module in a;b;c vs Module.(a);b;c
<hcarty>
Or even a + Module.(b + c) + d
<palomer>
versus a + (let open Module in b + c) + d
Tianon has quit [Ping timeout: 240 seconds]
<palomer>
I guess it's better in arithmetic operations
<palomer>
(something I don't do)
<hcarty>
palomer: It could help with record fields as well
<hcarty>
Module.(f a.x a.y)
<hcarty>
vs f a.Module.x a.Module.y
init1 has joined #ocaml
<kaustuv>
I've come to see the Module.() form as dangerous, because the meaning of Module.(f x y) can change based on how Module evolves and the compiler won't generally complain if the types match up
<hcarty>
kaustuv: I haven't thought of the dangers of the two relative to each other. How is/Is let open Module in less dangerous?
<kaustuv>
let open Module in is slightly (but only slightly) less dangerous because if the definition of f comes after it then (f x y) will still have the right meaning.
<kaustuv>
In other words, the further out you push the Module.(), the safer it gets, until you push it all the way out and it become a module level open, which is generally pretty safe
<thelema>
kaustuv: it's safe why? because the possibility of the module accidentally masking a value defined in your module becomes greater with Module.()?
<thelema>
s/in your module/locally/
<kaustuv>
I'll tell you the bug that hit me recently. I was doing M.(...) where the ... involved raising an exception. Unfortunately, I was catching the exception defined in the calling module, not the one in M. The runtime error was very perplexing because it said uncaught exception Foo at the point where I had a try .. with Foo _ ->
<kaustuv>
But in this particular case let open might have had the same effect, so blah
<thelema>
i.e. [open List let fold_left = ... in fold_left f y z] is better than [let fold_left = ... in List.(fold_left f y z)]
<thelema>
?
<thelema>
bad example because List.fold_left f y z is safest
fons has quit [Remote host closed the connection]
<thelema>
identically named exceptions + open = trouble
<kaustuv>
identically named *anything* + open = trouble
<kaustuv>
fortunately, the trouble is usually a type error
<thelema>
little trouble for most things. bigger trouble for exceptions
ftrvxmtrx has quit [Quit: Leaving]
schmrkc has left #ocaml []
boscop_ has joined #ocaml
boscop has quit [Ping timeout: 240 seconds]
init1 has quit [Read error: Connection reset by peer]
init1 has joined #ocaml
boscop__ has joined #ocaml
boscop_ has quit [Ping timeout: 240 seconds]
ttamttam has left #ocaml []
Smerdyakov has joined #ocaml
boscop__ is now known as boscop
Indian-2010 has joined #ocaml
boscop_ has joined #ocaml
boscop has quit [Ping timeout: 264 seconds]
Tianon has joined #ocaml
Tianon has quit [Changing host]
Tianon has joined #ocaml
boscop__ has joined #ocaml
boscop_ has quit [Ping timeout: 240 seconds]
ftrvxmtrx has joined #ocaml
Indian-2010 has left #ocaml []
ulfdoz has joined #ocaml
oriba has joined #ocaml
oriba has quit [Read error: Connection reset by peer]
Yoric has quit [Quit: Yoric]
Smerdyakov has quit [Quit: Leaving]
boscop__ is now known as boscop
<hcarty>
Is it possible to do this in OCaml? "match baz with | foo when some_test | bar when some_test2 -> ..."
<hcarty>
It looks like you can't
<krktz>
yes you can
<julm>
obama inside
dictionnaire has quit [K-Lined]
gnuvince_ has quit [Read error: Operation timed out]
<hcarty>
krktz: Drat, you're right. I just tried a simplified version and it works.
<hcarty>
krktz: Thank you!
gnuvince has quit [Ping timeout: 255 seconds]
<hcarty>
Nevermind, the simplified case was wrong
<hcarty>
It appears you can't - "match (1, 2) with | 1, b when b < 3 | 1, b when b > 5 -> true | _ -> false"
<hcarty>
That gives a syntax error
<flux>
hcarty, the when-statements are share between multiple patterns
<flux>
hcarty, so you can do this instead: match baz with a, 0 | 0, a when a > 42 -> ..
<hcarty>
flux: In this case, I think I need to move all checks in to the when portion
<hcarty>
flux: A more reasonable example of what I'm trying to do is: match baz with | 1, a when a < 0 | 2, b when b > 0 -> true | _ -> false"
<avsm2>
just wrap the tuples in brackets and it should work
<avsm2>
with | (1,a) when a ...
<hcarty>
avsm2: I tried, and it still gives a syntax error
<flux>
no, I don't think that's it
<flux>
it's just that a pattern doesn't have 'when', but match expression does
<hcarty>
With camlp4 in place (no extensions), the error is more explicit. You need a -> after a when
<hcarty>
That's too bad. It would make this (small) piece of code more readable.
gnuvince_ has joined #ocaml
ulfdoz has quit [Ping timeout: 265 seconds]
ulfdoz has joined #ocaml
Smerdyakov has joined #ocaml
<Smerdyakov>
Does anyone know the adoption status of OPA from MLstate? Is there a user community?
<palomer>
hey smerdy, long time no see
<Smerdyakov>
Could be, could be.
<flux>
smerdyakov, I haven't heard of it since the first announcement..
<Smerdyakov>
They're apparently hiring. I don't know if that's because they're bringing in money.
<flux>
smerdyakov, now that I took a quick peek, I don't think very many people would get excited with a system where you need to specifically ask for manual or api documentation
<flux>
but perhaps they have sales people that know how to do their work?-)
<Smerdyakov>
They have some execution problems on their web site. The product could still be compelling to some people. *shrug*
<flux>
but, the site is relatively pretty
<flux>
atleast something ;)
<Smerdyakov>
I have to admit that their corporate-y (vs. open-source-y) approach seems unlikely to succeed.
<flux>
how are things looking up with ur/web?
<palomer>
yoric is on the channel! he'd probably take offence to that
<Smerdyakov>
He/s here? What's his nick?
<adrien>
gues...
<adrien>
s*
<Smerdyakov>
flux, pretty well. It seems I have two people pretty much ready to pay for support and/or library coding.
<palomer>
oh, he's logged off
<palomer>
you may continue...
<palomer>
this row type meta programming stuff...
<palomer>
is it similar to the people making database centric programming languages?
<Smerdyakov>
Is it similar to the people, or is it similar to their languages? :)
<palomer>
my bad
<Smerdyakov>
BRB
<palomer>
languages
<palomer>
OK
<rwmjones>
after sinking to depths earlier this week, suddenly caml-list is really interesting again
<Smerdyakov>
I'm not aware of any languages beyond Ur, Coq, Agda, and some very early research prototypes that can do type-level functional programming with records.
<Smerdyakov>
Ur does this with native support, including convenient type inference. In the others, you can encode it, but it's no fun.