<seangrove>
Hey all, if you're using emacs + merlin + tuareg + utop, how do you start a web server (say cohttp) and still be able to update code in the process interactively, and inspect the server state?
<seangrove>
I know that's a preetty big process, but I'm struggling with this
AltGr has joined #ocaml
iorivur has quit [Ping timeout: 245 seconds]
Drup has quit [Ping timeout: 256 seconds]
Drup has joined #ocaml
badkins has quit [Remote host closed the connection]
lordkryss has quit [Quit: Connection closed for inactivity]
badkins has joined #ocaml
iorivur has joined #ocaml
q66 has quit [Quit: Leaving]
rgrinberg has joined #ocaml
taion809 has joined #ocaml
fold has quit [Quit: WeeChat 0.4.0]
fold has joined #ocaml
jao has joined #ocaml
jao has quit [Changing host]
jao has joined #ocaml
WraithM has joined #ocaml
tnguyen has joined #ocaml
tnguyen1 has joined #ocaml
ygrek has quit [Ping timeout: 240 seconds]
tnguyen has quit [Ping timeout: 246 seconds]
rgrinberg has quit [Quit: Leaving.]
cesar has joined #ocaml
cesar is now known as Guest50563
rgrinberg has joined #ocaml
Guest50563 has quit [Ping timeout: 260 seconds]
tnguyen1 has quit [Ping timeout: 244 seconds]
tnguyen has joined #ocaml
badon has joined #ocaml
ygrek has joined #ocaml
segmond has joined #ocaml
<seangrove>
In the line: let person = `Assoc [ ("name", `String "Anil") ] ;; , what are the ` ticks indicating?
<seangrove>
Nevermind, googled it
iorivur has quit [Ping timeout: 272 seconds]
manizzle has quit [Ping timeout: 246 seconds]
badkins has quit []
jao has quit [Ping timeout: 260 seconds]
deemo105 has joined #ocaml
darkf_ has joined #ocaml
darkf has quit [Disconnected by services]
darkf_ is now known as darkf
deemo105 has left #ocaml [#ocaml]
taion809 has quit [Remote host closed the connection]
larhat has joined #ocaml
gngrwzrd has quit [Quit: gngrwzrd]
simulacrum has joined #ocaml
lgm has quit [Ping timeout: 258 seconds]
iorivur has joined #ocaml
manizzle has joined #ocaml
larhat has quit [Quit: Leaving.]
philtom has joined #ocaml
cesar has joined #ocaml
cesar is now known as Guest70573
Guest70573 has quit [Ping timeout: 272 seconds]
ivan\ has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
axiles has joined #ocaml
iorivur has quit [Ping timeout: 245 seconds]
iorivur has joined #ocaml
darkf has quit [Ping timeout: 272 seconds]
WraithM has quit [Ping timeout: 260 seconds]
keen___ has joined #ocaml
keen__ has quit [Ping timeout: 245 seconds]
iorivur has quit [Ping timeout: 260 seconds]
claudiuc_ has quit [Ping timeout: 240 seconds]
iorivur has joined #ocaml
marchdown has joined #ocaml
marchdown has quit [Quit: marchdown]
marchdown has joined #ocaml
marchdown has quit [Client Quit]
darkf has joined #ocaml
marchdown has joined #ocaml
philtom has quit [Ping timeout: 244 seconds]
iorivur has quit [Ping timeout: 260 seconds]
cesar has joined #ocaml
cesar is now known as Guest82862
Guest82862 has quit [Ping timeout: 260 seconds]
marchdown has quit [Quit: marchdown]
tac_ has joined #ocaml
larhat has joined #ocaml
hhugo has joined #ocaml
meiji11 has quit [Remote host closed the connection]
Unhammer has joined #ocaml
Submarine has joined #ocaml
Submarine has quit [Changing host]
Submarine has joined #ocaml
iorivur has joined #ocaml
ygrek has quit [Ping timeout: 272 seconds]
tnguyen1 has joined #ocaml
tnguyen has quit [Ping timeout: 240 seconds]
hhugo has quit [Quit: Leaving.]
slash^ has joined #ocaml
zpe has joined #ocaml
willy__ has joined #ocaml
cago has joined #ocaml
willy_ has quit [Ping timeout: 245 seconds]
willy__ has quit [Remote host closed the connection]
c74d has quit [Read error: Connection reset by peer]
<seangrove>
I have to repeat the ("server", "ocaml") structure twice, when I'm more used to simply defining a tuple of some sort with it in, and the assoc'ing a new value in, and getting a new structure back (ideally with structural sharing)
igstan has joined #ocaml
<smondet>
seangrove: what kind of cleaning? you indentation on lines 33-35 is weird
<smondet>
s/you/your/
<seangrove>
Sorry for the indentation, just when with the default emacs setup
srcerer has joined #ocaml
<seangrove>
the form that starts... let resp : Yojson.Basic.json
srcerer has quit [Client Quit]
<smondet>
checkout ocp-indent and "wire" it with your editor
<ggole>
seangrove: if you want to pull out that pair, go ahead
Kakadu has quit [Quit: Page closed]
<ggole>
It's just a matter of introducing a let
contempt has quit [Ping timeout: 246 seconds]
<ggole>
Also, line 21 could do with being split up
jc2 has joined #ocaml
contempt has joined #ocaml
jc2 has left #ocaml [#ocaml]
<seangrove>
ggole: I know I can pull out the base entry `Assoc [("server", `String "ocaml")], but that seems to create a Yojson.Basic.json type, and I can't then modify that structure (or associate an entry and get a new structure back, without mutability)
Hannibal_Smith has joined #ocaml
tnguyen has joined #ocaml
<ggole>
Er, aren't you just trying to not have ("server", `String "ocaml") twice?
<seangrove>
<seangrove>
<seangrove>
ggole: Yeah, exactly. Let me write a bit of corresponding code...
<ggole>
You can just bind it and name it twice easily enough.
contempt has quit [Remote host closed the connection]
rgrinberg has joined #ocaml
contempt has joined #ocaml
<seangrove>
Is there an equivalent of (assoc {} key value) that returns a new associative list/hashmap?
<seangrove>
I think there is, from reading RWOcaml, but then I can't get that to be a Yojson.Basic.json type
<seangrove>
Sorry for the type-newb questions, trying to learn
ontologiae has joined #ocaml
<ggole>
Well, you can do it like this: let base = "server", `String "ocaml" in match foo with | ... -> `Assoc ("a", "b"::base) | ... -> `Assoc base
eugene_klm has joined #ocaml
<ggole>
Er, that should be let base = ["server", `String "ocaml"] in ...
<seangrove>
Ok, that makes some sense. I'll play around with that - thank you
<ggole>
:: simply adds an element on the front of the list
<ggole>
Which should be pretty much what you want (in this case).
<seangrove>
And doesn't modify the original list, right?
WraithM has joined #ocaml
<ggole>
No, lists can't be modified in OCaml
<Anarchos>
ggole even list of refs ?
<adrien>
unless you want to be kicked by people on the caml-list that is :P
<adrien>
Anarchos: you don't mutate the list :)
<Anarchos>
Obj.black_magic ?
<ggole>
First rule of Obj.magic, you don't talk about Obj.magic
<seangrove>
Hehe, yeah, not looking to get around immutability at all, just making sure that it behaves how I'm expecting
<ggole>
Coming from Clojure, you should be fairly comfortable with persistent data structures.
hhugo has joined #ocaml
<flux>
just toady/yesterday there was some discussion about Batteries' List.map that coerces a mutable list into an immutable one with the function that is not to be mentioned
<flux>
..and how this might be broken with the forecoming (I hope..) OCaml for Multicore
FatDarrel has joined #ocaml
<flux>
so, even when it looks like the safest use, it might not be :)
<ggole>
Sigh, good old List.map trouble again. It'd be nice if OCaml supported tail-consing by TRMC.
* adrien
points his finger at someone on the channel
<flux>
tail recursive.. mutating call? no?-)
jao has joined #ocaml
jao has quit [Changing host]
jao has joined #ocaml
<ggole>
Tail recursion modulo cons.
<flux>
but apparently Core's List.map is fast and does no trickery
<ggole>
It's an old Prolog implementation trick for rewriting applicative list operations to use mutation under the hood, safely.
<flux>
I'm not sure if that would solve O4MC's trouble, other than needing it to solve it :)
<flux>
(the problem it has is that immutable data structures cannot in its view refer to more recent objects)
<ggole>
Usually the write barrier takes care of that, no?
<flux>
how does it take care of that? I'm not sure what the mechanism is, but it's related to what O4MC decides to move to shared heap and what not
<flux>
but I don't really know how it works, so can't properly discuss it :)
<ggole>
Oh I see, that's a different concern to the usual write barrier
<flux>
it apparently enforces that shared heap has no pointers to private heap
<ggole>
Usually the issue is that the generational GC needs to know when an old object points into the minor heap
shinnya has quit [Ping timeout: 260 seconds]
<flux>
I wonder if it somehow changes the memory management so that it can know what data is mutable what what not. or is that somehow already known?
<ggole>
No, you can ignore all that
<ggole>
The write barrier applies only to writes to an existing object
<ggole>
Immutable objects simply aren't the target of such writes.
<ggole>
But the new GC may have different rules.
Kakadu has joined #ocaml
<ggole>
Like a read barrier.
bytbox has joined #ocaml
yomimono has quit [Ping timeout: 272 seconds]
ontologiae has quit [Ping timeout: 272 seconds]
ysz has joined #ocaml
ygrek has quit [Ping timeout: 272 seconds]
tnguyen has quit [Ping timeout: 260 seconds]
zpe has quit [Remote host closed the connection]
bytbox has quit [Ping timeout: 272 seconds]
ollehar has joined #ocaml
bytbox has joined #ocaml
WraithM has quit [Quit: Lost terminal]
dsheets has quit [Ping timeout: 272 seconds]
hhugo has quit [Quit: Leaving.]
lordkryss has joined #ocaml
slash^ has quit [Read error: Connection reset by peer]
avsm has joined #ocaml
bytbox has quit [Remote host closed the connection]
shinnya has joined #ocaml
BitPuffin has quit [Ping timeout: 244 seconds]
bytbox has joined #ocaml
bytbox has quit [Remote host closed the connection]
sh1ken has joined #ocaml
slash^ has joined #ocaml
malo has joined #ocaml
cyanure__ has joined #ocaml
cyanure__ has quit [Max SendQ exceeded]
zpe has joined #ocaml
cyanure__ has joined #ocaml
rgrinberg has quit [Quit: Leaving.]
zpe has quit [Remote host closed the connection]
avsm1 has joined #ocaml
avsm has quit [Read error: Connection reset by peer]
bytbox has joined #ocaml
jc2 has joined #ocaml
bytbox has quit [Remote host closed the connection]
jc2 has quit [Client Quit]
SrPx has joined #ocaml
sinelaw has joined #ocaml
<sinelaw>
hi. about alternatives/refinements to the value restriction. why can't we exempt all pure functions?
<sinelaw>
a pure value expression being one that: 1. has no variables free in it, 2. if it's a function, takes only pure values, and returns only pure values,
<ggole>
You'd need a way to talk about pure and nonpure things in the type system, which would be quite a complication
<sinelaw>
ggole, they did it the other way around in SML 90
<sinelaw>
and SML/NJ
<sinelaw>
they tagged "imperative" type variables, but why not do it the other way around? assume everything is imperative except for what I defined above
<ggole>
With the annotations? I thought that was usually considered a mistake.
<sinelaw>
ggole, it was inferred if i understand correctly
<sinelaw>
and it may have been a mistake, i'm asking about a different approach
<ggole>
Signatures are not inferred, so the details inevitably have to be taken care of.
<ggole>
Like variance with OCaml's approach.
<sinelaw>
ggole, let's ignore modules for a moment
<sinelaw>
what are you saying about variance? i'm not all that familiar with ocaml
<ggole>
If you go and look at the .mli of the Set module, you'll see a variance annotation: type +'a t
jc2 has joined #ocaml
<ggole>
This is an explicit form of the "extra" information inferred due to the extended value restriction in OCaml
<sinelaw>
ggole, that's related to subtyping though
avsm1 has quit [Quit: Leaving.]
<sinelaw>
let's ignore subtyping too :)
<ggole>
It's a matter of polymorphism, really
<sinelaw>
right
jc2 has left #ocaml [#ocaml]
<sinelaw>
I mean not the variance, the value restriction
<ggole>
The type +'a t indicates that the type variable should be polymorphic
<sinelaw>
hmm
<ggole>
Which is what this whole value restriction thing is about.
<sinelaw>
isn't just to say that it's covariant
<sinelaw>
?
paddymahoney has joined #ocaml
<def`>
type variables in covariant position can be generalized
<sinelaw>
they can be generalized to a supertype
<ggole>
That's a better way to put it.
<sinelaw>
not to any type
<ggole>
Generalisation in the context of inference means "make polymorphic".
<ggole>
(Roughly speaking.)
<ggole>
So it isn't simply a matter of subtyping.
<sinelaw>
variance is directly related to subtyping, inference with polymorphism doesn't have to include subtyping at all
<sinelaw>
and you still need the value restriction once you have mutable cells
<sinelaw>
so my question is, more precisely, limited only to polymorphism and mutability: can't we relax value restriction for values that are provably pure?
<ggole>
There's still a value restriction, it's just relaxed a bit
<seangrove>
I'm trying to build a mirage project and getting "Error: Unbound value conduit_direct"
<seangrove>
That's the only definition of conduit_direct I can find - I'm trying to wrap my head around how one module might just refer to conduit_direct bare like that