rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
xd1le has quit [Quit: xd1le]
<discocaml>
<froyo> > Real World OCaml is a physical book but also somewhat Jane Street-ified in places*.
<discocaml>
<froyo>
<discocaml>
<froyo> * everywhere
<discocaml>
<contificate> I think the ocamllex and menhir page is pretty reasonable
<discocaml>
<contificate> but now I see some italic text that says "contributed by.." someone who isn't primary author
<discocaml>
<contificate> so at least 1 virtual page that isn't JS'd
<discocaml>
<loves_curry> thanks! from my usage so far it reminds me a lot of Rust
mima has quit [Ping timeout: 256 seconds]
troydm has quit [Quit: What is Hope? That all of your wishes and all of your dreams come true? To turn back time because things were not supposed to happen like that (C) Rau Le Creuset]
troydm has joined #ocaml
azimut has quit [Remote host closed the connection]
azimut has joined #ocaml
<discocaml>
<cemerick> rust was implemented with OCaml for its first N years, there's a nontrivial connection there
uncomfy has joined #ocaml
uncomfy has quit [Remote host closed the connection]
waleee has quit [Ping timeout: 244 seconds]
tizoc has quit [Quit: Coyote finally caught me]
tizoc has joined #ocaml
chrisz has quit [Ping timeout: 246 seconds]
chrisz has joined #ocaml
<discocaml>
<loves_curry> yep im aware haha thats partly the reason i decided to try
jmcantrell has quit [Quit: WeeChat 4.0.3]
bartholin has joined #ocaml
azimut has quit [Ping timeout: 246 seconds]
uncomfy has joined #ocaml
bgs has quit [Remote host closed the connection]
uncomfy_ has joined #ocaml
uncomfy has quit [Ping timeout: 252 seconds]
uncomfy has joined #ocaml
uncomfy_ has quit [Ping timeout: 252 seconds]
uncomfy_ has joined #ocaml
uncomfy has quit [Ping timeout: 252 seconds]
uncomfy_ has quit [Remote host closed the connection]
Serpent7776 has joined #ocaml
steenuil_ has joined #ocaml
dstein64- has joined #ocaml
pie__ has joined #ocaml
dmbaturin_ has joined #ocaml
dstein64 has quit [*.net *.split]
steenuil has quit [*.net *.split]
pie_ has quit [*.net *.split]
dmbaturin has quit [*.net *.split]
steenuil_ is now known as steenuil
dstein64- is now known as dstein64
noonien has quit [Ping timeout: 245 seconds]
uncomfy has joined #ocaml
uncomfy has quit [Remote host closed the connection]
uncomfy has joined #ocaml
Serpent7776 has quit [Ping timeout: 256 seconds]
Serpent7776 has joined #ocaml
<discocaml>
<lyhokia> Hello, anyone knows how should I mimic haskell's IORef in ocaml?
<discocaml>
<lyhokia> mkThunk env x body = \a -> do
<discocaml>
<lyhokia> a' <- newIORef a
<discocaml>
<lyhokia> eval ((x, a') : env) body
<discocaml>
<lyhokia>
<discocaml>
<lyhokia> eval :: Env -> Expr -> IO Value
<discocaml>
<lyhokia> eval env ex = case ex of
<discocaml>
<lyhokia> EVar n -> do
<discocaml>
<lyhokia> th <- lookupEnv env n
<discocaml>
<lyhokia> v <- force th
<discocaml>
<lyhokia> I tried ref but it seems some interfaces are different. Specifically, if I translate this into OCaml, what should be the type of VClosure? Is it a reference or just a lambda?
mima has joined #ocaml
uncomfy has quit [Remote host closed the connection]
Serpent7776 has quit [Ping timeout: 246 seconds]
bartholin has quit [Quit: Leaving]
<discocaml>
<lyhokia> NVM I figured it out, basically I have to replace `A -> IO B`(haskell) with `A ref -> B`(ocaml)
rgrinberg has joined #ocaml
<discocaml>
<lyhokia> NVM I figured it out, basically I have to replace `IORef A -> IO B`(haskell) with `A ref -> B`(ocaml)
rgrinberg has quit [Ping timeout: 252 seconds]
rgrinberg has joined #ocaml
azimut has joined #ocaml
mechap has joined #ocaml
infinity0 has quit [Ping timeout: 245 seconds]
infinity0 has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dmbaturin_ is now known as dmbaturin
mima has quit [Ping timeout: 260 seconds]
Serpent7776 has joined #ocaml
xd1le has joined #ocaml
rgrinberg has joined #ocaml
szkl has joined #ocaml
CalimeroTeknik has quit [Remote host closed the connection]
<discocaml>
<Spark> i think its actually sometimes nice that both constructors are immediately defined as values, and you can shadow those values
<discocaml>
<Spark> for instance if you had a constructor `Foo` you could guard all calls to `Foo` by redefining shadowing the name `Foo` with a different function
<discocaml>
<lyhokia> Something come to my mind is dependent type but does ocaml has that?
<discocaml>
<._null._> This probably means that your `exp_core_annotated` type should be a product type instead, having the `t` of each variant separate from the rest
<discocaml>
<lyhokia> not really, you can't nest them inside `exp_core_annotated` if you separate that into a product type.
<discocaml>
<lyhokia> Sry I didn't provide the definition here:
<discocaml>
<._null._> `type 'a exp_core = Atom of Ast.atom | Tuple of 'a exp_core_annot list | ... and 'a exp_core_annot = { v: 'a exp_core; annot: 'a }`
Anarchos has joined #ocaml
<discocaml>
<._null._> Then `let take_annotated_type e = e.annot`
<discocaml>
<._null._> Usually you write yourself a prefix operator to take `v` : `let (!!) e = e.v`
Tuplanolla has joined #ocaml
<discocaml>
<lyhokia> That is not equivalent to my definition
<discocaml>
<lyhokia> I already said in that definition you can annotate ty recursively, but if I break that into a product type you can't do that.
<discocaml>
<lyhokia> Wait let me take a closer look, sry.
bartholin has quit [Quit: Leaving]
<discocaml>
<._null._> Mutually recursive types, you alternate thel
<discocaml>
<._null._> them*
<discocaml>
<lyhokia> Yeah this should work, thank you so much. Sorry that I judge before take a closer look.
<discocaml>
<._null._> Also, adding parentheses around your variant arguments adds an indirection, so unless you really need that tuple, you're better without those parentheses
<discocaml>
<lyhokia> I first learn haskell and then ocaml, and I feel the parenthesis's adding are pretty arbitrary, so I decide to just use the parenthesis all the time.
<discocaml>
<lyhokia> Guess it didn't fit into ocaml's aesthetic XD
<discocaml>
<._null._> In OCaml you're usually only adding parentheses when needed
<discocaml>
<lyhokia> That's for sure for any language, I guess I just need more time to get familiar with it.
azimut has joined #ocaml
<discocaml>
<Kali> to be clear:
<discocaml>
<Kali> Variant of ty * ty
<discocaml>
<Kali> and
<discocaml>
<Kali> Variant of (ty * ty)
<discocaml>
<Kali> are not the same, the first is a binary constructor and the other is a unary constructor with a tuple argument
Serpent7776 has quit [Ping timeout: 252 seconds]
Anarchos has quit [Quit: Vision[]: i've been blurred!]
Tuplanolla has quit [Quit: Leaving.]
chrisz has quit [Ping timeout: 245 seconds]
chrisz has joined #ocaml
<discocaml>
<polytypic> `data Ty = Variant Ty Ty` vs `data Ty = Variant (Ty, Ty)` in Haskell.
<dh`>
except that in ocaml you write Variant (a, b) to construct both