<sagotch>
In short, how to make `?foo:bool -> unit -> unit` values to be reject when you want `unit -> unit` values?
<ggole>
I don't think there's any type checker flag for that
<sagotch>
Even a typechecker flag would not be enough since it's a library, so this type error should be raised as well in any code using the function :(
<ggole>
Hmm
<ggole>
You might be able to do some private type stuff
<sagotch>
what it would look like ?
<ggole>
module M : sig type t = private (?foo:bool -> unit -> unit) type s = private (unit -> unit) val f : t -> ?foo:bool -> unit -> unit val g : s -> ?foo:bool -> unit -> unit val h : t end
<ggole>
This would interfere with using normal functions at that argument, though
<ggole>
If necessary you could provide an injection to the private type, but that would allow the unwanted optional arguments in
<sagotch>
I need to go, but I will try to understand what you suggest when coming back, thanks :)
sagotch has quit [Quit: Leaving.]
orbifx1 has quit [Ping timeout: 268 seconds]
thomasga has joined #ocaml
<thomasga>
hey, is there a way to take a lock in a Lwt_preemptive detached thread, without blocking everyhing? Seems that using Mutex.lock there just stucks all the program.
zolk3ri has joined #ocaml
kakadu has quit [Quit: Konversation terminated!]
kakadu has joined #ocaml
kvda has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
_whitelogger has joined #ocaml
thomasga has left #ocaml [#ocaml]
chjk6x has joined #ocaml
gravicappa has quit [Ping timeout: 250 seconds]
pierpal has quit [Remote host closed the connection]
KeyJoo has joined #ocaml
themsay has joined #ocaml
pierpal has joined #ocaml
chjk6x has quit [Ping timeout: 240 seconds]
jnavila has joined #ocaml
ziyourenxiang has quit [Ping timeout: 240 seconds]
jnavila has quit [Ping timeout: 246 seconds]
jao has joined #ocaml
aristos has joined #ocaml
Guest90447 has joined #ocaml
FreeBirdLjj has joined #ocaml
zolk3ri has quit [Remote host closed the connection]
zolk3ri has joined #ocaml
env__ has joined #ocaml
KeyJoo has quit [Quit: KeyJoo]
kakadu has quit [Ping timeout: 240 seconds]
kakadu has joined #ocaml
Jeanne-Kamikaze has quit [Quit: Leaving]
env__ has quit [Ping timeout: 272 seconds]
env__ has joined #ocaml
Guest90447 has quit [Remote host closed the connection]
chjk6x has joined #ocaml
Guest90447 has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
Guest90447 has quit [Ping timeout: 244 seconds]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 240 seconds]
env__ has quit [Quit: Lost terminal]
objmagic has joined #ocaml
Ganwell has joined #ocaml
Guest90447 has joined #ocaml
rain1 has joined #ocaml
<rain1>
is ocaml self hosted? so you need an ocaml binary to build it from source
<rain1>
ah i found the answer it's in boot/
gravicappa has joined #ocaml
objmagic has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
objmagic has joined #ocaml
kakadu has quit [Ping timeout: 240 seconds]
kakadu has joined #ocaml
Haudegen has joined #ocaml
themsay has quit [Ping timeout: 245 seconds]
<Ganwell>
I am an ocaml newbie, because someone on the internet said it is a good idea to convert runtime-errors to compiler-errors am trying to do that: https://git.io/fpNSf Maybe its not a good idea at all. :)
<lyxia>
Ganwell: if you know at compile time that p is Team0 t0 then you might as well pass t0 around, so you don't need get_team0
<dmbaturin>
Ganwell: If you want to make non-exhaustive matching an error rather than a warning, use -w @8
objmagic has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<octachron>
I would even add that you *should* consider non-exhaustive matching as an error by default
iovec has quit []
ggole has quit [Quit: ggole]
jnavila has joined #ocaml
<Ganwell>
octachron: of course I consider non-exhaustive matching an error, its just for the sake of showing the problem
<octachron>
Then as lyxia said, you can just not use the type player, since the type is more or less saying: I have either a `team0` or a `team1` and I don't know which statistically.
hyarion has left #ocaml [#ocaml]
Guest90447 has quit [Ping timeout: 272 seconds]
<Ganwell>
octachron: how can I then define a function that works with either team? For example this fails: let first_player a = a == Player0 || a == Player1
<Ganwell>
lyxia: I simplified the example: https://git.io/fpN7h How to define a function that works on team0 or team1, then?
Jeanne-Kamikaze has joined #ocaml
<lyxia>
you make one function for each team
iovec has joined #ocaml
<octachron>
Ganwell, if you have a function that works on both team; then you use your player type, and whenever you have a function that works only on team1, you use the unwrapped type `team1`
fraxamo has quit [Quit: Leaving]
<octachron>
in otherwords, you use `player` to erase the difference between the type, and you need to know on which side you are, you try to keep the `team$d` unwrapped as long as possible
<octachron>
*and if you need to know
kark has joined #ocaml
orbifx1 has joined #ocaml
jbkcc has joined #ocaml
aristos has quit [Quit: Leaving]
<dinosaure>
wq
orbifx1 has quit [Read error: Connection reset by peer]
orbifx1 has joined #ocaml
Guest90447 has quit [Remote host closed the connection]
Guest90447 has joined #ocaml
Guest90447 has quit [Remote host closed the connection]
Algebr has joined #ocaml
zolk3ri has quit [Quit: Lost terminal]
objmagic has joined #ocaml
jimt has quit [Ping timeout: 272 seconds]
Algebr has quit [Remote host closed the connection]
objmagic_ has joined #ocaml
coetry has joined #ocaml
objmagic has quit [Ping timeout: 240 seconds]
teej has joined #ocaml
<coetry>
can someone help me understand why my first match case is giving me an error?
<coetry>
perfect, thank you. The Real World OCaml book needs a few updates!
<coetry>
another error I was getting was the **. operator for Floats (which it appears you don't need that now)
<coetry>
2. ** 3. works fine
<octachron>
You don't need the parenthesis, another possibility is to use `_rest` to both name the variable and signal to the compiler that is not used with the leading "_"
<coetry>
ah ok so "_" signals unused vars, thank you!
jnavila has quit [Ping timeout: 252 seconds]
bartholin has quit [Remote host closed the connection]
chjk6x has joined #ocaml
jnavila has joined #ocaml
coetry has quit [Quit: Lost terminal]
orbifx1 has quit [Ping timeout: 250 seconds]
<Ganwell>
octachron: Thanks this make things very explicit, I like it. I also played with polymorphic variants, which allow what I first intended, but are less explicit.
jnavila has quit [Ping timeout: 252 seconds]
cobax has quit [Ping timeout: 264 seconds]
kvda has joined #ocaml
steenuil has quit [Remote host closed the connection]
objmagic_ has quit [Ping timeout: 240 seconds]
objmagic has joined #ocaml
enedil has joined #ocaml
<enedil>
Hello
<enedil>
Could somebody tell me why I get syntax error?
<enedil>
And before any question is asked I'll answer, yes, I need imperative constructions here (that's the part of the task).
<lyxia>
enedil: line 6 should be a double semicolon
<lyxia>
You might also want to paste the error with your code for this kind of question, saves us the trouble of getting the code compiling
<enedil>
lyxia, yes, I should have, but nonetheless the error was plain and simple File "./f.ml", line 30, characters 0-0:Error: Syntax error (line 30 is the last one, it's empty)
<enedil>
Than you for your help
<enedil>
Thank you for your help
objmagic has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
kakadu has quit [Remote host closed the connection]
enedil_ has joined #ocaml
chjk6x has quit [Ping timeout: 250 seconds]
enedil has quit [Ping timeout: 250 seconds]
Haudegen has quit [Read error: Connection reset by peer]
pierpal has joined #ocaml
enedil_ has quit [Quit: Leaving]
pierpal has quit [Ping timeout: 246 seconds]
kvda has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]