reem has quit [Read error: Connection reset by peer]
_5kg has quit [Ping timeout: 264 seconds]
MercurialAlchemi has joined #ocaml
tane has joined #ocaml
mcc has quit [Quit: This computer has gone to sleep]
reem_ is now known as reem
hilquias has quit [Ping timeout: 252 seconds]
AlexRussia has quit [Ping timeout: 264 seconds]
nullcat has quit [Ping timeout: 245 seconds]
nullcat has joined #ocaml
AlexRussia has joined #ocaml
SomeDamnBody has quit [Ping timeout: 244 seconds]
reem has quit [Remote host closed the connection]
_5kg has joined #ocaml
kakadu_ has joined #ocaml
kakadu has quit [Ping timeout: 245 seconds]
contempt has quit [Remote host closed the connection]
applicative-pyon is now known as generative-pyon
reem has joined #ocaml
reem has quit [Remote host closed the connection]
reem has joined #ocaml
contempt has joined #ocaml
reem has quit [Remote host closed the connection]
rgrinberg has joined #ocaml
matason has joined #ocaml
ygrek has joined #ocaml
rgrinberg has quit [Ping timeout: 246 seconds]
yomimono has joined #ocaml
reem has joined #ocaml
AlexRussia has quit [Ping timeout: 245 seconds]
ygrek has quit [Ping timeout: 246 seconds]
reem has quit [Remote host closed the connection]
AlexRussia has joined #ocaml
reem has joined #ocaml
MooseAndCaml has joined #ocaml
<MooseAndCaml>
Is there a way to copy a record with a mutable value so that when the value of the new record is changed, the old one remains the same? doing let y = {x with ...} is modifying both x and y
<MooseAndCaml>
hmm...thanks for testing that. ill double check my code...
kakadu_ has quit [Ping timeout: 245 seconds]
<flux>
maybe you have 'ref' fields in the record, that could be confusing. the 'with' syntax does not create new 'ref's.
kakadu_ has joined #ocaml
badon has quit [Disconnected by services]
badon_ has joined #ocaml
badon_ is now known as badon
nullcat has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<MooseAndCaml>
no ref fields in the record... The mutable variable is nested in a few types inside the record I'm copying I'm doing let z = {x with one_random_field = 0} and the accessing the ref through z
reem has quit [Remote host closed the connection]
<MooseAndCaml>
I cant add the assignments in the with directly because the filed is a variant type, with two more nested fields
<flux>
do note that type 'a ref = { mutable contents : 'a }
<flux>
so it may bear some resemblance to your data structure
<MooseAndCaml>
what do you mean?
<flux>
and the 'with' syntax is literally the same as just doing { a = x.a; b = x.b; c = x.c; .. }
AlexRussia has quit [Ping timeout: 240 seconds]
<flux>
so it will share the original fields except the one you overrode by hand
reem has joined #ocaml
contempt has quit [Ping timeout: 246 seconds]
<flux>
I mean that if you have sort of reimplemented 'ref' in your code, it will of course have the same semantics.. and that on the other hand 'ref' is not anything particularly special, it's the mutable field that's special.
<MooseAndCaml>
is there any kind of deep copy? this record has lots of fields which are records or variant types with records and mutable
<MooseAndCaml>
or is it necessary to dive in to all of the manually, extract the value from the ref and create new refs?
<flux>
well.. you could use Marshal for serializing and deserializing it..
<flux>
but other than that, there is no deep copy
<flux>
one could probably be implemented in C..
<flux>
the case of embedded lambda functions might be a tricky one.
<MooseAndCaml>
oh that sounds rugged... do you avoid such records?
<flux>
well, I don't often use mutable fields. I don't know about your use-case.
contempt has joined #ocaml
<MooseAndCaml>
cool. ill just do a manual copy till I have a moment to dive in. I'm glad it wasn't just buggy code
contempt has quit [Remote host closed the connection]
<ggole>
Mutable fields are OK when you have a thing with identity, in which case you usually don't need to copy
<ggole>
Other than that they can be trouble
<ggole>
You can easily get bugs when you put things in hashtables, etc
matason has quit [Ping timeout: 246 seconds]
HashGa has joined #ocaml
<HashGa>
Hi everyone. The directive "type alias_name = type_we_want_to_create_alias" just create an alias. So, for the compiler, alias_name is totally considered as the type we want ? No differences ?
<ggole>
HashGa: they might be printed differently
<HashGa>
ggole: printed ? What do you mean ?
<ggole>
The type name as printed in the repl, in error messages etc
<HashGa>
Oh ok. It's because I want to use it to be clear in my library, but it must be transparent for people who use library.
<HashGa>
Is it the best method ?
<ggole>
You can use abstract or private types for that.
<HashGa>
For example, if I would like to represent (math) vector as a "'a array" with the alias "vect", the user can sent as parameter a "'a array" without having problem or warning.
<ggole>
And you want to prevent that?
contempt has joined #ocaml
<HashGa>
I want to authorize user to send an " 'a array" and he's not obliged to know that a vect type is used. Now, I use " type vect = 'a array" and in interface I define my function with the vect type. I don't get any warnings and errors, but I don't know if there's something behind this.
reem has quit [Remote host closed the connection]
chris2 has quit [Ping timeout: 252 seconds]
<ggole>
Oh, I guess you *don't* want abstract or private types then
<HashGa>
Oki, thank you for your help.
<ggole>
In short, aliases seem to be what you want - a new name but not a new type.
<HashGa>
The user doesn't know that a vect is used.
_5kg has quit [Ping timeout: 264 seconds]
lordkryss has joined #ocaml
HashGa has quit [Ping timeout: 255 seconds]
mort___ has quit [Quit: Leaving.]
reem has quit [Remote host closed the connection]
octachron has quit [Ping timeout: 256 seconds]
octachron has joined #ocaml
matason has joined #ocaml
Submarine has quit [Quit: Leaving]
chris2 has joined #ocaml
reem has joined #ocaml
reem has quit [Remote host closed the connection]
netABCs has quit [Quit: Leaving]
HashGa has joined #ocaml
AlexRussia has joined #ocaml
mort___ has joined #ocaml
octachron has quit [Quit: Leaving]
HashGa has left #ocaml ["Leaving"]
AlexRussia has quit [Ping timeout: 246 seconds]
matason has quit [Ping timeout: 244 seconds]
rgrinberg has joined #ocaml
_5kg has joined #ocaml
keen__________82 has joined #ocaml
keen__________81 has quit [Ping timeout: 264 seconds]
AlexRussia has joined #ocaml
rgrinberg has quit [Ping timeout: 240 seconds]
rand000 has joined #ocaml
larhat has joined #ocaml
axiles has quit [Ping timeout: 245 seconds]
axiles has joined #ocaml
mort___ has quit [Quit: Leaving.]
reem has joined #ocaml
reem has quit [Ping timeout: 245 seconds]
Haudegen has quit [Ping timeout: 272 seconds]
<bernardofpc>
Hey, my emacs does not change the background to highlight the expression I'm doing a merlin-type-enclosing on. Any ideas on what can I do ?
ab3 has joined #ocaml
Haudegen has joined #ocaml
TheLemonMan has joined #ocaml
larhat has quit [Quit: Leaving.]
<ggole>
bernardofpc: did you install a theme or anything like that?
<ggole>
def`: oh by the way, you added an argument to the call to set-temporary-overlay-map which breaks older (not all that much older) versions of emacs
generative-pyon is now known as idem-pyon-tent
<bernardofpc>
ggole: not that I'm aware of, I've very little emacs experience
<bernardofpc>
It says something about :inherit caml-type-face
<bernardofpc>
caml-types-expr-face in fact
<ggole>
Which probably doesn't exist
<bernardofpc>
:D
<ggole>
You can override it in customize, or try to arrange for it to exist by loading, uh, I think it's tuareg-mode which defines that
<bernardofpc>
I guess Tuareg is on
sol__ has joined #ocaml
ab3 has quit [Ping timeout: 246 seconds]
rgrinberg has joined #ocaml
<bernardofpc>
(Tuareg merlin (default) AC)
<ggole>
Hmm
<ggole>
Do you have the caml-mode stuff installed?
<ggole>
From what I can see tuareg-mode loads those if they exist - they probably define that face
<bernardofpc>
oh
<ggole>
Yeah, it's in caml-types.el
<bernardofpc>
so Tuareg needs caml-mode
<bernardofpc>
I was not aware of that :/
<ggole>
It doesn't *need* it, but it will use it if it is there
<bernardofpc>
well, right, so Merlin needs Tuareg with cml-mode in order for colors to behave well in C-c C-t
<ggole>
Well, you could just define the face yourself
<ggole>
Up to you.
<bernardofpc>
If somewhere in merlin docs this was easy to find
<bernardofpc>
or maybe people just have to use IRC
<bernardofpc>
;-)
<ggole>
It's a tuareg thing, really
<ggole>
merlin just uses tuareg-type-face and assumes it's OK
<rks`>
ggole: the break, do you have the commit in which it was introduced?
<ggole>
(How's that for buck-passing?)
rgrinberg has quit [Ping timeout: 246 seconds]
<ggole>
rks`: no, but I can probably find it if you want
<rks`>
no don't worries, I'll look for it myself
<rks`>
but I remember we had a discussion about it
<rks`>
I don't remember if the conclusion was "we need to fix that" or "well, too bad." though :D
<bernardofpc>
if A works out of the box only if either you know in advance what to set, or if B comes set up with C working right, I guess it could say that in docs
<rks`>
bernardofpc: open an issue :)
<bernardofpc>
I've had no use for t-t-f before it was needed by merlin ;-)
<bernardofpc>
rks`: I've no GH accound
<bernardofpc>
(ouch the Greeen, but hey, thanks ggole )
<rks`>
ah :D
<rks`>
well
<rks`>
I'll try not to forget
haesbaert has quit [Remote host closed the connection]
idem-pyon-tent has quit [Quit: I'm sorry but... I don't have any interest in three-dimensional girls.]
pyon has joined #ocaml
matason has joined #ocaml
Haudegen has quit [Ping timeout: 264 seconds]
Haudegen has joined #ocaml
matason has quit [Ping timeout: 250 seconds]
r_ has joined #ocaml
jao has joined #ocaml
jao has quit [Changing host]
jao has joined #ocaml
<MercurialAlchemi>
I didn't know the React source was NSFW
jneen has quit [Remote host closed the connection]
rgrinberg has joined #ocaml
pyon has quit [Quit: In and around the lake... Mountains come out of the sky and they stand there... <rit.> Twenty-four before my love and I'll be there... <a tempo, goes crazy>]
<tane>
MercurialAlchemi, in what way? :)
<MercurialAlchemi>
tane: in the 'type 'a smut' way
<tane>
hehe
<MercurialAlchemi>
I'm sure dbuenzli has a private branch with a React.FiftyS module
<tane>
Error: The constructor Lexer.INFO expects 2 argument(s), but is applied here to 1 argument(s)
<Drup>
where is the error ?
<tane>
line 27
<tane>
nah, it isn't
<tane>
it's somewhere in the generated code
<Drup>
hum, let me guess
<Drup>
put parens around "string * string*"
travisbrady has joined #ocaml
<tane>
Drup, tried that, same thing
<Drup>
Hum.
<tane>
i've been looking for menhir examples but couldn't find tuple use yet
<lyxia>
tane: Uh, it compiles.
<tane>
meh
<tane>
what version of menhir do you have?
<lyxia>
20140422, is that too old?
<tane>
20141215 is what i got
<tane>
well.. i'll have a look at that later then, thanks for the help so far
Haudegen has quit [Ping timeout: 245 seconds]
<ousado>
if you wanted to programatically create wrappers/bindings for objective-c (specifically ios) APIs, which tools would you use/suggest to consider?
ptc has joined #ocaml
jerith has quit [Remote host closed the connection]
ptc is now known as Guest34076
Haudegen has joined #ocaml
r_ has joined #ocaml
r__ has quit [Ping timeout: 264 seconds]
lordkryss has quit [Ping timeout: 256 seconds]
lordkryss has joined #ocaml
<seangrove>
How can I convert Unix.time() to a string?
<seangrove>
I tried `let str_number = Printf.sprintf "%f" Unix.time() ;;` but it seems the types don't match up
yaewa has quit [Quit: Leaving...]
<mrvn>
seangrove: () is not a function call, it's a value. You are passing 3 args to sprintf while you want to call time instead.
tani has joined #ocaml
<seangrove>
mrvn: Ah, yes, I keep geting bit by that, I'm sorry
moei has joined #ocaml
AlexRussia has quit [Ping timeout: 255 seconds]
tane has quit [Ping timeout: 264 seconds]
mort___ has quit [Quit: Leaving.]
pleasant-pyon is now known as antitone-pyon
slash^ has quit [Read error: Connection reset by peer]
tani is now known as tane
Haudegen has quit [Ping timeout: 246 seconds]
xificurC has joined #ocaml
Haudegen has joined #ocaml
jerith has joined #ocaml
SomeDamnBody has joined #ocaml
TheLemonMan has joined #ocaml
mort___ has joined #ocaml
travisbrady has quit [Quit: travisbrady]
SomeDamnBody has quit [Ping timeout: 246 seconds]
milosn has quit [Read error: Connection reset by peer]
milosn has joined #ocaml
matason has joined #ocaml
nullcat has joined #ocaml
Submarine has quit [Remote host closed the connection]
struktured has quit [Ping timeout: 265 seconds]
Haudegen has quit [Ping timeout: 250 seconds]
<TheLemonMan>
silly question here, what's the point of a 'type' declaration in a sig ?
<Drup>
well, expose a new type
<mrvn>
so that you can use it in later sigs
<ggole>
They also participate in functor machinery
<TheLemonMan>
I'm reading some code that has a declaration like this 'type `a t' but I'm not sure of the meaning here
<mrvn>
It's an abstract type with a parameter
<TheLemonMan>
so it'd be correct to do 'type `a t = option` ?
<mrvn>
option takes a parameter too
ggole has quit []
Haudegen has joined #ocaml
jao has quit [Remote host closed the connection]
<flux>
note that ` and ' are different characters. it's actually 'a .
<flux>
so it would be correct to be type 'a t = 'a option to elaborate ;-)
<TheLemonMan>
why the leading 'a ?
<mrvn>
it's a placeholder. Means you can have "int t", "float t" ...
jao has joined #ocaml
jao has quit [Changing host]
jao has joined #ocaml
travisbrady has joined #ocaml
<flux>
thelemonman, usually the signature may provide an abstract type such as type 'a t and then the type 'a t is exactly defined in the .ml file
<flux>
and why use 'a instead of not using it? well, for example if you are implementing a data structure and you want people to be able to put integers in and take integers out, instead of putting integers out and crashing when taking strings out..
ghostpl_ has quit [Remote host closed the connection]
travisbrady has quit [Ping timeout: 252 seconds]
ollehar has joined #ocaml
Guest34076 has quit [Ping timeout: 244 seconds]
_5kg has quit [Ping timeout: 255 seconds]
travisbrady has joined #ocaml
_5kg has joined #ocaml
jao has quit [Ping timeout: 250 seconds]
mbac has quit [Quit: .]
mort___ has quit [Quit: Leaving.]
<TheLemonMan>
oh, great! I was confused by the 'backwards' notation
<TheLemonMan>
also, is there something equivalent to ghci's :t ?
<mrvn>
What's :t?
<flux>
hmm, maybe not quite
<flux>
though ocaml does tell the type of all expressions that end up to the toplevel
MrScout has quit [Ping timeout: 265 seconds]
<flux>
you could emulate it with, say, lazy (expression here);;
badon has quit [Quit: Leaving]
<flux>
of course, usually you just do plain expression;; if you don't need to emulate the :t ;)
<Drup>
TheLemonMan: #show
<flux>
ah, forgot about that :)
<flux>
it's new and all :/
<TheLemonMan>
Drup, thanks!
<flux>
hmm, I don't think it is it, though?
<flux>
#show shows module signatures?
<TheLemonMan>
now I just need to stop forgetting the trailing ;; and get rid of that hideous prompt heh
<TheLemonMan>
flux, it seems so
<flux>
and recalls type definitions I see
<Drup>
flux: #show shows everything.
<flux>
drup, well yes, but you can do :t 42 in ghci
<Drup>
hum, right
<flux>
but nice, I didn't actually know #show works on objects other than modules
<Drup>
but that's because ghci doesn't bother giving you the type when you type "42"
<Drup>
(which is remarquably idiotic, if you ask me)
<bernardofpc>
what else does #show show ?
<Drup>
bernardofpc: any declaration
<TheLemonMan>
duh, utop is sometimes slow as hell
<Drup>
the loading is, yes
<Drup>
it's a known issue
<TheLemonMan>
sometimes it's slow at evaluating simple expressions too
<def`>
TheLemonMan: try utop -no-short-paths
<Drup>
other than the first one ?
<Drup>
def`: isn't that solved ?
<TheLemonMan>
it seems to happen only the first time I type in an expression
<def`>
Drup: "lol"
<Drup>
ah, only in trunk OCaml ?
<def`>
Drup: the solved short-path is no-short-path :P
<Drup>
that's not really a solution.
<def`>
the acceptably slow solution is only in trunk yes
<Drup>
right.
<def`>
but short-path is a non-feature imho
<Drup>
for utop or in general ?
<def`>
(admitedly trolling)
<def`>
in genral
<Drup>
I disagree then :p
SomeDamnBody has joined #ocaml
<TheLemonMan>
I'm feeling silly and the compiler isn't helping, what's wrong in 'List.fold_right (&&) [true, false] true' ? I've double checked the signatures and should be ok
ghostpl_ has joined #ocaml
<Drup>
the list separator is ";", not ","
<flux>
[1,2;3,4] is a list of two tuples :)
<TheLemonMan>
oh god I hate myself so much
<TheLemonMan>
I've been struggling in the past 10 minutes because of the same error
<TheLemonMan>
(on a side note, are there builtin and/or for lists of bool ?)
<def`>
List.for_all id / List.exists id
<def`>
(and let id x = x :P)
<TheLemonMan>
noice
badon has joined #ocaml
matason has quit [Ping timeout: 265 seconds]
xificurC has quit [Ping timeout: 244 seconds]
alexis_ has joined #ocaml
alexis_ has quit [Client Quit]
axiles has quit [Ping timeout: 264 seconds]
t4nk774 has joined #ocaml
<t4nk774>
Hi
ghostpl_ has quit [Ping timeout: 264 seconds]
MrScout_ has joined #ocaml
travisbrady has quit [Quit: travisbrady]
mort___ has joined #ocaml
axiles has joined #ocaml
<TheLemonMan>
what do I do when ocamlc kindly suggests that "Error: This expression should not be a function" ?
<def`>
can't help without context
<bernardofpc>
never seen this !
<TheLemonMan>
here's a minimal testcase "let fuq = List.for_all (fun x -> x);;"
<TheLemonMan>
which utop happily accepts as valid
<pippijn>
let da f = f [1; 2; 3]
<def`>
TheLemonMan: you are using core
<def`>
List.for_all ~f:(fun x -> x);;
<pippijn>
wait
<pippijn>
10 minutes?
<def`>
And the full message says "…, the expected type is 'a list" !
<pippijn>
you've been struggling for 10 minutes and you hate yourself already?
<pippijn>
you need to grow a thicker skin
<bernardofpc>
OCaml will teach that
<pippijn>
every programming language will
<pippijn>
this is part of programming
<TheLemonMan>
pippijn, I'm just silly as shit and keep forgetting that it's ; and not ,
<bernardofpc>
well, ocaml compiler is pretty harsh on making you write things clearly
<pippijn>
in ocaml, most of the annoyances tend to be type errors, in other languages you may get more runtime errors to ponder
<TheLemonMan>
def`, why does it need to pass f as a named param ?
<bernardofpc>
TheLemonMan: well, this is annoying, but it's mostly the by-product of every lang designer wanting to be smarter than the other guys
<pippijn>
because the signature was defined like that
<pippijn>
the library designer decided that this was a good idea
<bernardofpc>
TheLemonMan: because that's the "Core philosophy"
<bernardofpc>
they really like named arguments, and I can see a point for it in clarity of code
MrScout_ has quit [Ping timeout: 265 seconds]
<TheLemonMan>
so you can't pass named arguments in the order they're defined ?
struktured has joined #ocaml
<Drup>
you can, if the application is complete
<Drup>
partial un-labeled application don't work
<TheLemonMan>
gotcha
<TheLemonMan>
#show doesn't show the named params
<Drup>
that's because you #show the stdlib function
<TheLemonMan>
I'm pleasantly and genuinely confused
<bernardofpc>
TheLemonMan: perhaps your toplevel is NOT using Core, whereas your compiler is
<TheLemonMan>
Core has no List module (and I've opened core in the utop repl)
<Drup>
Core.Std
<Drup>
;)
<TheLemonMan>
oh, I see, it also has the argument in the reversed order
milosn has quit [Ping timeout: 244 seconds]
milosn has joined #ocaml
hilquias has joined #ocaml
mort___ has quit [Quit: Leaving.]
SomeDamnBody has quit [Ping timeout: 272 seconds]
MercurialAlchemi has quit [Ping timeout: 245 seconds]
Simn has quit [Quit: Leaving]
tane has quit [Quit: Verlassend]
jprakash has quit [Ping timeout: 256 seconds]
ghostpl_ has joined #ocaml
NaCl has joined #ocaml
yminsky has joined #ocaml
yminsky has quit [Client Quit]
mcc has joined #ocaml
badkins has joined #ocaml
kakadu_ has quit [Remote host closed the connection]
waneck has joined #ocaml
ghostpl_ has quit [Ping timeout: 246 seconds]
yomimono has quit [Ping timeout: 252 seconds]
reem has joined #ocaml
TheLemonMan has quit [Quit: leaving]
t4nk774 has quit [Ping timeout: 246 seconds]
antitone-pyon is now known as pyon-tinuation
pyx has joined #ocaml
pyx has quit [Client Quit]
jao has joined #ocaml
jao has quit [Changing host]
jao has joined #ocaml
jao has left #ocaml ["Using Circe, the loveliest of all IRC clients"]