<ddosia>
I have tried to reinstall camlp4, but no luck
nikki93 has quit [Remote host closed the connection]
<ygrek>
ddosia, what is your OS and what ocaml package did you install?
<ygrek>
you have two options - either install full ocaml or use opam to install ocaml compiler for you (in this case I suggest removing OS installed ocaml altogether)
siddharthv has joined #ocaml
<ygrek>
how did you try to "reinstall camlp4"?
talzeus has quit [Remote host closed the connection]
<ygrek>
probably bubuntu is broken wrt camlp4, I dunno
<LoldLolddelolt>
So wait, what I understand is that in Ocaml you don't actually have to include modules, just doing List.x at one point in the code is enough for the compiler to include t?
<LoldLolddelolt>
That is so brilliant and yet so obvious.
<ygrek>
you have to "include" packages that provide those modules, at compile-time
<ygrek>
that's so brilliant that you cannot use two modules with the same name in one project
<ddosia>
ygrek: reinstalled ocaml with opam, now opam install utop works fine, thanks!
<ygrek>
you should probably file the bug with ubuntu that camlp4 package doesn't provide camlp4 META file
talzeus has quit [Remote host closed the connection]
<ddosia>
ddosia@dch-carbon:~$ opam install utop
<ddosia>
[NOTE] Package utop is already installed (current version is 1.8).
<ddosia>
ddosia@dch-carbon:~$ utop
<ddosia>
utop: command not found
pango has quit [Ping timeout: 240 seconds]
<ddosia>
hmmm :( probabbly I should go and read more about ocaml infrastructure before this book
talzeus has joined #ocaml
q66 has quit [Ping timeout: 246 seconds]
<technomancy>
ddosia: probably need eval `opam config -env`
<technomancy>
in your .profile
<ddosia>
technomancy: thanks, should I do this each time?
<ddosia>
ah, see
manud_ has quit [Ping timeout: 272 seconds]
pango has joined #ocaml
manud_ has joined #ocaml
manud_ has quit [Ping timeout: 265 seconds]
imran_sr has joined #ocaml
q66 has joined #ocaml
w0rm_x has quit [Quit: if Φ Σ e : φ then Φ Σ τ' → σ' :: ∃]
nikki93 has quit [Remote host closed the connection]
nikki93 has joined #ocaml
csakatoku has joined #ocaml
ygrek has quit [Ping timeout: 272 seconds]
mcclurmc has joined #ocaml
mildfate has joined #ocaml
tulloch has joined #ocaml
tulloch has quit [Ping timeout: 272 seconds]
mcclurmc has quit [Remote host closed the connection]
yacks has quit [Quit: Leaving]
q66 has quit [Ping timeout: 246 seconds]
cdidd has quit [Read error: Operation timed out]
q66 has joined #ocaml
nikki93 has quit [Remote host closed the connection]
cdidd has joined #ocaml
<smiler>
whitequark: Sorry that I wasn't clear enough on how to produce for the utop repl bug.
w0rm_x has joined #ocaml
ygrek has joined #ocaml
ulfdoz has joined #ocaml
ollehar has joined #ocaml
hellome has quit [Read error: Connection reset by peer]
nonuby has joined #ocaml
csakatoku has quit [Remote host closed the connection]
csakatoku has joined #ocaml
pango has quit [Read error: Connection reset by peer]
csakatok_ has joined #ocaml
ulfdoz has quit [Ping timeout: 245 seconds]
ttamttam has joined #ocaml
csakatoku has quit [Ping timeout: 265 seconds]
ulfdoz has joined #ocaml
pango has joined #ocaml
ulfdoz has quit [Ping timeout: 264 seconds]
gour has joined #ocaml
wormphlegm has quit [Ping timeout: 246 seconds]
ollehar has quit [Ping timeout: 246 seconds]
nikki93 has joined #ocaml
NoNNaN has joined #ocaml
fds has quit [Ping timeout: 245 seconds]
fds has joined #ocaml
anderse has joined #ocaml
chrisdotcode_ has left #ocaml []
wormphlegm has joined #ocaml
wormphlegm has quit [Ping timeout: 246 seconds]
LoldLolddelolt is now known as LoldLoldelolt
jonludlam has quit [Remote host closed the connection]
Kakadu has joined #ocaml
levi` has joined #ocaml
levi has quit [Remote host closed the connection]
mika1 has joined #ocaml
Kakadu has quit [Ping timeout: 250 seconds]
Kakadu has joined #ocaml
chambart has joined #ocaml
NoNNaN has quit [Remote host closed the connection]
nikki93 has quit [Remote host closed the connection]
josch_ has joined #ocaml
<josch_>
hi, sometimes (working on the same data and I wouldnt know about any randomness in the algorithm I use) my ocaml program segfaults - how can I best debug this?
<josch_>
I'm creating *.native executables using ocamlbuild and tried to add debug symbols by specifying foo.d.native as the target
<josch_>
but ocamlbuild complains that there is no foo.d.ml file
<josch_>
how would I create a native ocaml executable with debug symbols for gdb?
<josch_>
or is there a better way to find out what caused that segmentation fault?
lopex has joined #ocaml
<gasche>
josch_: use "ocamlbuild -tag debug foo.native"
jonludlam has joined #ocaml
<gasche>
(the technique of prefixing extensions should be avoided for native compilation because of assumption about filenames made by the compiler when it looks for compiled object files)
<gasche>
re. segfaults: it is rare than OCaml code segfaults, so you should look for uses of libraries that are known to be unsafe (eg. Marshal), or C bindings
<gasche>
re. using gdb, you can use gdb with executables with debug symbol, but it's a bit painful because gdb doesn't know about OCaml name mangling etc.
<josch_>
gasche: I tried -tag debug too but when I then open gdb with the created foo.native, it tells me that there are no debug symbols
<gasche>
Mark Shinwell has worked a lot on that (he has branches of gdb and ocaml to improve this aspect) but it's not upstream yet
<gasche>
if you want to try his still-experimental work, send him an email
<gasche>
hm josch_
<gasche>
I'm surprised
<josch_>
gasche: I am using Marshal as well as C bindings but without any gdb backtrace I can't find where the error is, right?
<gasche>
on my machine, "gdb foo.native" works whether -tag debug was passed or not
<josch_>
oh how funny
<josch_>
so on your machine ocamlbuild includes debugging symbols nevertheless?
<josch_>
I also added "true: debug" to my _tags file as the manual said
<josch_>
just to be sure
<gasche>
"true: debug" and "-tag debug" are equivalent
<josch_>
yes, but I wanted to make sure
<gasche>
I think on my machine ocamlopt always includes enough for gdb to work
<adrien_oww>
josch_: also, do you use C bindings?
<gasche>
that's not an ocamlbuild problem
<josch_>
adrien_oww: yes
<gasche>
-tag debug also enables backtrace-collection for OCaml-side exceptions, and some other things that are nice for debugging
<adrien_oww>
josch_: which ones?
<gasche>
but I can use gdb on non-debug executables
<josch_>
some of the ocaml modules I use, use c bindings
<gasche>
(pure OCaml executables)
<josch_>
my program uses dose3 which makes use of c bindings
<gasche>
what's your operating system and C-side toolchain?
<josch_>
debian sid with ocaml 3.12
<josch_>
and gcc 4.8
<josch_>
I made a test in a clean, empty directory
<josch_>
I created an empty file foo.ml
<josch_>
and then ran: ocamlbuild -tag debug foo.native
<josch_>
when I then do: gdb foo.native
kyrylo has joined #ocaml
<josch_>
then I see: Reading symbols from /home/josch/test/_build/foo.native...(no debugging symbols found)...done.
<josch_>
so it doesnt seem to be a problem with the special setup of my build system
<josch_>
but more with the ocaml installation of my operating system?
<gasche>
that would be my guess; or C-toolchain-side (gdb?). But I know next to nothing about these
<josch_>
so the expected behaviour of the test I did above would be that my foo.native would have debugging symbols included?
<gasche>
hm wait
<gasche>
I can reproduce your behaviour on 3.12
<josch_>
aha!
<gasche>
I previously tested with >4 versions
<gasche>
so
<josch_>
ocaml 4.01.0 is in Debian experimental so I'm able to test it without much hassle
<gasche>
you could try (1) using a more recent version of OCaml that supports debug symbols better
<gasche>
(2) use bytecode compilation, which has a dedicated debugger that could let you know where in your code the segfault happens
<josch_>
gasche: I never observed the segfault during bytecode compilation
<gasche>
josch_: if you're planning to do more OCaml development, using OPAM (which lets you install any version of OCaml) is the way forward it seems
<josch_>
I prefer to not have anything on my system which is not under the control of my package manager unless absolutely needed
<josch_>
so I'll first test with 4.01.0 from experimental
<gasche>
no segfault with bytecode > that's an interesting observation
<josch_>
remember that the segfault also only happens sometimes - so I might just not have executed it often enough
<gasche>
I think generalist package managers have lost the war of being in control of everything on one's system; nowadays all languages that do not emulate C/C++ linking semantics come with their specialized package manager
<gasche>
I've accepted using them to set up development environments
<gasche>
(but I agree end-user programs should still go through the distro whenever possible)
csakatok_ has quit [Remote host closed the connection]
csakatoku has joined #ocaml
<josch_>
I agree that specialized package managers have their advantage in some areas
<gasche>
it's more that for things that are not my direct area of activity, I sometime accept to lose a technical fight in favor of where the majority seems to be heading
<orbitz>
I like the idea of being able to use opam to autogenerate things like .deb or in my case nix expressions
csakatoku has quit [Remote host closed the connection]
csakatoku has joined #ocaml
<josch_>
they also allow homogeneous development for a community around a language without limitations by developers using different operating systems
rand000 has quit [Ping timeout: 272 seconds]
<adrien_oww>
josch_: you can also set your computer to produce core dumps when your application crashes
<josch_>
I'm now using ocaml 4.01.0
<josch_>
but when executing ocamlbuild with my empty foo.ml, I still get no debugging symbols in the resulting foo.native
<josch_>
weird...
<adrien_oww>
you can run ocamlbuild -classic-display or pipe the output of the build to 'cat'; you'll see the command-line invocations and you can check -g is there
<josch_>
right, lets see
Simn has joined #ocaml
<josch_>
ah wait
<josch_>
I forgot to clean before rebuilding
<josch_>
it works now
<josch_>
great!!
<josch_>
gasche, adrien_oww: thanks! I will now run my program another 1000 times to see if I can catch a segfault :)
wormphlegm has joined #ocaml
wormphlegm has quit [Read error: Operation timed out]
kyrylo has quit [Read error: Operation timed out]
nonuby has quit [Ping timeout: 245 seconds]
<j0sh>
is this type declaration valid? doesn't seem so
<j0sh>
type t = (A0 of int | A1 of char) * (B0 of float | B1 of char)
_andre has joined #ocaml
<j0sh>
would be nice to avoid defining intermediate types for A0/A1 and B0/B1
<gasche>
j0sh: it's not valid
<gasche>
you should define intermediate types, sorry
<gasche>
(if you want structural sum types, there are polymorphic variants, but they're advanced and have their downsides and it's not a good idea to go there if you're a beginner)
<gasche>
(in any case your life will be easier by declaring intermediate types)
<j0sh>
gasche: yeah, still mostly a beginner, although i get the gist of polymorphic variants
<adrien_oww>
they have two downsides: slightly slower but more importantly: possibly more annoying error messages and type errors
<gasche>
it's nice to know about them but in 99% of situations usual variants (sum types) are more appropriate
<j0sh>
yeah thats what i figured
<adrien_oww>
it's mostly a matter of getting used to them though; you can use them from time to time but it's better to not use them as part of your program design until you're used to them
<j0sh>
and i think 4.0.1 has disambiguation between duplicate named variants?
<j0sh>
that's most of the use cases for polymorphic variants i see (unless i'm reading the code wrong)
sepp2k has joined #ocaml
<j0sh>
err 4.01
Qrntz has quit [Ping timeout: 264 seconds]
Qrntz has joined #ocaml
buddyholly has quit [Ping timeout: 272 seconds]
<adrien_oww>
isn't the disambiguation for record field? or does it apply to variants too?
<adrien_oww>
anyway, polymorphic variants have that use but their biggest one is probably that you can have inheritance between them
csakatoku has quit [Remote host closed the connection]
<adrien_oww>
you can have a function that accept the common subset of 4 different polymorphic variants
<adrien_oww>
you cannot do that with the disambiguation
csakatoku has joined #ocaml
<j0sh>
adrien_oww: true
nikki93 has joined #ocaml
<j0sh>
btw, seems the disambiguation applies to variant constructors as well as records
<gasche>
adrien_oww: I've got no precise report except from the fact that "completing the bootstrap" from Xavier's last instructions (which only described the point upto the first failure) still doesn't work
<gasche>
adrien_oww: would you consider physically coming to Rocquencourt for one day to be able to work on bootstrapping in more direct contact with the couple of people that know something about it?
rand000 has quit [Ping timeout: 265 seconds]
<gasche>
Damien is there on tuesdays, and he might be able to remember how this all works :-'
<adrien_oww>
gasche: let me look at it this evening; last time I tried, it worked
<adrien_oww>
I liked Xavier reproducer because it was very simple; now it's difficult to say anything without looking at the _current_ trunk
<gasche>
I think the problem is still with finishing the bootstrap when you changed magic numbers (but not the runtime)
<adrien_oww>
rocquencourt is not terribly pratical for me besides requiring a day off work but on the other hand a face-to-face meeting would help on several topics; I can't tell right now
Neros has joined #ocaml
BitPuffin has quit [Quit: WeeChat 0.4.2]
skchrko has quit [Ping timeout: 248 seconds]
Neros has quit [Ping timeout: 245 seconds]
talzeus has joined #ocaml
lpw25 has joined #ocaml
cdidd has quit [Ping timeout: 246 seconds]
cdidd has joined #ocaml
osa1 has quit [Read error: Connection reset by peer]
gour has quit [Disconnected by services]
gour_ has joined #ocaml
skchrko has joined #ocaml
gour_ is now known as gour
patronus_ has joined #ocaml
osa1 has joined #ocaml
aggelos has joined #ocaml
pippijn_ has joined #ocaml
bitemyap1 has joined #ocaml
vbmithr_ has joined #ocaml
bacam_ has joined #ocaml
xaimus_ has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
mcclurmc has joined #ocaml
tizoc` has joined #ocaml
siddharthv has joined #ocaml
habnabit has joined #ocaml
habnabit has quit [Changing host]
habnabit has joined #ocaml
mal``` has joined #ocaml
tizoc` is now known as tizoc_
paddymahoney has quit [*.net *.split]
pippijn has quit [*.net *.split]
xaimus has quit [*.net *.split]
tizoc has quit [*.net *.split]
bacam has quit [*.net *.split]
aggelos_ has quit [*.net *.split]
bitemyapp has quit [*.net *.split]
mal`` has quit [*.net *.split]
prof-freud has quit [*.net *.split]
_habnabit has quit [*.net *.split]
patronus has quit [*.net *.split]
vbmithr has quit [*.net *.split]
patronus_ has quit [Excess Flood]
tizoc_ is now known as tizoc
tizoc has quit [Changing host]
tizoc has joined #ocaml
patronus has joined #ocaml
talzeus has quit [Remote host closed the connection]
boogie has joined #ocaml
bacam_ is now known as bacam
paddymahoney has joined #ocaml
prof-freud has joined #ocaml
skchrko has quit [Quit: Leaving]
thomasga has joined #ocaml
boogie has quit [Remote host closed the connection]
mcclurmc has quit [Remote host closed the connection]
mcclurmc has joined #ocaml
ocp has joined #ocaml
Kakadu has joined #ocaml
skchrko has joined #ocaml
bondar has joined #ocaml
ttamttam has quit [Quit: ttamttam]
bondar has quit [Ping timeout: 272 seconds]
eikke has joined #ocaml
<eikke>
anyone familiar with ocaml-ctypes?
lpw25 has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
thomasga has quit [Quit: Leaving.]
yacks has joined #ocaml
shinnya has joined #ocaml
wormphlegm has quit [Ping timeout: 245 seconds]
boogie has joined #ocaml
mika1 has quit [Quit: Leaving.]
<Kakadu>
Hallo guys
<Kakadu>
How was your day?
sepp2k has quit [Quit: Konversation terminated!]
Neros has joined #ocaml
rand000 has joined #ocaml
dsheets has quit [Ping timeout: 248 seconds]
ygrek_ has quit [Ping timeout: 245 seconds]
adr has joined #ocaml
tulloch has quit [Ping timeout: 246 seconds]
chambart has joined #ocaml
ocp has quit [Ping timeout: 245 seconds]
siddharthv has quit [Quit: siddharthv]
mildfate has quit [Quit: Leaving.]
mcclurmc has quit [Remote host closed the connection]
tulloch has joined #ocaml
<smiler>
whitequark: My battle with sublimerepl continues. I've now updated to your now merged code but it seems like sending stuff to the repl doesn't append the ;; that's needed for it to evaluate. I tried added it to cmd_postfix but that didn't do much good.
Drup has quit [Ping timeout: 246 seconds]
bentnib_ is now known as bentnib
mort___ has joined #ocaml
djcoin has quit [Quit: WeeChat 0.4.1]
AltGr has left #ocaml []
osa1 has quit [Ping timeout: 272 seconds]
mcclurmc has joined #ocaml
<whitequark>
smiler: yeah, it doesn't automatically append it with utop
<whitequark>
you can append it in your source, it's harmless
Drup has joined #ocaml
tane has joined #ocaml
nikki93 has joined #ocaml
cesar_ has joined #ocaml
cesar_ is now known as Guest10177
Guest10177 has quit [Ping timeout: 248 seconds]
nikki93 has quit [Remote host closed the connection]
shapr has joined #ocaml
Eyyub has joined #ocaml
<shapr>
Are there ocaml packages for debian/jessie? Do I need to add an apt source?
jonludlam has quit [Quit: Leaving]
<Kakadu>
you can try opam
yezariaely has joined #ocaml
<shapr>
So, I should use opam instead of apt?
<Kakadu>
It will be easier with opam, yes
<maurer>
shapr: In an ideal world you'd use apt, but it's going to be missing ~everything
<maurer>
shapr: The situation is worse than the cabal/os package manager situation
<shapr>
ok, thanks
<smiler>
whitequark: Yea I guess. Gets a bit messy but it's ok.
wormphlegm has joined #ocaml
wormphlegm has quit [Ping timeout: 245 seconds]
mort___ has quit [Quit: Leaving.]
Kakadu has quit []
<shapr>
maurer: Ok, I added the ppa, but it doesn't seem to have the right files for jessie?
<maurer>
shapr: No clue then? I though tat was there
<technomancy>
huh; I didn't know ppas could work with debian
<maurer>
wait, that's an ubuntu ppa
<maurer>
you may need to ask for an ubuntu name
<maurer>
shapr: yeah, that ppa you linked only has debian stuff, you can try one of precise, quantal, raring, or saucy
<maurer>
and see if any of those fit with jessie
<shapr>
ok, thanks
<shapr>
ok, let's see if saucy works...
yacks has quit [Quit: Leaving]
robink has quit [Ping timeout: 245 seconds]
robink has joined #ocaml
tulloch has quit [Ping timeout: 240 seconds]
tulloch has joined #ocaml
Eyyub has quit [Read error: Operation timed out]
Eyyub has joined #ocaml
nikki93 has joined #ocaml
BitPuffin has joined #ocaml
adrien_o1w has joined #ocaml
adrien_oww has quit [Ping timeout: 240 seconds]
manizzle has quit [Ping timeout: 246 seconds]
tulloch has quit [Ping timeout: 272 seconds]
<shapr>
So, I'm just starting with ocaml in emacs
<shapr>
I figured out that files end with .ml
<shapr>
Should I also create a makefile? How is compilation usually done?
adr has quit [Quit: Quitte]
<maurer>
shapr: I have had luck with ocamlbuild, but it's not the only answer
<maurer>
some people use oasis too I think
<shapr>
Is oasis the cabal equivalent?
<maurer>
there is also OCamlMakefile (which I sadly have to use for my work) but it is a disaster
<Drup>
shapr: sort of, yes
<Drup>
shapr: but it uses other build system (mainly ocamlbuild) as backend of r the actual building work
<Drup>
s/of r/for/
rgrinber` has joined #ocaml
<nicoo>
shapr: Also, note that OASIS has no cabal-install equivalent (it's not a package manager)
rgrinber` has quit [Remote host closed the connection]
<shapr>
ok, good to know
<Drup>
only the good part of cabal, then :D
<shapr>
Heh, I like the package manager part too.
<shapr>
But then, I was a very small part of cabal happening, so...
wormphlegm has joined #ocaml
wormphlegm has quit [Ping timeout: 272 seconds]
mort___ has joined #ocaml
manizzle has joined #ocaml
pippijn_ is now known as pippijn
jgross_ has joined #ocaml
rand000 has quit [Quit: leaving]
<jgross_>
Does ocaml have type-case or something annoying like that? That is, why does ocaml complain about
<jgross_>
let singleton (x : 'a) : 'a list = x::[]
<jgross_>
module Stupid = struct
<jgross_>
type t = unit
<jgross_>
let foo : t list = singleton ()
<jgross_>
end;;
<jgross_>
?
<mrvn>
What do you want to do with an unit list?
<mrvn>
and ocaml doesn't complain.
<rks`>
jgross_: it doesn't complain for me.
<mrvn>
val singleton : 'a -> 'a list = <fun>
<mrvn>
module Stupid : sig type t = unit val foo : t list end
tulloch has joined #ocaml
manizzle has quit [Ping timeout: 246 seconds]
ollehar has joined #ocaml
baz_ has joined #ocaml
yezariaely has quit [Quit: Leaving.]
ggole has quit []
manizzle has joined #ocaml
mildfate has joined #ocaml
nikki93 has quit [Remote host closed the connection]
noplamodo has quit [Ping timeout: 245 seconds]
noplamodo has joined #ocaml
noplamodo has quit [Changing host]
noplamodo has joined #ocaml
cesar_ has joined #ocaml
tulloch has quit [Ping timeout: 264 seconds]
cesar_ is now known as Guest24470
Drup has quit [Quit: Leaving.]
nikki93 has joined #ocaml
Guest24470 has quit [Ping timeout: 245 seconds]
<jgross_>
Sorry, bad example. Here's one that actually errors: https://gist.github.com/JasonGross/7551528 If I define const_list as (fun x y -> gen... x y) rather than as gen..., then it works fine. Wtf?
<mrvn>
jgross_: That is called lifting and solves the value problem
<jgross_>
What's the value problem?/Do you have a webpage I can read about it?
<rks`>
jgross_: he's speaking of the value restriction (and what he calls lifting is eta-expansion)
<rks`>
But seeing the error message you get, I'm not sure it's related (i.e. I'm confused)
skchrko has quit [Quit: Leaving]
<mrvn>
The error is strange indeed.
yacks has joined #ocaml
<mrvn>
But I think using const_list cause ocaml to infere the type for it and that makes const_list : int -> t -> t list. That would mean t is used before and outside the module it is defined.
<mrvn>
With eta-expansion the extra args are lifted out so the type stays polymorphic.
mildfate has quit [Read error: Connection reset by peer]
<jgross_>
But I explicitly annotate const_list as int -> 'a -> 'a list. How can it choose a different type?
mildfate has joined #ocaml
<mrvn>
jgross_: that doesn't make it that type. That only hints what type it should be. The annotation is unified with the actual type.
Sim_n has joined #ocaml
<mrvn>
# let (add : 'a -> 'a -> 'a) = fun x y -> x + y;;
<mrvn>
val add : int -> int -> int = <fun>
<mrvn>
the ( + ) causes a more specific type to be infered but that can be unified with 'a -> 'a -> 'a
<rks`>
mrvn: your explanation makes sense
<jgross_>
That seems poor. Is there any way to say "error if I specify a polymorphic type and you can't give me the one I asked for"?
<mrvn>
rks`: Those "type escapes" errors are always a huge pain
Simn has quit [Ping timeout: 252 seconds]
_andre has quit [Quit: leaving]
Xenasis has quit [Remote host closed the connection]
<mrvn>
jgross_: make an mli file or a module with sig
eikke has quit [Read error: Operation timed out]
<def-lkb>
(to enforce a polymorphic type: const_list: 'a. int -> 'a -> 'a list ?)
Xenasis has joined #ocaml
<mrvn>
# let (add : 'a. 'a -> 'a -> 'a) = fun x y -> x + y;;
<mrvn>
Syntax error: ')' expected, the highlighted '(' might be unmatched
<jgross_>
But, like, I can do
<jgross_>
let id : 'a -> 'a = fun x -> x
<jgross_>
let foo : unit =
<jgross_>
ignore(id 1);
<jgross_>
ignore(id "a")
<jgross_>
and I wouldn't expect to be able to do this if ocaml just blindly picked a less polymorphic type.
<mrvn>
jgross_: it doesn't do it blindly. Only with the value restriction
<jgross_>
What's the value restriction?
<mrvn>
google it
wormphlegm has joined #ocaml
cricri has quit [Remote host closed the connection]
<jgross_>
Is there an example anywhere of why the value restriction is desired?
<mrvn>
it prevents the type inference from infering a wrong type.
<rks`>
jgross_: # let id : 'a -> 'a = let x = ref None in (fun v -> x := Some v ; v);;
<rks`>
val id : '_a -> '_a = <fun>
wormphlegm has quit [Ping timeout: 272 seconds]
chambart has quit [Ping timeout: 272 seconds]
<ddosia>
hey guys, could someone give few successful projects written in ocaml?
<ddosia>
what is "toplevel" thing is? I always see that in the book
<orbitz>
ddosia: usually the name for where you type in the repl
<ddosia>
utom in my case?
<ddosia>
*utop
jgross_ has left #ocaml []
<orbitz>
yes
<orbitz>
ddosia: it could also be the outter most level in a file
mildfate has joined #ocaml
Yoric has joined #ocaml
mildfate has quit [Read error: Connection reset by peer]
mildfate1 has joined #ocaml
nickmeha1ry is now known as nickmeharry
Eyyub has quit [Ping timeout: 246 seconds]
<ddosia>
is it possible to alter ocaml syntax with some libraries? I am concerned that if I include some libs, they witll add some syntax sugar and I will not notice that
<flux>
no, that's not possible. you need to specifically take syntax modifications into use.
nikki93 has quit [Remote host closed the connection]
wormphlegm has joined #ocaml
rand000 has joined #ocaml
wormphlegm has quit [Read error: Operation timed out]
nikki93 has joined #ocaml
aa47f8 has quit [Quit: aa47f8]
cesar_ has joined #ocaml
cesar_ is now known as Guest74059
Guest74059 has quit [Ping timeout: 272 seconds]
jonludlam has joined #ocaml
kyrylo has joined #ocaml
jonludlam has quit [Ping timeout: 246 seconds]
shinnya has quit [Ping timeout: 245 seconds]
bitemyap1 is now known as bitemyapp
baz_ has quit [Remote host closed the connection]
<gour>
shapr: are you the one i know from #haskell?
darkf has joined #ocaml
osa1 has joined #ocaml
klltkr has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Arsenik has quit [Remote host closed the connection]
wormphlegm has joined #ocaml
klltkr has joined #ocaml
Yoric has quit [Ping timeout: 252 seconds]
wormphlegm has quit [Ping timeout: 264 seconds]
mcclurmc has quit [Remote host closed the connection]
mildfate1 has quit [Quit: Leaving.]
mcclurmc has joined #ocaml
tane has quit [Quit: Verlassend]
tulloch has joined #ocaml
strobegen has quit [Quit: Leaving.]
nikki93 has quit [Remote host closed the connection]
mcclurmc has quit [Remote host closed the connection]
jonludlam has joined #ocaml
chambart has joined #ocaml
tulloch has quit [Ping timeout: 246 seconds]
mcclurmc has joined #ocaml
Yoric has joined #ocaml
tulloch has joined #ocaml
<ddosia>
any suggestions of opensource project which I could read as examples to get a good ocaml coding practice?
w0rm_x has quit [Ping timeout: 272 seconds]
<nicoo>
ddosia: If you want to learn about functors, have a look at On Tue, Nov 19, 2013 at 11:18:43PM +0100, Nicolas Braud-Santoni wrote:
<nicoo>
> I am not aware of instruction sets dedicated to speeding up hash
<nicoo>
> functions (unlike encryption with AES, for instance).
<ddosia>
I could create tuple without using parens like: 1, 2, 3;; But how could I create a tuple with one element with a same syntax?
tulloch has quit [Ping timeout: 246 seconds]
ThePawnBreak has joined #ocaml
tulloch has joined #ocaml
<ThePawnBreak>
let's say I want to reverse the result of a left_fold; is there any prettier way of doing it besides: rev (Llist.left_fold arg1 arg2 arg3) ? basically, I'd like to get rid of the paranthesis
habnabit is now known as _habnbait
<nicoo>
ddosia: A tuple with one element is ... the element itself.
mort___ has quit [Quit: Leaving.]
_habnbait is now known as _habnabit
pango_ has joined #ocaml
pango has quit [Ping timeout: 272 seconds]
ThePawnBreak has quit [Ping timeout: 245 seconds]
<ddosia>
nicoo: it is little bit wired for me; I know that one element tuple is meaningless in general, but...
<ddosia>
one more thing, why when my function is recursive I need to put "rec" keyword? I think compilator should be wise enough to understand that without hints
<ddosia>
*compiler
<bernardofpc>
I guess this is because sometimes let x = x + 1 makes sense
<bernardofpc>
(and at that point, you don't want "rec")
<bernardofpc>
(but it might be hard to decide if it is meaningfull or not to have a "rec" for each definition)
oriba has joined #ocaml
<nicoo>
ddosia: The compiler could infer automatically. However, idiomatic OCaml code uses a lot shadowing (redefining a new binding for an existing variable name)
mildfate has joined #ocaml
<nicoo>
and often in things like « let x = f x »
zpe has joined #ocaml
<nicoo>
as bernardofpc mentionned
<nicoo>
(Also, I find it nice to have some explicit “warning” that I'm looking at a recursive definition)
rand000 has quit [Quit: leaving]
chambart has quit [Ping timeout: 252 seconds]
zpe has quit [Ping timeout: 265 seconds]
klltkr has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
w0rm_x has quit [Read error: No route to host]
w0rm_x has joined #ocaml
wormphlegm has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
jonludlam has quit [Remote host closed the connection]
w0rm_x has quit [Read error: No route to host]
w0rm_x has joined #ocaml
wormphlegm has quit [Ping timeout: 248 seconds]
Yoric has quit [Ping timeout: 252 seconds]
mcclurmc has joined #ocaml
kyrylo has quit [Read error: Operation timed out]
madroach has quit [Ping timeout: 264 seconds]
oriba has quit [Read error: Connection reset by peer]
talzeus has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
madroach has joined #ocaml
NoNNaN has quit [Remote host closed the connection]
BitPuffin has quit [Read error: Operation timed out]