kakadu has quit [Remote host closed the connection]
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
DubiousCarrot has quit [Read error: Connection reset by peer]
pierpa` has joined #ocaml
seangrov` has quit [Ping timeout: 256 seconds]
madroach has quit [Read error: Connection reset by peer]
behzad-nouri has joined #ocaml
pierpa has quit [Ping timeout: 240 seconds]
foolishmonkey has quit [Ping timeout: 240 seconds]
behzad-nouri has quit [Client Quit]
foolishmonkey has joined #ocaml
ygrek has quit [Ping timeout: 252 seconds]
aantron has joined #ocaml
ygrek has joined #ocaml
darkf has quit [Quit: Leaving]
lokien_ has quit [Quit: Connection closed for inactivity]
seangrov` has joined #ocaml
shinnya has quit [Ping timeout: 240 seconds]
seangrov` has quit [Ping timeout: 256 seconds]
pierpa` has quit [Ping timeout: 240 seconds]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 240 seconds]
foolishmonkey has quit [Quit: Leaving]
Algebr` has joined #ocaml
SomeDamnBody has joined #ocaml
<SomeDamnBody>
what's the complexity of Seq.append?
seangrov` has joined #ocaml
govg has joined #ocaml
seangrov` has quit [Ping timeout: 256 seconds]
<Drup>
O(1)
<Drup>
(it's lazy append, it doesn't really do anything ..)
seangrov` has joined #ocaml
SomeDamnBody has quit [Ping timeout: 245 seconds]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 264 seconds]
Sorella has quit [Quit: Connection closed for inactivity]
sh0t has quit [Ping timeout: 240 seconds]
SomeDamnBody has joined #ocaml
<seangrov`>
Is there a notation for updating records conveniently but immutably?
<aantron>
{foo with bar = new_value}
<seangrov`>
aantron: Where foo is the previous record?
<aantron>
yes, and bar is one of its fields
<aantron>
you can update multiple fields: {foo with bar = new_value; bar' = new_value'}
<aantron>
if you have a value in scope with the same name as a field, e.g. "bar", you can just do {foo with bar}
<seangrov`>
Nice!
<aantron>
if you are interested in the last bit, it is called record field punning. it can be used when constructing records the "direct" way as well, and during pattern matching
<aantron>
in particular, references are records, so if you don't mind ending up with a variable called "contents", you can do things like "fun {contents} -> contents + 1"
<aantron>
thats just an example, not claiming its a good idea :)
teknozulu has joined #ocaml
struk|desk|away is now known as struk|desk
<seangrov`>
Oh, that's nice actually
sh0t has joined #ocaml
sh0t has quit [Ping timeout: 240 seconds]
yegods has joined #ocaml
<seangrov`>
Goodness, jsoo 3.0 looks pretty nice. Love the documentation tags.
madroach has joined #ocaml
MercurialAlchemi has joined #ocaml
FreeBirdLjj has joined #ocaml
psy_ has quit [Ping timeout: 245 seconds]
copy` has quit [Quit: Connection closed for inactivity]
seangrov` has quit [Read error: Connection reset by peer]
FreeBirdLjj has quit [Ping timeout: 256 seconds]
yawnt has joined #ocaml
struk|desk is now known as struk|desk|away
yawnt has quit [Ping timeout: 240 seconds]
MercurialAlchemi has quit [Ping timeout: 264 seconds]
DubiousCarrot has joined #ocaml
FreeBirdLjj has joined #ocaml
MercurialAlchemi has joined #ocaml
yegods has quit [Remote host closed the connection]
struk|desk|away is now known as struk|desk
DubiousCarrot has quit [Read error: Connection reset by peer]
jacquev6 has joined #ocaml
govg has quit [Remote host closed the connection]
govg has joined #ocaml
kansi has joined #ocaml
Algebr` has quit [Ping timeout: 260 seconds]
kushal has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 256 seconds]
Haudegen has quit [Ping timeout: 272 seconds]
govg has quit [Ping timeout: 245 seconds]
Anarchos has joined #ocaml
teknozulu has quit [Ping timeout: 256 seconds]
Haudegen has joined #ocaml
DubiousCarrot has joined #ocaml
Simn has joined #ocaml
demus has joined #ocaml
DubiousCarrot has quit [Read error: Connection reset by peer]
SomeDamnBody has quit [Quit: Leaving]
badon_ has joined #ocaml
badon has quit [Disconnected by services]
nkhodyunya has joined #ocaml
badon_ is now known as badon
foolishmonkey has joined #ocaml
ygrek has quit [Ping timeout: 276 seconds]
struk|desk is now known as struk|desk|away
kansi has quit [Ping timeout: 250 seconds]
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
SIGILL has joined #ocaml
SIGILL has left #ocaml [#ocaml]
silver has joined #ocaml
nkhodyunya has quit [Quit: Leaving.]
demonimin has joined #ocaml
malc_ has joined #ocaml
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 256 seconds]
abbiya has joined #ocaml
rand__ has joined #ocaml
malc_ has quit [Quit: leaving]
jwatzman|work has joined #ocaml
nkhodyunya has joined #ocaml
FreeBirdLjj has joined #ocaml
psy_ has joined #ocaml
dsheets has joined #ocaml
kakadu has joined #ocaml
<reynir>
Hrm, ocamlfind isn't installing the .o file
<adrien>
what for?
<reynir>
Yes, that's a good question. I made a small library and installed it with ocamlfind and now I get this when trying to compile to native: gcc: error: /home/rbj/.opam/4.02.3/lib/graphite/graphite.o: No such file or directory
<reynir>
I never really got the hang of ocamlfind packages :/
<def`>
are you passing the .o file on the commandline when installing?
<adrien>
and are you building a single .ml file as .cmo/cmx ?
<reynir>
Wait, I'm installing .cmx, it should be .cmxa, right?
<reynir>
def`: I am not
<reynir>
adrien: Yes
<def`>
you should, cmx/cmxa don't contain object code, only .o contains it
<adrien>
reynir: building as cma/cmxa is only very slightly longer but it's much better supported by the ecosystem
psy_ has quit [Ping timeout: 256 seconds]
sz0 has joined #ocaml
sz0 has quit [Client Quit]
<reynir>
OK. It's just a single short file so the build time is 'instant'. Thanks, I got it working :-)
<reynir>
It would be nice with some page that explains all this, I think
sz0 has joined #ocaml
<def`>
yes :)
larhat2 has quit [Quit: Leaving.]
dsheets has quit [Remote host closed the connection]
orbifx has joined #ocaml
larhat has joined #ocaml
elfring has joined #ocaml
rand__ has quit [Ping timeout: 276 seconds]
darkf has joined #ocaml
nicholasf has joined #ocaml
<kakadu>
So, about implicits
<kakadu>
if I want to pass empty list into `val fooooo: {S: SHOW} -> 'a list -> unit`
nicholasf has quit [Remote host closed the connection]
<kakadu>
the compiler can't decide what should be used with free type variable
<kakadu>
and I need to annotate type for expression '[]'
<kakadu>
Any solutions which I'm not aware of?
kansi has joined #ocaml
dsheets has joined #ocaml
malc_ has joined #ocaml
<rks`>
Kakadu: no.
ousado has joined #ocaml
Sorella has joined #ocaml
malc_ has quit [Quit: leaving]
<def`>
S.t list
<def`>
implicits need annotations
copy` has joined #ocaml
<kakadu>
def`: is it theoretically possible to patch compiler to let it work without annotation (to have a special case when suitable type was not found and we should use implelemntation where type variable is free ) ?
rand__ has joined #ocaml
<def`>
Kakadu: it's always possible to add a hack, but that goes against the design of being predictible
<flux>
hmm.. so how does it work if you want to call foooooo with a polymorphic list argument? if the function calling it itself is polymorphic re. list type?
<def`>
But I am not sure I understand your problem
<kakadu>
def`: there is no any problem. I'm just curious
<def`>
flux: unless you use special encoding, you only have first rank polymorphism in OCaml anyway
<def`>
Kakadu: ok :). I think these cases should be handled properly, but annotations will always be required when ambiguities are possible
ggole has joined #ocaml
nicholasf has joined #ocaml
<orbifx>
what is the most established serialising library in Ocaml?
<flux>
the Marshal module that comes with ocaml :-)
<flux>
but it's not version safe, or safe against attacks, so I don't suggest using that
nicholasf has quit [Ping timeout: 264 seconds]
<orbifx>
I would expect that from marshalling code
<orbifx>
version safety maybe. but for forking programs it should work fine
<flux>
for forking marshal is great
<flux>
I've used sexplib to great effect, but I guess it doesn't yet have a ppx version
<Drup>
it does now
<flux>
and of course there are these json-based libs
<def`>
Kakadu: thinking twice, a hack is not even needed: the relaxed value restriction check should give correct result.... I am not sure this is desirable though
dsheets has quit [Remote host closed the connection]
<ggole>
Hmm, is there a good way to choose a name for a predicate that returns a conservative approximation of a property, eg, it it returns true the property is guaranteed but it it returns false the property might still hold?
<ggole>
Or should I return [`Yep | `Dunno | `Nope] to make it clear at the type level
<Drup>
Well, if you know that you don't know, yes, you should
sepp2k has quit [Quit: Leaving.]
<ggole>
Mmm. And the name? I was thinking of is_conservatively_foo, which is clear but a bit long.
<Drup>
do you also have a is_foo ?
<ggole>
At the moment I use that name for the conservative approximation, which I do not like much at all.
<Drup>
is_maybe_foo ?
<Drup>
it's shorter
<ggole>
Doesn't that suggest that if the return value is true, that the property maybe holds?
<Drup>
well, you just said you were going to use variant
<ggole>
Although I guess I could invert the predicate
<Drup>
ggole: anyway, regardless of how you name it, you will have to document it so ...
dhil has quit [Ping timeout: 276 seconds]
* ggole
coughs politely
<flux>
`Yep_this_property_definitely_holds | `Well_this_might_or_might_not_hold_depends_on_stuff | `Nope_this_aint_gonna_holdf <- see, no documentation required!
<flux>
complete with a typo in a constructor name
<pierpa`>
maybe a bit of documentation would not be so bad, in confront :)
<pierpa`>
*in comparison :)
t4nk322 has quit [Ping timeout: 252 seconds]
merijn has joined #ocaml
<flux>
will modlar implicits finally give a way to the future eradication of polymorphic = and compare? the unsolved case I think still is pattern matching, you can't redefined its equality.
<ggole>
Equality isn't used in pattern matching?
<Drup>
Not really
<flux>
well, it's sort of used to compare against user-provided constructors
<flux>
but I guess we can make-do without
kakadu has quit [Ping timeout: 252 seconds]
<flux>
but what I'm going for are view patterns or similar constructs ;-)
<ggole>
User provided constructors?
<flux>
sort of like meaningful way to pattern match functional queuers or buffers.
<flux>
queues even
<ggole>
Oh, I see. There's nothing like that in OCaml, though, so such features provide no barrier to removing = and compare.
<ggole>
Compatibility does though.
<flux>
just use the three-step program: 1) deprecate 2) disable by default 3) remove, maybe, but keep still for compatibility sake :-)
<ggole>
IMHO breaking user programs should be done with extreme caution or not at all.
<ggole>
(I would really like abstraction over patterns though. I don't think that poses any compatibility issues, except possibly choice of keywords.)
merijn has left #ocaml [#ocaml]
<flux>
well, so how do you feel about the strings going immutable then?
<ggole>
It may have been done cautiously enough
<flux>
but I do like that I'm able to pick some old piece of software and it will just comple. mostly except for camlp4...
<flux>
or except for some misguided -warn-error a :P
<ggole>
We really don't want some rubbish like the Python 3 changes making OCaml a less attractive language
<flux>
:)
<flux>
I think at least ocaml is technically positioned to have a 100% working robust language converter
<flux>
so the situation would be far from python..
<ggole>
Better to not need such things, if possible.
<Drup>
The camlp4/ppx situation is similar, though
sz0 has quit [Quit: My computer has gone to sleep. ZZZzzz…]
<ggole>
Mmm, it will be interesting to see what the long term consequences of resulting breakage are.
<Drup>
except we still keep binary compat between stuff done with camlp4 and the rest :p
<ggole>
Yeah, that helps
<Drup>
(and we do have a converter)
durm has joined #ocaml
<ggole>
And people's perspective seems to be more or less "good riddance"
kushal has quit [Quit: Leaving]
<Drup>
indeed
<ggole>
I suppose the takeaway is that backwards compatible change is risky rather than a matter of certain doom
dsheets has joined #ocaml
<ggole>
And if you manage the risk sensibly you (probably) won't die screaming
kakadu has joined #ocaml
dhil has joined #ocaml
<orbifx>
Any guides on "good" OCaml program structuring? In particular for long-lived programs. Where and how to have the main loop, how to delegate work etc?
dsheets has quit [Ping timeout: 240 seconds]
DubiousCarrot has joined #ocaml
kushal has joined #ocaml
abbiya has quit [Quit: Leaving]
M-Illandan has joined #ocaml
sz0 has joined #ocaml
zaquest has quit [Quit: Leaving]
zaquest has joined #ocaml
octachron has joined #ocaml
<orbifx>
No suggestions?
<orbifx>
How about well written programs?
<flux>
dunno, pretty much the same as with other languages I think :)
<flux>
I maybe have program.ml with let main () = .. let _ = main () so on.
<flux>
personally I would try to avoid many side-effectful top-level expressions, they can be annoying to debug
Anarchos has joined #ocaml
dsheets has joined #ocaml
<orbifx>
ok
<orbifx>
I was looking at MLDonkey to see how it goes about this.
<orbifx>
I will probably be "hinging" my main loops around `select` for this project
<Drup>
don't look at mldonkey for code quality ...
<flux>
orbifx, if you want a nice little exercise in ocaml refactoring, try to extract its torrent code into its own library
<flux>
me and someone else on this channel have tried.. and failed :-)
<orbifx>
Drup: it's old. Anything better?
<orbifx>
flux: haha, if I had the time and interest...
<flux>
unison is one real-world-app, but I don't know if it's any better
<Drup>
orbifx: if I was in a trolling mood, I would say anything is better >_>
<orbifx>
I didn't know if unison does any long term running. I suppose it's got a UI.
<flux>
oh, well it doesn't do that kind of long-term-running
<flux>
I suppose you're looking at servers then
octachron has quit [Ping timeout: 250 seconds]
<orbifx>
flux: almost
<orbifx>
it's practically a daemon.. an application for a computer
<orbifx>
I mean, that application will run on the computer for as long as the computer runs
<orbifx>
but I don't think it will have any remote sockets to begin with.
FreeBirdLjj has quit [Remote host closed the connection]
sz0 has quit [Quit: My computer has gone to sleep. ZZZzzz…]
sepp2k has quit [Quit: Leaving.]
yegods has quit [Remote host closed the connection]
sz0 has joined #ocaml
ollehar has quit [Quit: ollehar]
seangrove has joined #ocaml
jacquev6 has joined #ocaml
maker has joined #ocaml
seangrove has quit [Ping timeout: 248 seconds]
Xandaros has quit [Ping timeout: 272 seconds]
seangrove has joined #ocaml
sz0 has quit [Quit: My computer has gone to sleep. ZZZzzz…]
lokien_ has joined #ocaml
seangrove has quit [Ping timeout: 276 seconds]
<lokien_>
hey, can I have heterogeneous arrays in ocaml?
<Drup>
Yes, but depending of what you want exactly, it can be very easy or a bit complicated
<lokien_>
show me "very easy"
<Drup>
type t = ThingA of a | ThingB of b
<Drup>
type my_array_with_thing_a_and_b = t array
<Drup>
:D
<lokien_>
hrm, so just two types?
<lokien_>
forgive me, I'm kind of silly
<Drup>
well, you asked for very easy, what do you want exactly ? absolutely anything ?
<lokien_>
yeah, if it's possible
<Drup>
and do you except to try to read them back ?
<Drup>
expect*
<lokien_>
not really
<Drup>
ok, that's not too hard then
<Drup>
type any = Any : _ -> t
<Drup>
type any_array = any array
<Drup>
[| Any 3 ; Any "foo" |]
<lokien_>
ohh
<lokien_>
that's cool :D
<Drup>
s/t/any/
m-x-v has quit [Ping timeout: 276 seconds]
<lokien_>
by the way, I want to learn category theory. is ocaml good for that?
<Drup>
but you can't open an Any anymore
<lokien_>
I suppose
<Drup>
Category theory is math, is a little to do with programming, regardless of the language *shrug*
<Drup>
it has little*
<lokien_>
but then I'll sit down and think "ew, I want to do all these wild things to my language"
yegods has joined #ocaml
<Drup>
You .. don't need category theory at all
yegods has quit [Read error: Connection reset by peer]
yegods has joined #ocaml
<lokien_>
no? so I'll do these things straight away!
<Drup>
(Type theory helps a bit, on the other hand)
<lokien_>
(I'll dig that)
<lokien_>
but.. functors are in category theory :(
<Drup>
Not the same functors
<Drup>
the naming is unfortunate, it has nothing to do with each other
<lokien_>
our functors are in type category?
<lokien_>
type theory*, duh
<kakadu>
Folks, how should I think to be able to write polyvariadic function for tuples? https://paste.in.ua/1316/
<Drup>
take a list as argument ? :D
<kakadu>
No, it's too easy :)
<lokien_>
Drup: er, so I was being annoying. sorry, I'll learn basics on my own :)
<kakadu>
It seems that basis is hidden in zero: fun k -> k []
<kakadu>
Also, I have inductions step and some final function to extract what I need (it seems it is strongly related to the basis)
<Drup>
kakadu: why don't you like your thing then ?
<kakadu>
which thing?
<Drup>
the thing you pasted
<kakadu>
It doesn't work :)
<Drup>
lokien_: Well, it's a bit difficult to tell you anything, I feel you should just learn the language and read things people do with it
seangrove has joined #ocaml
Fleurety has quit [Ping timeout: 250 seconds]
<lokien_>
Drup: I will :D
jacquev6 has quit [Quit: jacquev6]
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
<Drup>
kakadu: value restriction issues ?
<Drup>
yeah, it seems
<Drup>
you can't do much about it
<kakadu>
it should be possible
<Drup>
In you first version, you have a constraint over the type in the continuation (it's a list). In your second version, you don't, that's the issue
<Drup>
You can't express "Only tuples" in OCaml
lobo has quit [Quit: zleep]
<Drup>
(in Haskell, they solve the problem with type families)