themsay has quit [Remote host closed the connection]
ohama has quit [Remote host closed the connection]
kakadu_ has quit [Remote host closed the connection]
ohama has joined #ocaml
mfp has quit [Ping timeout: 272 seconds]
assemblyman has joined #ocaml
AtumT has quit [Quit: AtumT]
<Ankhers>
I am getting a non exhaustive pattern match for a string. The example value is an empty string. Is there a way to tell the compiler, "trust me, this is fine"?
silver has quit [Read error: Connection reset by peer]
<companion_cube>
| _ -> assert false
<Ankhers>
companion_cube: Thanks!
<Netsu>
Ankhers: afaik gadt can be used there to avoid _ matching
unyu has joined #ocaml
AnAverageHuman has joined #ocaml
Netsu has quit [Ping timeout: 256 seconds]
assemblyman has quit [Read error: Connection reset by peer]
caltelt_ has joined #ocaml
_whitelogger has joined #ocaml
tormen has joined #ocaml
tormen_ has quit [Ping timeout: 245 seconds]
gravicappa has joined #ocaml
rwmjones_ has joined #ocaml
rwmjones has quit [Ping timeout: 268 seconds]
caltelt_ has quit [Ping timeout: 250 seconds]
assemblyman has joined #ocaml
al-damiri has quit [Quit: Connection closed for inactivity]
AnAverageHuman has quit [Ping timeout: 256 seconds]
assemblyman has quit [Quit: ™]
tizoc has quit [Quit: Coyote finally caught me]
tizoc has joined #ocaml
kvda has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jao has quit [Ping timeout: 255 seconds]
loli has joined #ocaml
_whitelogger has joined #ocaml
freyr69 has joined #ocaml
Birdface has joined #ocaml
sagotch has joined #ocaml
barockobamo has joined #ocaml
mfp has joined #ocaml
pierpal has quit [Ping timeout: 268 seconds]
Haudegen has joined #ocaml
pierpal has joined #ocaml
freyr69 has quit [Ping timeout: 246 seconds]
<Birdface>
I'm reading a value as a string, how do I 'cast' that as a custom type? i.e. string_to_myType ?
freyr69 has joined #ocaml
<Birdface>
Nvm. figured it out
Haudegen has quit [Remote host closed the connection]
pierpal has quit [Ping timeout: 246 seconds]
silver has joined #ocaml
freyr69 has quit [Ping timeout: 250 seconds]
Haudegen has joined #ocaml
sagotch has quit [Quit: Leaving.]
freyr69 has joined #ocaml
<Ankhers>
I have a sum type called parts. How can I create a map with my parts type as a key? Map.Make(parts) gives me a syntax error.
<hannes>
Ankhers: you can do: Map.Make(struct type t = parts let compare = compare end)
<hannes>
which will use the polymorphic compare function -- it's usually a better idea to write a custom "let compare a b = ..."
freyr69 has quit [Ping timeout: 250 seconds]
<Ankhers>
hannes: When you say it is usually better. What exactly does that mean? In my usecase I won't be directly comparing values and I will only be creating a single map with all elements. Should I still write a custom compare function?
<hannes>
Ankhers: polymorphic compare is fine for simple things - but once e.g. functions are compared, it may raise an exception.
<Ankhers>
hannes: Thanks. I will look through that information.
<hannes>
if all your constructors are simple (i.e. not carry any data, or only simple types), that's fine. I got into trouble when I used it on e.g. Unix.file_descriptor -- leading to out of memory on my system
<def`>
open as in extensible variant or polymorphic variant?
okuu has joined #ocaml
<Netsu>
def`: polymorphic
<Netsu>
def`: for extensible there's simply type t = .. already.
<def`>
type t = private [> ]
<Netsu>
def`: Oh, thank you. Actually, I already did't, but can't get how to extend that one
<Netsu>
def`: type u = [t|`A];; lead to Error: The type t is not a polymorphic variant type
<Netsu>
or it should be just cunstrained by 'with type t = ....' in bodule
<Netsu>
*?
<Netsu>
*sorry, I mean: or should it be just constrained by with type = [`A] then?
jaar has quit [Quit: Leaving]
<def`>
You can't extend a polymorphic variant in a functor.
<def`>
(this is not compatible with abstraction... you would need to assert the absence of labels in the polymorphic variant)
barockobamo has quit [Remote host closed the connection]
<Netsu>
def`: okay then, but how can I create abstract polymorphic variant container? I need to collect from list of instances of that type to common polymorphic variant sum
<Netsu>
the last part I can do with gadt and type constaint afaik
<Netsu>
but to put it in list first I need to have common type of module with (some) polymorphic variant type
<Netsu>
is it possible?
<Netsu>
Looks like it work however
<Netsu>
def`: thanks
<Netsu>
module type A = sig type t = private [> ] end;; module B : A = struct type t = [`A] end;;
Haudegen has joined #ocaml
<Netsu>
module type B = A with type t = [`A] ;; module rec B : B = B;; type p = [B.t|`B];; (* => type p = [ `A | `B ] *)
unyu has quit [Ping timeout: 258 seconds]
Jesin has quit [Quit: Leaving]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 250 seconds]
yomimono has joined #ocaml
AtumT has quit [Quit: AtumT]
Jesin has joined #ocaml
assemblyman has joined #ocaml
assemblyman has quit [Quit: ™]
okuu has quit [Ping timeout: 245 seconds]
pierpal has joined #ocaml
yomimono has quit [Ping timeout: 244 seconds]
switchnode has joined #ocaml
amiloradovsky has quit [Ping timeout: 272 seconds]
yomimono has joined #ocaml
gravicappa has quit [Ping timeout: 250 seconds]
raduom has joined #ocaml
demonimin has joined #ocaml
zhenya1007 has joined #ocaml
kakadu_ has joined #ocaml
<zhenya1007>
Could someone suggest a good "starter read" for dipping my toes into using GADTs in OCaml? I find the description in the language manual to be a bit too concise.
amiloradovsky has joined #ocaml
sonologico has joined #ocaml
Haudegen has quit [Remote host closed the connection]
yomimono has quit [Ping timeout: 246 seconds]
unyu has joined #ocaml
zhenya1007 has left #ocaml ["ERC (IRC client for Emacs 27.0.50)"]
yomimono has joined #ocaml
Haudegen has joined #ocaml
tane has quit [Quit: Leaving]
AnAverageHuman has joined #ocaml
sonologico has quit [Ping timeout: 246 seconds]
kvda has joined #ocaml
switchnode has quit [Quit: What price Glory ?]
jmiven has quit [Quit: co'o]
jmiven has joined #ocaml
sonologico has joined #ocaml
ygrek has quit [Ping timeout: 255 seconds]
unyu has quit [Ping timeout: 272 seconds]
zolk3ri has quit [Quit: Lost terminal]
kvda has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
sonologico has quit [Ping timeout: 245 seconds]
kvda has joined #ocaml
Jesin has quit [Quit: Leaving]
Jesin has joined #ocaml
Birdface has quit [Ping timeout: 250 seconds]
AnAverageHuman has quit [Ping timeout: 256 seconds]
troydm has quit [Ping timeout: 250 seconds]
AnAverageHuman has joined #ocaml
sonologico has joined #ocaml
troydm has joined #ocaml
Haudegen has quit [Remote host closed the connection]
sonologico has quit [Ping timeout: 246 seconds]
kakadu_ has quit [Remote host closed the connection]