<flux>
great work :). well, I hope it does get in.
contempt has joined #ocaml
<Unhammer>
oh, nice =D
chambart has joined #ocaml
contempt has quit [Remote host closed the connection]
chambart has quit [Ping timeout: 264 seconds]
contempt has joined #ocaml
<ggole>
bitonic: real world ocaml, probably
<bitonic>
ggole: I was looking for a quick reference rather than a book. but I ended up on the ocaml website and the reference is actually quite nice
appd has joined #ocaml
<ggole>
There are a few blog posts on the topic around
<ggole>
I've never been on the dark side to have need of them though :)
oscar_toro has quit [Ping timeout: 272 seconds]
_5kg has joined #ocaml
contempt has quit [Remote host closed the connection]
<hugomg>
bitonic: I would still recommend checking out the RWO book. You can skip the bits that are similar to Haskell and it gives some very useful explanations on libraries and things like that.
<bitonic>
ggole, hugomg: oki, thanks
<hugomg>
they also have instructions on setting up vim/emacs and utop
chambart has joined #ocaml
chambart has quit [Ping timeout: 244 seconds]
ggole has quit [Ping timeout: 240 seconds]
<hugomg>
I downloaded the source for some ocaml packages in opam and it appears lots of them have these 7K line setup.ml files generated by oasis inside version control. Whats the deal with that?
ggole has joined #ocaml
<whitequark>
that's how oasis works
<adrien>
actually no
<whitequark>
correction: that's how most people use oasis.
<adrien>
I'd say that's how github works
Hannibal_Smith has joined #ocaml
<whitequark>
adrien: you can upload your own source archives to github
<adrien>
even though I heard there's a way to make release tarballs
<whitequark>
just most people can't be arsed to
<adrien>
but people don't use that, like never
<pippijn>
I think you can even upload release binaries
<whitequark>
that's what I'm saying
<hugomg>
yes wou can attack arbritrary .zip files in github releases. I just think its weird seeing these computed generated files in version control :/
<pippijn>
I agree
nicoo has quit [Remote host closed the connection]
rand000 has joined #ocaml
nicoo has joined #ocaml
ebzzry has quit [Remote host closed the connection]
AlexRussia has joined #ocaml
AltGr has left #ocaml [#ocaml]
appd has quit [Quit: Leaving...]
chambart has joined #ocaml
thomasga has joined #ocaml
chambart has quit [Ping timeout: 245 seconds]
Hannibal_Smith has quit [Quit: Leaving]
contempt has joined #ocaml
Yoric has joined #ocaml
Yoric has quit [Ping timeout: 265 seconds]
willy_ has joined #ocaml
ontologiae has joined #ocaml
wwilly has quit [Ping timeout: 272 seconds]
<hugomg>
I want to make it easier for other people to build my ocaml app, specially the "download dependencies" bit, but really want to support both windows and linux. Do I suck it up and package my app for both opam and godi or is there an easier alternative?
<whitequark>
opam for windows will be available soon
<hugomg>
soon or soon(tm)? :P
<hugomg>
btw, in my case I am just building a single executable and not installing any libraries
<hugomg>
do I leave the "remove" field in the opam package description blank?
<adrien>
I still have large doubts about opam on windows
<adrien>
sure opam.exe will be there
<adrien>
but that doesn't mean the packages will build
<adrien>
and that's 90% of the work
<whitequark>
that's work that anyone can do
<ddosia>
Help me to pick right datastructure. I have a grid of values of constant width and height, and I need to calculate new grid of the same size. Calculation of each cell's value will be based on it's surroundings. Currently I stick with array of arrays. But it's mutable
<adrien>
whitequark: you're optimistic :)
<hugomg>
wodi comes bundled with cygwin. even if opam ends uop needing the same then its already an improvement for the windows istuation
<whitequark>
hugomg: opam already works perfectly on cygwin.
<whitequark>
the entire discussion is about cygwinless builds
<hugomg>
hmm, I heard some people here saying that it didn't work fine under cygwin
<hugomg>
I guess it must have gotten better recently
<whitequark>
cygwin is just a unix
BitPuffin has joined #ocaml
<adrien>
I call cygwin "posixish"
<adrien>
(and msys posixishish
<adrien>
)
<hugomg>
ah, but "just an unix"is still very complicated. I never trust things to work flawelessly on cygwin/wine like that :)
<adrien>
saying that something works or not on cygwin is usually meaningless
<whitequark>
wine? how's wine related?
<hugomg>
but I'll git cygwin a shot. DO I use the opam_installer.sh script?
<adrien>
"on cygwin" could mean the application is built using cygwin but will run without it, or that it's built using cygwin and will require cygwin to run
<whitequark>
I don't know anything about the script, I build it the usual way
<adrien>
the two are very different and "on cygwin" is not enough to disambiguate
pyon is now known as Guest31565
dav has quit [Read error: Connection reset by peer]
<adrien>
if cygwin were as simple as a unix, the girl in the jurassic park ought to be able to do our builds!
Guest31565 has quit [Read error: Connection reset by peer]
<hugomg>
well, when I built my app executable under godi it ran fine on machines without cygwin installed
<whitequark>
i.e. ./configure && make lib-ext && ./configure && make && make install
<hugomg>
whitequark: by "the usual way" do you mean build opam from source?
<whitequark>
exactly
<hugomg>
if so, what ocaml compiler do you use to do that. theres like 20 different alternatives on windows :/
pyon has joined #ocaml
<adrien>
hugomg: well, depending on cygwin is usually just cygwin1.dll
<adrien>
but what I mean is slightly different
Guest470 has joined #ocaml
<adrien>
that "opam works on cygwin" doesn't tell whether the final binaries will depend on cygwin or not
<adrien>
getting opam to work on cygwin while producing binaries that depend on cygwin has probably worked for a long time
<adrien>
and what what compiler?
lordkryss has quit [Quit: Connection closed for inactivity]
<hugomg>
what what?
<adrien>
15:20 hugomg : if so, what ocaml compiler do you use to do that. theres like 20 different alternatives on windows :/
<adrien>
there's msvc, cygwin and a version which runs on cygwin and which output doesn't depend on cygwin
<adrien>
remove msvc
<adrien>
because
<adrien>
and for the two others, it should be quite obvious what you'll get
<adrien>
but I can't tell what will work for your usecase
<hugomg>
I want to be able to write a full "how to build my library" page for other developers. Right now it "download wodi. it comes with cygwin and the ocaml compiler. then, download X Y Z dependencies by hand and run my makefile". I want to change it to "isntall cygwin, install opam, run X command, dependencies are downloaded for you and thigns get appropriately compiled"
<hugomg>
but to install opam you need an ocaml compiler. since Im not using wodi anymore, what ocaml compiler do I get instead?
kapil__ has quit [Quit: Connection closed for inactivity]
samrat has quit [Ping timeout: 240 seconds]
<ggole>
If it's in opam, you can probably reasonably leave it up to them to figure out opam
<ggole>
Maybe point at the opam docs
<ggole>
Frankly, if they are developers they are going to be pretty used to installing random bits and pieces...
<flux>
if it's an ocaml library, then perhaps it's not required to instruct how to install ocaml..
<flux>
if it's a tool written in ocaml, then I would think that installation instructions for ocaml may be in order.
<ggole>
Hmm, yes. Due to hugomg's use of "other developers" I'd assumed the former.
<hugomg>
Due to my problem domain there is a good chance potential contributors are on windows and aren't super familiar with opam/ocaml so I want to make everything as frictionless as possible
<hugomg>
yes, its a tool writen in ocaml
samrat has joined #ocaml
<hugomg>
going back on track I'm getting a bit worried about that issue adrien pointed out a bit earlier. Apparently, wodi builds the ocaml compiler against mingw in a way that the generated executables dont need cygwin to run, only to build. On the other hand, the official ocaml distribution, which is what I assume opam would end up using to build my things generates executables that DO require cygwin to run (which could potentially be a deal
<hugomg>
breaker)
<ggole>
That seems awkward indeed.
Yoric has joined #ocaml
<adrien>
I don't know for the latest release of ocaml but there used to be binaries for (oh, clear sky!) which didn't require cygwin
<ggole>
Maybe you can ask the opam people whether it can be instructed to use the other compiler.
<adrien>
but you also need to understand this is caused by the C toolchain mostly
<adrien>
so depends on the ld used
Yoric has quit [Remote host closed the connection]
bitonic has quit [Ping timeout: 272 seconds]
contempt has quit [Remote host closed the connection]
<Drup>
it's just not the default, for various reasons
<whitequark>
I dunno, dynlink sounds ok to me
<Drup>
It doesn't make much sense, you have everything statically, you just play with side effect timing with dynlink ...
<whitequark>
oh
<whitequark>
I see
<Drup>
in theory, you could swap an implementation of ocsipersist with another at configure (ie. startup of the server) time, but nobody does that anyway
<hugomg>
drup: nice hack with the setup.ml on different branches hahaha.
<Drup>
It's not even a branch, it's an abandoned commit =')
<Drup>
I never push the branch
chambart has quit [Ping timeout: 244 seconds]
thomasga has quit [Quit: Leaving.]
aviraldg has quit [Quit: Leaving]
thomasga has joined #ocaml
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
chambart has joined #ocaml
chambart has quit [Ping timeout: 276 seconds]
strmpnk_ has joined #ocaml
bytbox has quit [Read error: Connection reset by peer]
bytbox has joined #ocaml
Valda has joined #ocaml
tokenrov1 has joined #ocaml
deavid has joined #ocaml
xiaolin_ has joined #ocaml
adrien_ has joined #ocaml
acieroid` has joined #ocaml
wting has joined #ocaml
samrat_ has joined #ocaml
dmbaturin_ has joined #ocaml
hbar_ has joined #ocaml
kandu_ has joined #ocaml
thorsten1 has joined #ocaml
AlexRussia has quit [*.net *.split]
_whitelogger_ has joined #ocaml
kandu has joined #ocaml
kandu is now known as Guest60314
hcarty has joined #ocaml
j0sh has quit [Ping timeout: 245 seconds]
tokenrove has joined #ocaml
Rebelion has quit [*.net *.split]
larhat has quit [*.net *.split]
waneck has quit [*.net *.split]
Haudegen has quit [*.net *.split]
sol__ has quit [*.net *.split]
nicoo has quit [*.net *.split]
NoNNaN has quit [*.net *.split]
emery has quit [*.net *.split]
j0sh has joined #ocaml
joncfoo has joined #ocaml
brendan has quit [Ping timeout: 255 seconds]
_5kg has quit [Ping timeout: 255 seconds]
cdidd has quit [Ping timeout: 255 seconds]
brendan has joined #ocaml
robink_ has joined #ocaml
patronus has joined #ocaml
waneck has joined #ocaml
Haudegen has joined #ocaml
divyanshu has joined #ocaml
c74d has joined #ocaml
chris2 has joined #ocaml
21WAAPQFW has joined #ocaml
dch has quit [Ping timeout: 265 seconds]
flux has joined #ocaml
21WAAPQFW has quit [Ping timeout: 265 seconds]
voglerr1 has joined #ocaml
majoh has joined #ocaml
Sim_n has quit [*.net *.split]
trystero has quit [*.net *.split]
dch_ has joined #ocaml
bjorkintosh has joined #ocaml
PM` has joined #ocaml
Intensity has quit [Ping timeout: 244 seconds]
pyon has quit [*.net *.split]
robink has quit [*.net *.split]
IbnFirnas has quit [*.net *.split]
averell has joined #ocaml
adrien has joined #ocaml
badon has joined #ocaml
igitoor has joined #ocaml
Intensity has joined #ocaml
stux|away has joined #ocaml
IbnFirnas has joined #ocaml
Intensity has quit [Max SendQ exceeded]
msch has joined #ocaml
fraggle__ has quit [Ping timeout: 272 seconds]
c74d has quit [Read error: Connection reset by peer]
Leonidas has joined #ocaml
kalzz has joined #ocaml
sol__ has joined #ocaml
strmpnk_ has joined #ocaml
pyon has joined #ocaml
Intensity has joined #ocaml
rfv has joined #ocaml
rfv has quit [Changing host]
lopex has joined #ocaml
lopex has quit [Changing host]
__marius______ has quit [Changing host]
__marius______ has joined #ocaml
Leonidas is now known as Guest51890
struk|dtut has quit [Changing host]
struk|dtut has joined #ocaml
andreypopp__ has joined #ocaml
andreypopp__ has quit [Changing host]
divyanshu has quit [Changing host]
divyanshu has joined #ocaml
marynate has joined #ocaml
fraggle__ has joined #ocaml
dch_ has quit [Changing host]
dch_ has joined #ocaml
dch_ has quit [Changing host]
dch_ has joined #ocaml
IbnFirnas has quit [Changing host]
IbnFirnas has joined #ocaml
Guest51890 is now known as Leonidas
msch has quit [Changing host]
msch has joined #ocaml
Leonidas has quit [Changing host]
Leonidas has joined #ocaml
strmpnk_ is now known as strmpnk
c74d has joined #ocaml
gdsfh has joined #ocaml
gdsfh1 has quit [Ping timeout: 245 seconds]
testcocoon has joined #ocaml
marynate has quit [Quit: Leaving]
igitoor has quit [Changing host]
igitoor has joined #ocaml
cartwright has joined #ocaml
travisbrady has joined #ocaml
NoNNaN has joined #ocaml
emery has joined #ocaml
travisbrady has quit [Quit: travisbrady]
Hannibal_Smith has joined #ocaml
nicoo has joined #ocaml
mcc has joined #ocaml
lordkryss has joined #ocaml
oscar_toro has joined #ocaml
travisbrady has joined #ocaml
NoNNaN has quit [Ping timeout: 250 seconds]
_5kg has joined #ocaml
AlexRussia has joined #ocaml
tharugrim has quit [Ping timeout: 256 seconds]
tharugrim has joined #ocaml
struk|dtut has quit [Ping timeout: 246 seconds]
travisbrady has quit [Quit: travisbrady]
AlexRussia has quit [Read error: Connection reset by peer]
dch_ is now known as dch
joncfoo has quit [Ping timeout: 240 seconds]
AlexRussia has joined #ocaml
<mcc>
Hiii um. Okay. I'm getting a somewhat alarming problem
<mcc>
I'm running this code http://pastie.org/9791716 and getting the error "This kind of expression is not allowed as right-hand side of `let rec'"
averell has quit [Changing host]
averell has joined #ocaml
<mcc>
it's applying to what, in the pastie, is "and tern = snippetTextClosure"
<ggole>
mcc: yep, let rec has some restrictions - essentially, you can't do arbitrary applications during the let rec
<mcc>
…okay
<mcc>
i feel like ocaml kind of forced me to put all these different expressions into one big … and … and … and stanza and now it's saying i can't do some things in there?
<mcc>
i found a description of the let rec limitation but i'm hvaing a lot of trouble understanding how they apply to this case
<ggole>
Let me look at it a bit more closely.
<mcc>
and in particular why it's complaining about, say, tern but not rawTern
<ggole>
Usually the answer is to find which parts don't need to be within the mutual recursion and move them out
<mcc>
well…
<mcc>
i mean none of this was mutually recursive half an hour ago
<mcc>
however then tableBlank picked up a call to makeHas and suddenly i had this entire ball of spaghetti pulled into one big stanza (is stanza the term?)
<ggole>
Hmm
struktured has joined #ocaml
<ggole>
You could hack around it easily enough :/
<ggole>
(By introducing a ref for makeHas to point at, and populating it after the let rec.)
<ggole>
That's a bit squishy though.
<mcc>
ugh
<mcc>
aren't there performance penalties associated with ref?
<mcc>
or is that only when writing?
eyyub has joined #ocaml
<mcc>
But it does look like, yeah, this is the sort of thing let rec is not supposed to allow? D: I still don't understand what rule I broke
<ggole>
There would be an access to pull out the contents.
<mcc>
StackOverflow said to look at the language definition and it's… … i think i need a book on compiler theory to understand this
<ggole>
It's pretty cheap.
<mcc>
okay.
<hugomg>
if you are defining a cyclic structure you need to use a ref one way or the other. In haskell, the reason you can use tie the knot for everything is that everything is a thunk with an implicit ref underneath
<ggole>
As for the rule: basically when you say let rec thing = f x ..., you are in trouble
<ggole>
It's the *application* that is the difficulty
<ggole>
(Function application. Constructors are OK.)
<mcc>
guh
<mcc>
i'm not… i've never written haskell. i'm used to C.
<mcc>
C gets around this by just having a link phase.
<hugomg>
tbh, C and most other languages don't even have let rec
<ggole>
mcc: the problem is that if you run a function, and it refers to one of the let rec bindings, it may not exist yet.
<hugomg>
and they solve similar issues by using mutable references
<mcc>
every c application is a let rec :P
<ggole>
So function applications are ruled out within a let rec.
<mcc>
ggole: urrg ok so i think that actually does make sense
<ggole>
Unfortunately there are reasonable programs that are also ruled out.
<ggole>
(Yours looks like one of those.)
<hugomg>
C functions can be used recursively inside themselves but the problem is the general case, when you have more than one mutually recursive function
<hugomg>
in C you have to do that with foward declarations
<mcc>
i like forward declarations
<mcc>
they seem like a good feature
<mrvn>
mcc: only for call-by-name
<ggole>
mcc: so my suggestion is to introduce let x = ref [] above the whole mess, turn the list ["rawHas",rawHas;"tern",tern;"obj",obj] into !x, and assign the right value to the ref afterwards.
jabroney has joined #ocaml
<hugomg>
but forward declarations only work for functions don't they? Can you build a cyclic data structure in C without using any assignment statements?
<mrvn>
hugomg: they also work for variables and you can
<ggole>
Heh. In C you can do anything. int x = x;. Go nuts.
Arsenik has quit [Remote host closed the connection]
<mcc>
hugomg: so in c, a data structure built without assignments is done with nesting. right? you obviously can't / don't want to build a nested recursive data structure.
<mrvn>
A structure can't be recusive.
<mcc>
right.
<mrvn>
You can only include a pointer
<mcc>
a structure with pointers can.
<mcc>
pointers is how you build structures in C.
<mcc>
the bigger issue in c is that the sort of "static declaration time" where all this stuff is happening in ocaml doesn't in a meaningful sense exist in C.
<mrvn>
foo = { 1; 2; { 3; 4; &foo.bla; }; };
<mcc>
or rather it exists, but it isn't well-defined and should never be safely used.
<ggole>
In C99 you can do it fairly directly, I believe.
<mrvn>
In C you declare a type, in ocaml you declare bindings to existing values.
<mcc>
ggole: that is *terrifying*.
<jabroney>
New to OCaml. Trying to run mirage demos on OSX (yosemite). Running into issues with getting camlp4 install (ocaml = 4.02.1). Can someone point me in right direction (eg other irc channel, url, keywords to search)? Go to 4.00? Thx.
<ggole>
mcc: you mean you prefer [0; 1]? :)
<ggole>
Because of lifetime issues this trick isn't actually terribly useful.
<mcc>
i prefer dynamic languages :P where we get around this by simply nothing being typesafe.
<hugomg>
jabroney: are you using opam?
<mcc>
but i don't usually get what i prefer :P
<jabroney>
hugomg: yes
Anarchos has joined #ocaml
<mcc>
anyway i'm trying that weird reference knot tying trick, thank you :O
<hugomg>
are you using the "system" switch or a opam-installed 4.02?
c74d has quit [Remote host closed the connection]
<ggole>
Shame it's necessary :(
<ggole>
Ah well, software ain't usually pretty.
travisbrady has joined #ocaml
<mcc>
i'm maybe not expecting it to be ^_^;
<ggole>
Low expectations, excellent. Keeps the disappointment to a minimum.
<mcc>
although i am curious if this problem was avoidable, and i have a bunch of vague questions about what this all implies about memory layout in an ocaml program i don't know how to formulate just now
* ggole
cries into his pillow
<mcc>
I mentioned my day job is writing C++, right? My expectations are VERY low.
<hugomg>
iirc these limitations on let rec have to do with ocaml being a strict language. its a bit similar to the value restriction
<ggole>
mcc: hmm, there are other ways to "tie the knot". You could pass the thing as an argument, basically threading it through the whole mess.
<ggole>
You could make the bits lazy (I think?) although this is a bit strange and has some runtime costs.
<mcc>
yeah i only just found out lazy is a keyword in this language
<hugomg>
jabroney: run the "opam switch" command it should say what switch you are using
<mcc>
really, the only problem with the ! trick is maybe (??) inefficiency, and i really, REALLY should not be worrying about that in this place
<mcc>
so i'm just being whiny
<hugomg>
opam can keep multiple package databases in parallel with a different compiler version and packages on each
<jabroney>
Ah, thx. Yes, system (4.02.1). I should switch to another version? 4.00?
<hugomg>
I'd recommend first switching to an opam-installed 4.02 by running "opam switch 4.02.1". This will compile and build the ocaml compiler from source
<mcc>
"Error: The type of this expression, '_a list ref, contains type variables that cannot be generalized" <<-- I think I know what this means, but what's odd to me is that both this and the let rec illegal right side error are being caught by ocamlbuild but merlin is just shrugging and saying they're correct
<hugomg>
for some reason opam doesn't play super nice with the system compiler and sometimes fails to resolve dependencies on it. don ask me why though :/
<ggole>
mcc: nuts, I forgot about that.
<ggole>
You can work around it by ascribing a type. :(
<mcc>
yeah, that's what i'm doing. just trying to remember the syntax * _ *
<ggole>
let x : (string * foo) list ref = ref []
<ggole>
Where foo is... whatever that thing is.
<hugomg>
mcc: the problem is that when you write "ref []" the compiler can't infer if its a list of strings or a list of ints. If you naively type this as "'a list ref" than both "x := [1]" and "x := ["hello"]" would be valid, which would be a hole in the type system
<hugomg>
because of this, ocaml gives it a type of "'_a list ref", which is a bit more restricted
<mcc>
yes, that makes sense :O
<mcc>
ggole: also thanks, i was adding parenthesis in the wrong place * _ * i really do like ocaml but the syntax could be more predictable.
<mcc>
what exactly does the _ mean in a type expression?
<ggole>
In '_a?
<mcc>
does _ always mean something in a type name, or is _a a special identifier?
<mcc>
yeah
<ggole>
It means that the type variable isn't polymorphic
<mcc>
mm
<ggole>
It has one single type, which is not yet known.
<mcc>
i see :O
<ggole>
The problem with allowing these types at the top-level of a module is that there's no way to make sure that the single type is used consistently
<mcc>
Hm. No. Back to where I started. http://pastie.org/9791778 "This kind of expression is not allowed as right-hand side of `let rec'" on tern =
<mcc>
is the problem now the invocation of snippetText?
<mcc>
maybe i should just knot out makeHas altogether.
<mcc>
that would be more readable code, anyway.
<whitequark>
you can
<whitequark>
*can't do arbitrary let rec bindings
c74d has joined #ocaml
<mcc>
yes, this has been explained
<whitequark>
oh, ok
<mcc>
what i don't understand is which ones i can't do :P
<ggole>
mcc: oh yeah, you'll have to remove those bits from the and
<jabroney>
hugomg: Got it working. You rock!
<mcc>
the spec is a big bunch of type theory
<mcc>
ggole: which bits? tern and rawhas?
<hugomg>
jabroney: glad that worked. if it didn't then I'm a total camlp4 and mirage noob :P
<ggole>
mcc: yep, anything which is an application
<hugomg>
and wouldn't be able to think of anything else
<ggole>
(not makeHas though)
<mcc>
ggole: i think makeHas will have the same problem as tern, when i get there
<ggole>
It's a function, so it should be ok
<mcc>
ggole: ok so… "anything which is an application". you mean that something like let rec a x = a None and b x = a x … that's not allowed?
<ggole>
The problem is things like let thing = f x
hbar_ has joined #ocaml
<whitequark>
think how it should be compiled
<mcc>
oh.
<ggole>
In order to get that value, an application (of f to x) has to happen
<ggole>
Where let thing x = ... is fine
<mcc>
… oh. okay. i now understand what you were recommending earlier
<ggole>
Because thing is just a value.
<mcc>
wow, this is a pretty indirect way of solving the problem :O
<hugomg>
another way to look at it is that "let recs" and refs only play nice with things that are obviously values and not the result of a computation. This means that Constructors and fucntion definitions are OK but function application is not
<ggole>
mcc: yeah, doesn't really score too high on comprehensibility.
<ggole>
People get pretty confused about the value restriction, too.
<ggole>
I certainly was when I first started learning OCaml.
<hugomg>
btw, I have to say I'm really disapointed at wikipedias article on the value restriction. I was gonna link it but that stub is not worth the trouble :/
<mcc>
it compiles! :O
<ggole>
\o/
<Drup>
mcc: about the type variables that can't be generalized
<mcc>
whitequark: i don't… think i know how it's compiled D: i agree it would help if i did
<Drup>
it's hard for merlin to detect such things, since the error is reported only if the variable hasn't been generalized at the end of the file
<ggole>
I like OCaml, but it is a shame that there are these hoops to be jumped through.
<Drup>
but merlin works chunk by chunk
<Drup>
(note that the "end of the file" is slightly arbitrary, you could make a difference choice, but this is the one that was made for the sake of separate compilation)
<ggole>
I remember being confused that such definitions "worked" in the toplevel and failed to compile.
<hugomg>
to be fair, you aren't the first one to come across this hoop and the original programmers who ran across it had the joy of experiencing segfaults instead of a compiler error message :)
<whitequark>
mcc: I mean just how it would be executed
<ggole>
Guess I've internalised a workable model of most of the machinery by now.
<whitequark>
if you need to compute the value of b in order to compute the value of a, which requires computing the value of b
<mcc>
whitequark: right. that
<mcc>
yeah i think i sorta get why it's there now D:
<whitequark>
you can't really initialize them unless you have something like a constraint-based solver that works on a symbolic model
<ggole>
Or graph reduction (which is why this works in Haskell).
<whitequark>
and even IF you had one, you couldn't use any side effects there
<Drup>
it's the same with every language, you end up knowing the crappy parts and know how to work around them :p
<ggole>
But then you aren't a strict functional language.
<whitequark>
because they'd be totally unpredictable
<mcc>
but it's still WEIRD
<mfp>
don't know if anybody has mentioned it yet, but you can get around the let rec restriction with lazy
<ggole>
It makes more sense if you write something obviously wrong, like let rec a = b + 1 and b = a + 1
<hugomg>
i think thats what ggole was mentioning when he talked about Haskell and graph reduction
<ggole>
Then you can write something more reasonable that also doesn't type check, like let rec a = b and b = 1, and maybe the nature of the restriction and why it sometimes looks silly will become a bit clearer
<mrvn>
ggole: That code makes no sense. Just replace a with b everywhere
<ggole>
...
<mrvn>
'let rec a = ref b and b = 1' would make sense
vfoley- has joined #ocaml
<vfoley->
I'm trying to `opam upgrade`, but I fail on upgrading utop to 1.17. There is an error about the identifier OCAML_VERSION not being defined. I'm using OCaml 4.02.1 and opam 1.1.1.
<whitequark>
that's very odd
mcc has quit [Quit: This computer has gone to sleep]
<ggole>
mrvn: that actually compiles... hmm
<ggole>
Wonder if the ref constructor is special cased? I thought it was just an ordinary application.
mcc has joined #ocaml
<mrvn>
ggole: because a just takes the address of b but does no computation
<mrvn>
ggole: must be special cased
<ggole>
If you let f x = ref x and use f instead of f, it does not compile.
<ggole>
So there's a special case. Interesting.
<mrvn>
ggole: !f is not allowed
<ggole>
Er, f instead of ref.
<mrvn>
Oddly though ref is a function: # ref;;
<mrvn>
- : 'a -> 'a ref = <fun>
<whitequark>
of course it's a function
<ggole>
So are things like (&&) (which doesn't have short-circuiting behaviour unless you apply it directly)
<ggole>
OCaml is a bit funky that way
<mrvn>
ggole: && is a keyword
<hugomg>
but its weird that "a + b" is equivalent to "(+) a b" but "a && b" isnt equivalent to "(&&) a b"
<mcc>
so one thing i notice is that moving things from one module to another in ocaml involves a LOT of refactoring. i wonder if that is a thing Merlin could partially automate.
<whitequark>
Reventlov: opam install base-unix
<ggole>
Try it with (if true then (&&) else (||)) false (print_endline "x"; false)
<ggole>
And what a nonsense that is.
<Reventlov>
whitequark: Ok, i'm doing that. But why is this not in the dependencies ?
<whitequark>
Reventlov: base-unix is installed by default
<whitequark>
but you have a good point, it should be
<whitequark>
you certainly did not do it deliberately
<mrvn>
mcc: some people do that. They define a recursive helper function with more args and then the real function by the same name that adds the initial args
<whitequark>
I had that myself, I have absolutely no idea how it happens
<Reventlov>
meh.
<ggole>
Reventlov: opam switch will "uninstall" packages (but not really)
pothepanda has quit [Quit: Leaving]
<Reventlov>
so there are no "defaults" packages in a brand new switch ?
<ggole>
Nope.
<Reventlov>
Ok.
<mcc>
reventlov: it's a little bit like a python virtualenv or a Ruby RVM, I think.
<ggole>
There's some trick to asking opam to go and get all of your packages, but hell if I can remember what it is.
<mcc>
I have true: debug in my _tags. I am building my program .native with ocamlbuild. i then invoke it with OCAMLRUNPARAM=b ./package/emily ./sample/trivial.em ...
<mcc>
"bytes.ml" is not my file. How should I proceed?
<mcc>
ggole: also thanks
<whitequark>
mcc: step 1: build a .byte.
<mcc>
...you know it's interesting, debug in the tags never seems to do anything…
<whitequark>
debug in tags gives you the stacktrace you see
<whitequark>
without debug, you will just see (Program compiled without -g)
<mcc>
whitequark: no, i mean, if i compile without debug, and run with OCAMLRUNPARAM=b, i still get a stack trace
<mcc>
if i build the .byte, will that be an executable command line program or a thing i have to like… run with ocaml at the command line, or something?
<ggole>
You can just run it
<whitequark>
it will look exactly same.
<mcc>
cool
<whitequark>
it will just be slower
<ggole>
(It contains a copy of all the ocamlrun junk.)
<mcc>
understood
<mcc>
yay! i have a stacktrace.
<mcc>
also it appears the debug tag is required for stacktraces if you build a .byte but not a .native.
<whitequark>
I've just checked and you still need -g for native stacktraces.
<mcc>
whitequark: i am absolutely getting native stacktraces without -g, so if you are correct, then there is a bug.
<whitequark>
perhaps you use some stale executable, have -g elsewhere, or have OCAMLPARAM=g=1,_ set
<mcc>
stale executable is possible, i am cleaning tho
<mcc>
is it worth investigating this further later?
<whitequark>
not really
<mcc>
ok
<mcc>
"i'm getting something nice that i didn't ask for"
<mcc>
seems acceptable
<mcc>
ok i am gonna go get on the train now, thank you all so much for the help!!!
mcc has quit [Quit: This computer has gone to sleep]
lordkryss has quit [Quit: Connection closed for inactivity]
ontologiae has quit [Ping timeout: 258 seconds]
jabroney has quit [Quit: Leaving.]
<def`>
(checking merlin backlog)
<def`>
mcc is no longer there, but yep, merlin doesn't do module coercion, no errors about not respecting mli or having non generalized vars
manizzle has quit [Ping timeout: 264 seconds]
<def`>
(though that could be implemented... not sure it's a good idea)
<def`>
(from a UX pov at least)
ingsoc has quit [Quit: Leaving.]
seangrove has joined #ocaml
dpzmick has quit [Ping timeout: 252 seconds]
ebzzry has joined #ocaml
tani has joined #ocaml
oscar_toro has quit [Ping timeout: 245 seconds]
seangrov` has joined #ocaml
manud has quit [Quit: Be back later ...]
seangrove has quit [Read error: Connection reset by peer]
tane has quit [Killed (sendak.freenode.net (Nickname regained by services))]
tani is now known as tane
slash^ has quit [Read error: Connection reset by peer]
manizzle has joined #ocaml
joncfoo has joined #ocaml
ggole has quit []
NoNNaN has joined #ocaml
thomasga has quit [Quit: Leaving.]
rgrinberg has joined #ocaml
struktured has quit [Ping timeout: 258 seconds]
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
rgrinberg has quit [Quit: Leaving.]
joncfoo has quit [Ping timeout: 256 seconds]
nullcat_ has joined #ocaml
lordkryss has joined #ocaml
rgrinberg has joined #ocaml
nullcat_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
samrat has quit [Quit: Computer has gone to sleep.]
struktured has joined #ocaml
matason has quit [Ping timeout: 244 seconds]
demonimin has quit [Ping timeout: 272 seconds]
NoNNaN has quit [Remote host closed the connection]
nojb has joined #ocaml
rgrinberg1 has joined #ocaml
rgrinberg has quit [Read error: Connection reset by peer]
<whitequark>
nojb: why did you write your own utf-8 decoder?..
<nojb>
I did not
<whitequark>
what's worse is that you normalize neither input strings nor regular expressions
<whitequark>
*encoder
<nojb>
normalisation should be done by the user - that is also the appraoch taken by re2
<nojb>
you need to encode them manually because you want to translate ranges of unicode characters into (unions) of ranges of bytes
<nojb>
you can’t just encode each character separately
<whitequark>
imo the byte-centric approach you take is wrong
<whitequark>
why not convert everything to *characters* and match on them instead?
demonimin has joined #ocaml
<nojb>
it is mentioned in many places that hte library implementation is table based and so very dependent on the assumption that it is matching bytes so it can’t be abstracted over the char type easily
<nojb>
see the comment in issue #24 for example
<whitequark>
you can trivially generate decision trees along with tables instead
<nojb>
maybe, but this way is much easier because you just need to change the *compilation* of regexp, not the interepter
<nojb>
do you have any concrete downsides in mind ?
<nojb>
downsides to this approach that is
<whitequark>
are the indexes correct?
<nojb>
indexes ?
<whitequark>
yeah
<nojb>
what do you mean ?
<whitequark>
well, after matching a string, you get back an index of the first match
<nojb>
ah yeah they should be
<whitequark>
(for instance)
<nojb>
but more testing is necessary :)
<whitequark>
so is it measured in characters or bytes?
<nojb>
bytes
<nojb>
offsets are returned in bytes
<whitequark>
hrm
<whitequark>
that actually might be a more convenient behavior
<nojb>
yeah :)
<nojb>
please do comment in the PR if you can - it would be really helpful
<whitequark>
well, I don't have any more specific objections
<nojb>
in any case, the patch is not in final form there are a couple of outstanding issues (mostly explained in the PR)
joncfoo has joined #ocaml
<rgrinberg1>
nojb: you might want to include uutf to the opam file
<rgrinberg1>
to fix travis
tane has quit [Quit: Verlassend]
<nojb>
let me do that
<nojb>
it is not currently needed actually, so I removed it
nuki has joined #ocaml
xavierm02 has joined #ocaml
demonimin has quit [Ping timeout: 244 seconds]
<xavierm02>
Hi. In "let id x = x;; let id' = id id;;", id' has type '_a -> '_a. The way I understand it, the 'a because '_a because it was fixed to a given value because in "id id", the second id is seen as a "normal
<xavierm02>
"normal" term, as opposed to a function term and therefore has to have a given type.
matason has joined #ocaml
<xavierm02>
But why can't it keep its type 'a -> 'a ? Thanks in advance for your answers.