<freehck>
Onemorenickname: your definition of (|>) seems to be wrong. (|>) must be 'a -> ('a -> 'b) -> 'b
d0nn1e has joined #ocaml
<Onemorenickname>
this is not what i want then
n4323 has joined #ocaml
shinnya has joined #ocaml
manizzle has joined #ocaml
n4323 has left #ocaml [#ocaml]
n4323 has joined #ocaml
dch_ has joined #ocaml
octachron has joined #ocaml
kakadu_ has quit [Remote host closed the connection]
<_y>
oh indeed
jabroney has quit [Quit: Leaving.]
<_y>
your composition operator is usually called (%)
<_y>
it is found in most “alternative stdlibs”, but still not in stdlib
<companion_cube>
% or %> or some noninfix name
snowcrshd has joined #ocaml
<Onemorenickname>
_y, i love it
freyr has joined #ocaml
maattdd_ has joined #ocaml
maattdd has quit [Ping timeout: 240 seconds]
mali__ has quit [Ping timeout: 264 seconds]
AlexDenisov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
AlexDenisov has joined #ocaml
BitPuffin|osx has joined #ocaml
mali__ has joined #ocaml
yomimono has quit [Ping timeout: 240 seconds]
<reynir>
Is there a way to use ocp-index from utop? To get documentation, I mean. Would be handy :-)
<Drup>
the problem with composition operator in OCaml is that they tend not to work well with polymorphic functions. People will bump into the value restriction head on, and don't really understand why, and in the end they can't really use it
<Drup>
:/
yomimono has joined #ocaml
<cheater>
hi
dhil has joined #ocaml
sh0t has joined #ocaml
<cheater>
Drup: yeah :\
yomimono has quit [Ping timeout: 246 seconds]
ciniglio` has joined #ocaml
ciniglio has quit [Quit: Lost terminal]
maattdd has joined #ocaml
spew has joined #ocaml
maattdd_ has quit [Ping timeout: 268 seconds]
tmtwd has quit [Ping timeout: 258 seconds]
th5 has joined #ocaml
`0x00` has quit [Quit: leaving]
`0x00` has joined #ocaml
dch_ has quit [Remote host closed the connection]
dch_ has joined #ocaml
dch_ has quit [Client Quit]
u0_a61 has joined #ocaml
shinnya has quit [Ping timeout: 240 seconds]
<freehck>
Drup: what's the problem with polymorphic functions and (|>)? I use it all the time and it works find. f.e.: let to_list x = [x];; 1 |> to_list |> to_list;;
<Drup>
freehck: |> is not composition, it's reverse application
<freehck>
aaaah
<freehck>
to_list % to_list;; gives me '_a -> '_a list list
<freehck>
Drup: why '_a, not 'a?
<companion_cube>
Drup: do you often compose polymorphic functions in a polymoprhic context?
<Drup>
companion_cube: I don't often compose functions, period. I use application all the time
<Drup>
freehck: yeah, that was precisely my point in the paragraph above ....
<companion_cube>
heh
<freehck>
Drup: I got, but why does it behave this way?
<Onemorenickname>
so, it's recommanded, but it's not stable ?
<Drup>
I'm surprised this is recommended, this paragraph is probably very very old.
<Onemorenickname>
hm
<Onemorenickname>
so there is no integration with the gc ?
manizzle has quit [Ping timeout: 268 seconds]
<Drup>
No.
<Onemorenickname>
ow
<Onemorenickname>
is there an hashtbl integrated with gc ?
<Drup>
See link above
<Onemorenickname>
i've seen it, but i mean, that is used
<Onemorenickname>
it's an alpha made in one time and not touched since two years
<Onemorenickname>
(i'm surprised you even knew of its existence :D)
<Drup>
externalized memory ftw
<Onemorenickname>
Drup, what do you mean ?
ygrek_ has quit [Ping timeout: 260 seconds]
<Drup>
it's a cyberpunk/scifi concept about having part of your memory stored in digital supports, which you can then access quickly by the mean of cybernetic implants. Or in my case, emacs org files. :D
<Drup>
(it was a joke)
<Onemorenickname>
oh, i knew of this
<Onemorenickname>
but i thought it was maybe some ocaml thing
<Onemorenickname>
like, memory not captured by gc
<Onemorenickname>
:D
<Drup>
You might be able to find in one project or another. Maybe ask on the mailing list, or def`
<Onemorenickname>
i've rewritten a code through large cut-paste-renomming manually
<Onemorenickname>
i was finding some small bugs
<Drup>
octachron, the OCaml documentation archeologist.
<Onemorenickname>
and now, i'm finding some really big mistakes, where i did not rename key-values, and i'm surprised the program gave me so many good values
snowcrshd has joined #ocaml
jao has joined #ocaml
<octachron>
Drup, except that I would *not* complain if OCaml documentation was less stratified in different historical periods
<reynir>
ls
<Drup>
octachron: it is indeed very stratified, I ran that soft that makes visualisation of git history logs
<Drup>
you can clearly see the various blurbs of activity with different groups of people
zpe has quit [Remote host closed the connection]
manizzle has quit [Ping timeout: 264 seconds]
freusque has joined #ocaml
mali__ has joined #ocaml
<def`>
are you talking about my physical hashtable?
johnf_ has quit [Read error: Connection reset by peer]
<def`>
I had some success with it, but more testing is needed if you were to use it.
apache3_ has joined #ocaml
<def`>
also, this relies a lot on GC internals, last time I looked, the "ageing"-aware GC could break some invariants but it was not merged AFAICT, so fixes should be minor
<Onemorenickname>
i won't rely on you fixing it (i'm not your employer), so, i guess i'll hope the gc does not touch my values :(
<Onemorenickname>
oh
<Onemorenickname>
but the gc moves values everytime
<Onemorenickname>
:'(
smondet` has joined #ocaml
inr_ has joined #ocaml
<def`>
:), only two times
<def`>
when doing a minor collection (often but cheap to detect)
<def`>
when doing a major compaction (expensive, but very rare)
mbrock_ has joined #ocaml
mankyKitty_ has joined #ocaml
mehdib_ has joined #ocaml
reynir1 has joined #ocaml
caw__ has joined #ocaml
<Onemorenickname>
i meant, everytime it does a collection
<def`>
the problem is that any allocation can trigger a minor GC. I had an ml implementation but ensuring that no GC ran was tricky, so I fallback to C
ansiwen_ has joined #ocaml
Enjolras has joined #ocaml
<Onemorenickname>
I've just seen that your latest implementation is in .c
<def`>
Onemorenickname: if value allocation and table building happens at distinct time, maybe running a minor collection just before table construction is good enough.
<Onemorenickname>
i don't know how ocaml works
<Onemorenickname>
but, does not any algorithm allocate value ?
Cypi_ has joined #ocaml
eagleflo_ has joined #ocaml
<def`>
If you know OCaml enough, you can avoid most allocations.
dmbaturin_ has joined #ocaml
Ptival_ has joined #ocaml
john5 has joined #ocaml
<Onemorenickname>
hm
<Onemorenickname>
interesting
<def`>
But that's not convenient and error-prone, using C was safer (hohoho).
manizzle has quit [Ping timeout: 256 seconds]
<Onemorenickname>
I see haha
cheater__ has joined #ocaml
<Onemorenickname>
def`, do you know if anyone used your lib ?
emily1 has joined #ocaml
srenatus[m]1 has joined #ocaml
thizanne_ has joined #ocaml
pigoz1 has joined #ocaml
groovy3shoes has joined #ocaml
<def`>
I don't think anyone did. I didn't advertise it because it's hard to provide any guarantee that is portable accross OCaml versions.
tokenrov1 has joined #ocaml
hpd[m]1 has joined #ocaml
<Onemorenickname>
i see
rom15041 has joined #ocaml
blackfry_ghost has joined #ocaml
fedruantine_ has joined #ocaml
hpd[m] has quit [*.net *.split]
srenatus[m] has quit [*.net *.split]
tokenrove has quit [*.net *.split]
rom1504 has quit [*.net *.split]
mehdib has quit [*.net *.split]
thizanne has quit [*.net *.split]
reynir has quit [*.net *.split]
fedruantine has quit [*.net *.split]
ansiwen has quit [*.net *.split]
john5_ has quit [*.net *.split]
groovy2shoes has quit [*.net *.split]
pigoz has quit [*.net *.split]
asm89 has quit [*.net *.split]
lukky513 has quit [*.net *.split]
Cypi has quit [*.net *.split]
Enjolras_ has quit [*.net *.split]
mankyKitty has quit [*.net *.split]
cheater has quit [*.net *.split]
Ptival has quit [*.net *.split]
inr has quit [*.net *.split]
averell has quit [*.net *.split]
apache3 has quit [*.net *.split]
mbrock has quit [*.net *.split]
caw has quit [*.net *.split]
mcspud has quit [*.net *.split]
blackfry has quit [*.net *.split]
eagleflo has quit [*.net *.split]
emilymhorsman has quit [*.net *.split]
dmbaturin has quit [*.net *.split]
smondet has quit [*.net *.split]
<def`>
what kind of project are you considering using it for?
cheater__ is now known as cheater
<Onemorenickname>
building a language :D
lukky513 has joined #ocaml
<def`>
(other people wrote code relying on GC internals, like ocaml-ancient or ocamlnet shm, even lablgtk is quite unsafe. It broke sometime and got fixed later...)
mankyKitty_ is now known as mankyKitty
<Onemorenickname>
I'm wondering when a GC can happen
<def`>
Ah, if it is not for critical systems (like lablgtk), I would suggest you to try with it.
<Onemorenickname>
if i have the guarantee that it does not happen while a certain function is evaluated, i can use physical equality only in this function
<def`>
It cost you nothing immediately. Worst case would be you realize it breaks and have already built an API that you cannot express differently.
ome has quit [Ping timeout: 255 seconds]
asm89 has joined #ocaml
<Onemorenickname>
(i don't like that worst case)
<Onemorenickname>
(i rebuilt it a lot of times)
<def`>
Yes, that's a worst case :). But at the same time it's the cheapest path, any other solution would require you make something more complicated upfront.
manizzle has joined #ocaml
<Onemorenickname>
I don't understand what's the point of physical equality if GC can happen anytime
<def`>
Why not pack every object with a unique id if you want to give your object some identities? Too expensive?
<def`>
GC preserves physical identity.
mbrock_ is now known as mbrock
ome has joined #ocaml
<def`>
if (a == b) before GC, then (a == b) after GC
<def`>
(except for lazy as we already discussed)
<Onemorenickname>
(yep)
<Onemorenickname>
and i can not store address
<def`>
:) physical identity is not the same as accessing address :)
caw__ is now known as caw
<Onemorenickname>
nice
<Onemorenickname>
(expansive, more runtime checks)
<Onemorenickname>
(if i can do it without runtime checks, i want to do it without)
<Onemorenickname>
(and we are not talking about encoding of complicated properties in the type-system)
<Onemorenickname>
well
<Onemorenickname>
well
<Onemorenickname>
how does hashtbl "==" works then ??
<def`>
what do you mean?
<def`>
Normal hashtbl?
<Onemorenickname>
i thought hashtbl with "==" used something like a hash of the physical address
<def`>
hashtbl doesn't know about "==". this can only happen when you instantiate the hashtbl functor using "==" as equality.
<def`>
No.
<Onemorenickname>
and that it did not work through a gc collection as that address change
mali__ has quit [Ping timeout: 260 seconds]
<Onemorenickname>
ha ha ha :D
<def`>
hashtbl "==" use the structure to hash the value.
<def`>
Then "==" is only used to distinguish between keys with same hash.
<Onemorenickname>
ooh
<def`>
(So using "==" on a hashtable give you a linear worst-case, walking the bucket list of all similar objects with different addresses)
<Onemorenickname>
(yep)
mcspud has joined #ocaml
<def`>
If you really want to index by physical equality, you need 1) to be knowledgeable enough of the GC to know what are the disk (e.g. the linear worst case, I am not talking about segfaults).
<def`>
2) a solution which more or less amount to my physh table.
<Onemorenickname>
I see
<Onemorenickname>
Thank you for your thorough help :)
<def`>
(Note: in the future, it is possible that some guarantees are given by the GC about physical hash table has that might be useful for the multicore runtime, but I haven't heard of any concrete plan)
<Onemorenickname>
(sounds like a good plan)
mali__ has joined #ocaml
srcerer has joined #ocaml
<orbifx-m>
why can't constructors behave like function values?
ygrek_ has joined #ocaml
<flux>
I think the traditionally provided reason goes that it complicates the compiler. I guess the feature would be a cross-cutting concern lending the AOP terminology.
<orbifx-m>
aop?
<flux>
aspect oriented programming
<flux>
constructors used to be possible to apply partially in caml light, btw
<flux>
cross-cutting concern means "touches all around the code". but that it is one is just a hypothesis I've inferred from the reasoning, if it could be isolated it would be in already.. :)
<flux>
I bet there is a ppx that gives that functionality :)
<flux>
(not bet a lot of money, though, maybe like 10 eurocents)
<orbifx-m>
Haha
<orbifx-m>
bet bitcoin, you can bit less
slash^ has quit [Read error: Connection reset by peer]
<orbifx-m>
so other ml languages can use constructors like functions?
jnavila has joined #ocaml
fre has joined #ocaml
arj has joined #ocaml
orbifx-m has quit [Ping timeout: 240 seconds]
jnavila has quit [Ping timeout: 240 seconds]
spew has quit [Ping timeout: 268 seconds]
orbifx-m has joined #ocaml
<Drup>
"ml languages" are very diverse
<orbifx-m>
but this seems fundamental
fre has quit [Ping timeout: 240 seconds]
<flux>
SML has it. I guess haskell as well, or if not, at least GHC has an extension for it :)
fre has joined #ocaml
spew has joined #ocaml
<Onemorenickname>
haskell has it
<Onemorenickname>
flux, you can preprocess ocaml if you want
<Onemorenickname>
i did not want to spend time to do that
<Onemorenickname>
(the project i'm working on is basically a cross-language pre-processor)
<Onemorenickname>
but if you do so, you'll get that
fre has quit [Ping timeout: 258 seconds]
reynir1 is now known as reynir
orbifx-m has quit [Remote host closed the connection]
fre has joined #ocaml
AlexDenisov has joined #ocaml
yomimono has joined #ocaml
<tautologico>
constructors not being functions is not a big deal, but it annoyed me greatly in the beginning, being used to SML before coming to ocaml
arj has left #ocaml [#ocaml]
achauvin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Onemorenickname has quit [Read error: Connection reset by peer]
fre has quit [Ping timeout: 256 seconds]
jnavila has joined #ocaml
govg has joined #ocaml
fre has joined #ocaml
yomimono has quit [Ping timeout: 240 seconds]
AlexDeni_ has joined #ocaml
AlexDenisov has quit [Ping timeout: 240 seconds]
copy` has quit [Quit: Connection closed for inactivity]
AlexDenisov has joined #ocaml
AlexDeni_ has quit [Read error: Connection reset by peer]
copy` has joined #ocaml
fre has quit [Ping timeout: 246 seconds]
pigoz1 is now known as pigoz
<def`>
flux: it is not hard to implement non curried constructors.
<def`>
the other way...
<def`>
but it doesn't really match the machine (it generates non trivial code, so performance model is less obvious)
AlexDeni_ has joined #ocaml
<def`>
I would prefer that functions work like value constructors + syntax for partial applicatoin, than the other way around
AlexDenisov has quit [Ping timeout: 240 seconds]
ryanartecona has quit [Quit: ryanartecona]
Ptival_ is now known as Ptival
johnf_ has quit [Remote host closed the connection]
fre has joined #ocaml
cbot has joined #ocaml
jabroney1 has joined #ocaml
freusque has quit [Ping timeout: 240 seconds]
_andre has quit [Quit: leaving]
<tautologico>
companion_cube: I was trying to get iocaml working with jupyter, and just now saw you created a separate repository for a common lib
jabroney has quit [Ping timeout: 260 seconds]
<tautologico>
companion_cube: what is missing to get jupyter-kernel working with iocaml?
fre has quit [Ping timeout: 256 seconds]
rom15041 is now known as rom1504
fre has joined #ocaml
fre has quit [Client Quit]
snowcrshd has quit [Remote host closed the connection]
yomimono has joined #ocaml
BitPuffin|osx has quit [Ping timeout: 260 seconds]
mengu has joined #ocaml
cbot_ has joined #ocaml
jabroney has joined #ocaml
jabroney1 has quit [Ping timeout: 260 seconds]
cbot has quit [Ping timeout: 256 seconds]
AlexDeni_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
coddinkn has quit [Ping timeout: 260 seconds]
sepp2k has quit [Ping timeout: 240 seconds]
spew has quit [Quit: foobar]
kakadu_ has joined #ocaml
freusque has joined #ocaml
silver_ has joined #ocaml
silver has quit [Ping timeout: 240 seconds]
MercurialAlchemi has quit [Ping timeout: 264 seconds]
jnavila has quit [Remote host closed the connection]
<companion_cube>
hi!
<companion_cube>
saw your issue
<companion_cube>
what's missing is adapting the code of iocaml to use the separate library
<tautologico>
I'm trying to port the simple kernel from python to use the library
<tautologico>
after that I'll go to full iocaml
<companion_cube>
that would be nice!
<companion_cube>
(also, there might be some no-up-to-date pieces in jupyter-kernel, especially w.r.t the IO channel)
<tautologico>
trying a very simple kernel first will help uncovering issues
<companion_cube>
I have a very simple kernel somewhere, but it doesn't use IO
ryanartecona has joined #ocaml
<companion_cube>
I'll be happy to merge PRs!
<tautologico>
cool
<tautologico>
separating into a library like that was a good idea
<companion_cube>
I also removed the custom 0mq bindings
<companion_cube>
so it's a cleanup
<companion_cube>
(and it uses the next version of the protocole)
<companion_cube>
but if you have a proper language to make a binding for, then it's perfect
silver_ is now known as silver
BitPuffin|osx has joined #ocaml
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
wtetzner has joined #ocaml
duduk has joined #ocaml
BitPuffin|osx has quit [Ping timeout: 260 seconds]
<Pietro>
Hi everyone, I have a question related to type generalisation at let bindings. It has been a few years I've been programming but never noticed the following behaviour: let f (x : 'a) = x is assigned a polymorphic type if it is a module-level let binding, but a rigid type variable if it is not module-level. Why ?
yomimono has quit [Ping timeout: 264 seconds]
<flux>
by "not module level" you mean ie. inside a value or function definition?
<flux>
note that (x : 'a) by itself means nothing more than just x. in other words, (x : 'a) does not mean x is now polymorphic, it can have a fixed type.
<Pietro>
@flux: yes, eg let _ = let f (x : 'a) = x in (f 3, f 3.0) does not type check
<Pietro>
but if I define f at module-level then it's ok
inr_ is now known as inr
<flux>
so I don't have a good answer why it that is the case, other than it's related to the type inference algorithm. you can rewrite that as: let _ = let f : 'a. 'a->'a = fun x -> x in (f 3, f 3.0) and it works as expected.
<flux>
or shorter: let _ = let f (type a) x : a = x in (f 3, f 3.0)
<Pietro>
yes I know, or use explicit quantification with (type t) (which must be equivalent to 'a . 'a -> 'a) ... I find this ultra weird.
<tautologico>
I think it's the type inference algorithm, as it tries to infer a type for f it first sees the constraint 'a = int
<tautologico>
then tries to satisfy the constraint 'a = float, which is impossible
<Pietro>
yes, the 'a variable is quantified existentially in the case which breaks and universally (as it should) at module-level which is weird
<flux>
perhaps the 'a is a red herring here. the meaning of the program is the same for all (x : 'a), (x : _) and (x) :-)
<tautologico>
yes, but there is a type variable there, explicit or not
<flux>
(if used only once that is, of course it has a meaning if used multiple times)
<flux>
I wonder if some existing code would break if such functions inside values were as polymorphic as possible.
yomimono has joined #ocaml
<Pietro>
I was wondering the same, perhaps something related to GADTs
<companion_cube>
not sure how code could break by adding more polymorphism
<tautologico>
I don't think it's something related to GADTs
<tautologico>
in F# it works the same way, no GADTs there
<tautologico>
(some F# guy had this same doubt just a few days ago)
jabroney has quit [Quit: Leaving.]
Cypi_ is now known as Cypi
<Pietro>
ah, interesting! I was positing some kind of regression induced by the recent additions to the language but maybe that's not the case
<tautologico>
I don't know if you can explicitly tell a type variable is universally quantified in F#... one solution there is to use objects
<Pietro>
maybe types variables appearing inside the body of a function are by default considered to be quantified existentially, in case they are bound higher up.
<Pietro>
Since that cannot be the case for a module-level let binding, variables appearing there are universally quantified (?)
average has quit [Ping timeout: 245 seconds]
average has joined #ocaml
<Pietro>
e.g. in let g : 'a -> ('a * 'a) = let f (x : 'a) = x in fun y -> (f y, fy); the inner 'a is constrained to be equal to the one in the signature of g (?)
<tautologico>
I think this has something to do with mutability
<Pietro>
yes maybe I should re-read Guarrigue's paper on relaxing the value restriction ... Anyway, time to sleep for me, thanks a lot chaps!
Pietro has quit [Quit: ciao]
yomimono has quit [Ping timeout: 240 seconds]
freusque has quit [Ping timeout: 240 seconds]
BitPuffin|osx has joined #ocaml
BitPuffin|osx has quit [Remote host closed the connection]
BitPuffin|osx has joined #ocaml
wtetzner has quit [Remote host closed the connection]