<maattdd>
I mean I guess there is a rationale behind this behavior but I don't see where you would prefer having a non polymorphic function
nightmared has joined #ocaml
<octachron>
maattdd, the root problem is the interaction between polymorphism and side effect
<octachron>
in short function application can create internal reference, and reference type cannot be generalized
<octachron>
otherwise they could be written/read with inconsistent types at different points in the same program, e.g what is the type of "r" in "let r = ref None" ?
argent_smith has joined #ocaml
P4Titan has left #ocaml ["ERC Version 5.3 (IRC client for Emacs)"]
nomicflux has joined #ocaml
wtetzner has joined #ocaml
govg has quit [Ping timeout: 240 seconds]
govg has joined #ocaml
argent_smith has quit [Quit: Leaving.]
kakadu_ has quit []
kakadu has joined #ocaml
agarwal1975 has joined #ocaml
Algebr has quit [Ping timeout: 260 seconds]
mengu has joined #ocaml
Anarchos has joined #ocaml
Algebr has joined #ocaml
agarwal1975_ has joined #ocaml
tobast1 has joined #ocaml
agarwal1975 has quit [Ping timeout: 264 seconds]
agarwal1975_ is now known as agarwal1975
agarwal1975_ has joined #ocaml
agarwal1975 has quit [Ping timeout: 260 seconds]
agarwal1975_ is now known as agarwal1975
agarwal1975_ has joined #ocaml
agarwal1975 has quit [Ping timeout: 240 seconds]
agarwal1975 has joined #ocaml
jao has quit [Ping timeout: 260 seconds]
agarwal1975_ has quit [Ping timeout: 240 seconds]
slash^ has quit [Remote host closed the connection]
<flux>
I don't understand how that could be legal. I mean, you're adding a type constraint there yet saying it's a type alias?
<kakadu>
It still kind of alias
<kakadu>
There real issue that I want be able to write ` type 'a list = ('a, 'a list) L.glist` and
<kakadu>
have access to constructors of glist in place where I declare 'a list
<Drup>
then do both, just not in the same declaration
<kakadu>
I need them because I want to feed definition of `'a list` to ppx_deriving and make it know the structure of `(_,_) glist`
<flux>
would objects work for your case. to me it sounds like you might want subtyping.
<Drup>
ppx_deriving works on type aliases, you can still do two separate declaration
<Drup>
you can't do one
<Drup>
It's a self inflicted problem :)
<kakadu>
Drup: what do you mean, works? I need a specific deriver which should know the constructors of _ glist in place where 'a list is declared
<kakadu>
The only option I see is to hack ppx_deriving to have a function which look for a type by path in a current module
<Drup>
type ('a, b) glist = ('a, 'b) L.glist = ... [@deriving ...]
<Drup>
type 'a list = ('a, 'a list) glist [@deriving ...]
<kakadu>
As I said I want to know constructors of glist in place where `_ list` is declared.
<Drup>
well, I mean, you just put the two declarations at the same place, and you have everything you want in the same scope
<kakadu>
Whitequark proposed to use ppx_import to grap the glist declaration but it seems that with this approach I should save constructors somewhere in the parsetree and I can figure out why
<Drup>
I don't understand your problem. If the mater is just managing to apply deriving, then I gave you the solution.
<kakadu>
I want while deriving some code for type 'a list to know more information about type glist: is it a polymorphic variant or an object? If it is algebraic datatype how many constructors does it have and how they are named?
<Drup>
So you want to write a non-composable deriver
<Drup>
that's bad, but well, "type ... and" is your friend, I guess.
<kakadu>
adding `and ` will mean that later I can't derive any type that uses glist in my way
<kakadu>
It seems that I should hack ppx_derivnig and add extra parameter which will try to find type declaration in the current file by absolute path
<Drup>
You don't really need to hack ppx deriving for that, you just need to incorpore the features of ppx import
<kakadu>
But using ppx_import to import 'glist' I need to have a valid intermediate parsetree between invocation of ppx_import and ppx_deriving. And I can't figure out how it may look like. I made an attempt in a paste above but this attemp doesn't work
marsam has joined #ocaml
ziyourenxiang has quit [Quit: Leaving]
Algebr has quit [Ping timeout: 258 seconds]
Mercuria1Alchemi has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 240 seconds]