manicennui has quit [Quit: Connection closed for inactivity]
dnh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
kurfen has quit [Ping timeout: 272 seconds]
wingsorc__ has joined #ocaml
wingsorc has quit [Ping timeout: 276 seconds]
spip has joined #ocaml
bobo_ has quit [Ping timeout: 272 seconds]
John_Ivan__ has quit [Read error: Connection reset by peer]
John_Ivan has joined #ocaml
_whitelogger has joined #ocaml
chrisz has quit [Ping timeout: 240 seconds]
chrisz has joined #ocaml
waleee has quit [Ping timeout: 250 seconds]
zebrag has quit [Quit: Konversation terminated!]
jao has quit [Remote host closed the connection]
jao has joined #ocaml
jao has quit [Ping timeout: 272 seconds]
xd1le has joined #ocaml
mbuf has joined #ocaml
mro has joined #ocaml
bgs has joined #ocaml
mro has quit [Ping timeout: 272 seconds]
bgs has quit [Remote host closed the connection]
fds has quit [Ping timeout: 260 seconds]
troydm has quit [Ping timeout: 272 seconds]
fds has joined #ocaml
Serpent7776 has joined #ocaml
mro has joined #ocaml
Serpent7776 has quit [Ping timeout: 272 seconds]
bartholin has joined #ocaml
Serpent7776 has joined #ocaml
bartholin has quit [Quit: Leaving]
azimut has quit [Ping timeout: 258 seconds]
m5zs7k has quit [Ping timeout: 240 seconds]
m5zs7k has joined #ocaml
Haudegen has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
olle has joined #ocaml
jlrnick has joined #ocaml
mro has quit [Quit: Leaving...]
kakadu has joined #ocaml
bobo_ has joined #ocaml
spip has quit [Ping timeout: 250 seconds]
dnh has joined #ocaml
troydm has joined #ocaml
Guest8 has joined #ocaml
<Guest8>
Hi. I am using OCaml as a concrete example to illustrate some theoretical stuff, and for one of the examples, I'd really like to be able to evaluate open terms, i.e. terms with free variables. Ideally, the program x should crash, the program let _ = (fun _ -> x) in () should not crash, and the program let _ = x in () should not either. I can
<Guest8>
get the desired behavior for the first two by replacing all free variable occurrences by exit 1 and for the last two by replacing them by Obj.magic 0. Is there some way to get all three? I'd expect no solution to exist since I basically want a non-value term such as exit 1 to be treated like a value by let-expressions, but I'm asking just in
<Guest8>
case.
<Fardale>
you don't need anything for let _ = x in () to work
<Fardale>
Sorry, I guess x is not define in this case
taupiqueur has joined #ocaml
<Fardale>
Here, you seems to need some lazy evaluation, in OCaml you need to use explicite lazy value for this.
genpaku has quit [Remote host closed the connection]
genpaku has joined #ocaml
<Guest8>
I can't see a simple way of using lazy. There might be some whole-program transformation that adds Lazy.from_val and Lazy.force everywhere that does not affect the behavior of the program and such that we can then evaluate open terms by replacing free variables by Lazy.from_fun (fun () -> exit 1), but it looks fairly complicated to define
<zozozo>
Guest8: you can replace all occurrences of your free variables by "(assert false)"
adanwan has quit [Remote host closed the connection]
adanwan has joined #ocaml
<octachron>
that doesn't work for "let _ = free in ()", but that's mostly because such expression doesn't seem valid with an eager semantics.
neiluj has joined #ocaml
<neiluj>
hey! how do you deal when in a module, you have several modules included for which one of them has a main type which is equal to a type defined in a module, leading to the type checker believing than some arguments should have an other type than the correct one?
<neiluj>
does that need more context?
<theblatte>
neiluj: is `module X with type t = Y.t` what you want?
Haudegen has quit [Quit: Bin weg.]
<neiluj>
theblatte: thanks! It looks like so
<octachron>
a with constraint can only modify a module type not a module.
<octachron>
Generally, you want to avoid including modules with colliding type names because this create unnamable types.
<neiluj>
thanks! indeed used module type of to get the signature out of the module
<neiluj>
actually the error was an absence of conversion
<neiluj>
*was due to
<Guest8>
"assert false" seems to work in the same cases as "exit 1"
<Guest8>
The only ways I can envision what I want being possible is:
<Guest8>
- either there is some ocaml intepreter that only fetches values when needed;
<Guest8>
- or there is some way to build a value that says "I am a pointer" and points so something out of the program's memory, so that "let x = y in t" might propagate the value without dereferencing the pointer, but any real use of x would dereference the pointer and crash
Haudegen has joined #ocaml
<Guest8>
Substituting free variables by "Obj.magic (fun _ -> exit 1)" might work (for code that does not use the Obj module, otherwise Obj.is_block distinguishes this from a free variable), but there might be other ways to distinguish this from a free variable
barak has joined #ocaml
barak has quit [Client Quit]
barak has joined #ocaml
xd1le has quit [Quit: xd1le]
neiluj has quit [Ping timeout: 276 seconds]
taupiqueur has quit [Remote host closed the connection]
taupiqueur has joined #ocaml
<jedb>
does OCaml have anything equivalent to do notation in Haskell?
<jedb>
currently assuming I need to bodge together the relevant operators and do it manually, but if there's an idiomatic way that would be nice
taupiqueur has quit [Remote host closed the connection]
taupiqueur has joined #ocaml
Tuplanolla has joined #ocaml
Haudegen has quit [Quit: Bin weg.]
azimut has joined #ocaml
<octachron>
jedb, Ocaml does have let binding operators that work like the `do` notation for a specific monad.
<octachron>
But they are currently not defined by default in the standard library: `let (let*?) = Option.bind`
<octachron>
let*? x = Some 4 in Some (4 + x)
<jedb>
...I am confused as how that syntax works, but if it does the job then neato
<octachron>
`let* x = expr in y` is the same as `do { x <- expr; y }`
<octachron>
(OCaml has also an applicative `and` syntax if needed)
Serpent7776 has quit [Ping timeout: 250 seconds]
taupiqueur has quit [Remote host closed the connection]
taupiqueur has joined #ocaml
sunset_NOVA has joined #ocaml
sunset_NOVA has left #ocaml [#ocaml]
jao has joined #ocaml
Haudegen has joined #ocaml
troydm has quit [Ping timeout: 250 seconds]
taupiqueur has quit [Remote host closed the connection]
taupiqueur has joined #ocaml
Serpent7776 has joined #ocaml
neiluj has joined #ocaml
barak has quit [Quit: WeeChat 3.7.1]
mbuf has quit [Quit: Leaving]
neiluj has quit [Ping timeout: 240 seconds]
taupiqueur has quit [Remote host closed the connection]
taupiqueur has joined #ocaml
adanwan has quit [Remote host closed the connection]
adanwan has joined #ocaml
taupiqueur has quit [Remote host closed the connection]
taupiqueur has joined #ocaml
waleee has joined #ocaml
Guest8 has quit [Quit: Connection closed]
Stumpfenstiel has joined #ocaml
taupiqueur has quit [Ping timeout: 244 seconds]
bartholin has joined #ocaml
mro has joined #ocaml
mro has quit [Client Quit]
Haudegen has quit [Quit: No Ping reply in 180 seconds.]
Haudegen has joined #ocaml
bartholin has quit [Quit: Leaving]
Serpent7776 has quit [Ping timeout: 244 seconds]
Haudegen has quit [Quit: No Ping reply in 180 seconds.]
Haudegen has joined #ocaml
dnh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
spip has joined #ocaml
bobo_ has quit [Ping timeout: 244 seconds]
adanwan has quit [Ping timeout: 258 seconds]
adanwan has joined #ocaml
barak has joined #ocaml
adanwan has quit [Remote host closed the connection]
adanwan has joined #ocaml
azimut has quit [Ping timeout: 258 seconds]
azimut has joined #ocaml
taupiqueur has joined #ocaml
Stumpfenstiel has quit [Ping timeout: 244 seconds]