adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml 4.07.1 release notes: https://caml.inria.fr/pub/distrib/ocaml-4.07/notes/Changes | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml | Due to ongoing spam, you must register your nickname to talk on the channel
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.
al-damiri has joined #ocaml
<hannes> Ankhers: Map is a functor (see http://caml.inria.fr/pub/docs/manual-ocaml/libref/Map.html), it requires a module that adheres to the OrderedType signature (http://caml.inria.fr/pub/docs/manual-ocaml/libref/Map.OrderedType.html).
<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
<Ankhers> Yes they are all simple.
<Ankhers> Thanks.
r3s1stanc3 has quit [Quit: ZNC 1.7.2 - https://znc.in]
r3s1stanc3 has joined #ocaml
zolk3ri has joined #ocaml
uu91 has quit [Remote host closed the connection]
gravicappa has quit [Ping timeout: 250 seconds]
gravicappa has joined #ocaml
Netsu has joined #ocaml
<Netsu> Hello. Can such inheritance be properly constrained? https://gist.github.com/Pitometsu/dd3111b1d54578afa6eed94d2b4dc217
<octachron> Netsu, no.
sagotch has joined #ocaml
pierpal has joined #ocaml
<def`> Netsu: depending on what you intend to do, private rows might be enough.
<Netsu> I want make abstract interface for open variants
<Netsu> to be sure that each implementation will contain open variants in type. In case this's wrong way to do OCaml, how it could be done?
<def`> private rows are useful for abstracting over variants
<Netsu> def`: could you show any examles, please? Is it work in objects only, or for modules too?
<Netsu> def`: oh, I see, thanks, I'll try..
freyr69 has joined #ocaml
leah2 has quit [Ping timeout: 250 seconds]
pierpal has quit [Remote host closed the connection]
spew has joined #ocaml
jimt has joined #ocaml
jao has joined #ocaml
leah2 has joined #ocaml
jaar has joined #ocaml
mquy90 has joined #ocaml
mquy90 has quit [Quit: Leaving]
ygrek has joined #ocaml
crowley95 has quit [Ping timeout: 250 seconds]
crowley95 has joined #ocaml
amiloradovsky has joined #ocaml
freyr69 has quit [Remote host closed the connection]
okuu has joined #ocaml
AtumT has joined #ocaml
Haudegen has quit [Remote host closed the connection]
sagotch has quit [Quit: Leaving.]
okuu has quit [Ping timeout: 250 seconds]
tane has joined #ocaml
<Netsu> Is there empty open variant type in ocaml similar to empty variant type (in 4.07) https://github.com/ocaml/ocaml/pull/1546
<Netsu> *?
<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]
caltelt_ has joined #ocaml