pierpal has quit [Read error: Connection reset by peer]
pierpal has joined #ocaml
ziyourenxiang has joined #ocaml
jbrown has quit [Ping timeout: 252 seconds]
mfp has quit [Ping timeout: 255 seconds]
iovec has quit [Quit: Connection closed for inactivity]
loli has quit [Ping timeout: 250 seconds]
loli has joined #ocaml
jim7j1ajh has joined #ocaml
jimt has quit [Ping timeout: 250 seconds]
keep_learning_M has joined #ocaml
Guest11162 has quit []
iovec has joined #ocaml
silver has quit [Read error: Connection reset by peer]
loli has quit [Ping timeout: 246 seconds]
ziyourenxiang has quit [Ping timeout: 255 seconds]
ahf has quit [Ping timeout: 255 seconds]
loli has joined #ocaml
ahf has joined #ocaml
quarters has quit [Ping timeout: 252 seconds]
quarters has joined #ocaml
quarters has quit [Ping timeout: 258 seconds]
quarters has joined #ocaml
amcorvi_ has quit [Ping timeout: 255 seconds]
quarters has quit [Ping timeout: 252 seconds]
loli has quit [Ping timeout: 255 seconds]
quarters has joined #ocaml
tormen has joined #ocaml
tormen_ has quit [Ping timeout: 268 seconds]
loli has joined #ocaml
amcorvi_ has joined #ocaml
gravicappa has joined #ocaml
_whitelogger has joined #ocaml
marvin2 has quit [Ping timeout: 244 seconds]
loli has quit [Ping timeout: 250 seconds]
Haudegen has quit [Ping timeout: 258 seconds]
govg has joined #ocaml
loli has joined #ocaml
jao has quit [Ping timeout: 255 seconds]
amcorvi_ has quit [Ping timeout: 245 seconds]
iovec has quit [Quit: Connection closed for inactivity]
loli has quit [Ping timeout: 246 seconds]
loli has joined #ocaml
pierpal has quit [Read error: Connection reset by peer]
<xvilka>
hi! If I have module A and B, and two of them use some type (and maybe even functions) that can be extracted in module C
<xvilka>
but I can't do "include C" in both A and B modules
<xvilka>
if they are included both in module D
<xvilka>
how to handle such a case?
ziyourenxiang has joined #ocaml
olle_ has joined #ocaml
loli has quit [Ping timeout: 246 seconds]
ggole has joined #ocaml
loli has joined #ocaml
pierpal has joined #ocaml
sagotch has joined #ocaml
webshinra has quit [Ping timeout: 258 seconds]
keep_learning_M has quit [Quit: This computer has gone to sleep]
keep_learning_M has joined #ocaml
madroach has quit [Ping timeout: 264 seconds]
loli has quit [Ping timeout: 240 seconds]
madroach has joined #ocaml
mfp has joined #ocaml
iovec has joined #ocaml
marvin2 has joined #ocaml
jrslepak has quit [Ping timeout: 246 seconds]
jrslepak has joined #ocaml
<def`>
open C?
loli has joined #ocaml
<xvilka>
omg, you are right
<xvilka>
I am so stupid
<xvilka>
it is so obvious
johnelse_ has quit [Quit: leaving]
johnelse has joined #ocaml
jbrown has joined #ocaml
asymptotically has joined #ocaml
loli has quit [Ping timeout: 250 seconds]
loli has joined #ocaml
olle_ has quit [Remote host closed the connection]
<Leonidas>
does the cohttp client support http 1.1 persistent connections?
keep_learning_M has quit [Quit: This computer has gone to sleep]
keep_learning_M has joined #ocaml
dhil has joined #ocaml
keep_learning_M has quit [Quit: This computer has gone to sleep]
loli has quit [Ping timeout: 250 seconds]
jbrown has quit [Ping timeout: 258 seconds]
loli has joined #ocaml
silver has joined #ocaml
jstolarek has joined #ocaml
<jstolarek>
say I have: type 'a foo = A of 'a
<jstolarek>
and want to redefine foo inside a module:
<jstolarek>
module Foo = struct type foo = int foo end
<jstolarek>
how do I refer to foo defined at the top-level in int foo?
sagotch has quit [Quit: Leaving.]
<ggole>
Inside of the module Foo, it isn't available. You might want to define an alias if you need it.
jbrown has joined #ocaml
<jstolarek>
ggole: that works, thanks (although it slightly polutes the module namespace, but that's acceptable I think)
<ggole>
If you are fussy, you can avoid that with another module: module TopLevelFoo = struct type t = foo end, and then TopLevelFoo.t is your alias
<ggole>
(I don't think it's much of an improvement.)
<jstolarek>
ggole: that is an improvement, because I have several modules and this allows me to define alias just once
<jstolarek>
thanks
Haudegen has joined #ocaml
Haudegen has quit [Remote host closed the connection]
Haudegen has joined #ocaml
Haudegen has quit [Read error: Connection reset by peer]
loli has quit [Ping timeout: 255 seconds]
loli has joined #ocaml
pierpal has quit [Quit: Poof]
pierpal has joined #ocaml
webshinra has joined #ocaml
ygrek has joined #ocaml
sagotch has joined #ocaml
dhil has quit [Ping timeout: 246 seconds]
jao has joined #ocaml
q9929t has joined #ocaml
q9929t has quit [Quit: q9929t]
ygrek has quit [Remote host closed the connection]
dhil has joined #ocaml
spew has joined #ocaml
Haudegen has joined #ocaml
loli has quit [Ping timeout: 246 seconds]
sz0 has joined #ocaml
loli has joined #ocaml
freyr69 has joined #ocaml
dhil has quit [Ping timeout: 255 seconds]
dhil has joined #ocaml
dhil has quit [Ping timeout: 258 seconds]
FreeBirdLjj has joined #ocaml
govg has quit [Ping timeout: 255 seconds]
ygrek has joined #ocaml
ygrek has quit [Remote host closed the connection]
loli has quit [Ping timeout: 250 seconds]
jaar has joined #ocaml
KeyJoo has joined #ocaml
loli has joined #ocaml
kvik has quit [Ping timeout: 250 seconds]
kvik has joined #ocaml
kvik has quit [Ping timeout: 244 seconds]
kvik has joined #ocaml
<cemerick>
good day, all :-)
<companion_cube>
oï o/
<cemerick>
\o
<cemerick>
I'm trying to convert a data model over to use GADTs. I have a module sig that includes e.g. `val bounds : t -> Rectangle.t`, but the new form doesn't match (`val bounds : 'a mark -> Rectangle.t`). What am I doing wrong?
<companion_cube>
can you pastebin the error message and source code?
<companion_cube>
ah, you're trying to unify `type t` with `type 'a mark`, in a way
<cemerick>
right
<companion_cube>
in MGeometry, you cannot really define `type t = 'a mark`, right?
<cemerick>
I could just use polymorphic variants (my motivator for using GADTs is to prune out all the unreachable states/matches when e.g. I know I'm only operating over chars), but it seems like this should work?
<cemerick>
companion_cube: that's effectively what leaving it "abstract" (just `type t`) does AFAICT
<companion_cube>
well no, because `bounds` should have type `t -> rectangle`
<cemerick>
but no, I can't add `'a mark`, "unbound type variable"
<companion_cube>
and in your case it doesn't unify
<cemerick>
clearly
<cemerick>
I guess I don't grok why `'a foo` isn't acceptable as "some `t`"
<cemerick>
I guess a less domain-specific question would be, e.g. how do you make a Set that can contain any instance of a GADT?
<cemerick>
I've searched on this, but haven't found any examples or discussion 🤔
<companion_cube>
I'd wrap the GADT in an existential :s
freyr69 has quit [Ping timeout: 250 seconds]
<cemerick>
hah
<cemerick>
I hope that's not canonical :-P
<companion_cube>
anyway I don't use GADTs that much
<ggole>
I think you have misunderstood what type t means
<ggole>
It doesn't mean 'this can be anything'
<companion_cube>
^
<cemerick>
yeah, that was my understanding
<ggole>
In an implementation, type t is essentially a datatype with zero constructors, eg, an impossible value
<cemerick>
or, not _anything_, but anything within the constraints of whatever concrete types and parameters are introduced
kakadu has left #ocaml ["Konversation terminated!"]
ziyourenxiang has quit [Ping timeout: 255 seconds]
<cemerick>
so, changing the second example to use `type t = int foo` works. That doesn't help explain how to proceed if there's more than one return type in a GADT
<ggole>
You would usually introduce an existential wrapper type any_foo = AnyFoo : _ foo -> any_foo and make a set of that
loli has quit [Ping timeout: 255 seconds]
<ggole>
That 'hides' the type variable in 'a foo, meaning it can be anything
<companion_cube>
cemerick: `type t` has only two valid uses: 1/ pure type level programming (as a phantom type) 2/ a foreign type when writing C bindings
<cemerick>
companion_cube: noted 👍
<ggole>
It has many valid uses in *signatures*, which is quite confusing at first.
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
<companion_cube>
right
<companion_cube>
the difference between declarations, and definitions
<companion_cube>
`type t` is also a valid definition, but a weird one (since you have to conjure constructors from somewhere, like `external`, or never construct any value of type t)
FreeBirdLjj has quit [Ping timeout: 255 seconds]
ggole has quit [Quit: Leaving]
loli has joined #ocaml
sagotch has quit [Quit: Leaving.]
<cemerick>
ggole: yeah, companion_cube suggested an existential wrapper before, which I flinched at simply b/c the GADT constructors are already one level of wrapping around the useful data in question.
<cemerick>
as you said, fussy :-)
<cemerick>
I guess I'll just downshift to polymorphic variants until I do some more reading, etc
sagax has quit [Ping timeout: 250 seconds]
SpiceGuid has joined #ocaml
Haudegen has quit [Remote host closed the connection]
Serpent7776 has joined #ocaml
Haudegen has joined #ocaml
kakadu has joined #ocaml
dhil has joined #ocaml
jaar has quit [Ping timeout: 272 seconds]
KeyJoo has quit [Quit: KeyJoo]
doesntgolf has joined #ocaml
klntsky has quit [Remote host closed the connection]