adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml 4.06.0 release notes: https://caml.inria.fr/pub/distrib/ocaml-4.06/notes/Changes | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml
maattdd_ has joined #ocaml
sh0t has quit [Remote host closed the connection]
maattdd_ has quit [Ping timeout: 256 seconds]
remexre has joined #ocaml
sz0 has quit [Quit: Connection closed for inactivity]
<remexre> Exactly what is a ghost location?
<orbifx1> remexre: context?
shinnya has quit [Ping timeout: 265 seconds]
<remexre> loc_ghost
<thizanne> isn't it a location that doesn't actually correspond to a syntactic element of the source code ?
<thizanne> ( def` will know)
<remexre> A better way to phrase that: why am I getting them out of Parse, and why do they exist?
<thizanne> if you had an example, I could try to explain
<remexre> The positions seem to be valid...
<remexre> 1 sec
<remexre> https://hastebin.com/opubujanih is what I'm parsing
<remexre> I'm making a linter-like thing that lets me run Prolog queries against the AST, so I dump the AST as Prolog facts; all the facts from this AST are at https://hastebin.com/xuqokubudi
<remexre> The important parts of that are lines 48 and 103-104
opios has joined #ocaml
<remexre> the Location on 48 has its ghost flag set
<remexre> and afaict, the positions just cover the entirety of line 2?
<thizanne> yeah well, I have no explanation on this (I never actually tried to manipulate the AST)
<thizanne> maybe you could dump the ast as an ocaml value rather than prolog facts to see what this location is related to ?
<remexre> Is there an easyish way to do that? The process of getting this to prolog facts was a wild ride that involved switching to musl libc o_O
<remexre> (This is a polyglot project, and this project is most of the OCaml I've ever written...)
philtor has quit [Ping timeout: 248 seconds]
<thizanne> ocaml -dparsetree
<thizanne> I think i see
<thizanne> try : let f x = x
<thizanne> (same constation, simpler parse tree)
<remexre> This would've made debugging a lot easier (-_-)
<thizanne> and then : let f = fun x -> x
<thizanne> you get almost the same parse tree, except there is a ghost somewhere on the first one
<thizanne> but as you can see, these two are syntactically different
<remexre> Oh, because it desugars let f x = x to let f = fun x -> x
<thizanne> but the first one is actually a syntactic sugar for the second one
<thizanne> yes
<remexre> okay, that makes sense
<thizanne> so that's what I thought first : it's a location to an objcet that syntactically doesn't exist
<thizanne> (also happens when you have some preprocessor involved)
<remexre> so for my use case, I should probably just disregard anything that has a ghost location?
<thizanne> no idea, I don't know what your use case is
<thizanne> I'm not sure, because a linter should care about concrete syntax rather than how it is parsed internally ?
<remexre> I'm mostly looking for antipatterns like `x = false` (rather than `not x`); this is for a grading system
<remexre> so I'm probably gonna ignore them for now?
<thizanne> as you wish
<thizanne> but note for instance that [1] is syntactic sugar for (::)(1,[])
<thizanne> and t.(0) is for Array.get t 0
<remexre> Yeah, the [1;2;3] already got me once
<remexre> As part of this process, the AST ends up as JSON (so it can "safely" cross an FFI boundary)
<thizanne> then you may want to decide that you don't care about syntactic sugar, which is probably the easiest decision
<remexre> I had to fork the JSON library, because on lists > 40-ish elements, it decided that it was nesting too deep and there was probably a DoS attack going on
jao has joined #ocaml
sh0t has joined #ocaml
mengu has quit [Remote host closed the connection]
jimmyrcom has quit [Ping timeout: 240 seconds]
orbifx1 has quit [Ping timeout: 248 seconds]
mengu has joined #ocaml
mengu has quit [Ping timeout: 256 seconds]
sh0t has quit [Remote host closed the connection]
zolk3ri has quit [Quit: leaving]
<seliopou> yayoyoyoy
<seliopou> are there any users/authors of the travis ci scripts around? i just realized that the docker script does not run opam tests and this confuses me
<seliopou> liek, y?
gem has quit [Quit: Lost terminal]
spew has joined #ocaml
govg has quit [Ping timeout: 256 seconds]
Soni has quit [Ping timeout: 276 seconds]
pierpa has joined #ocaml
Soni has joined #ocaml
mfp has quit [Ping timeout: 252 seconds]
mengu has joined #ocaml
mengu has quit [Ping timeout: 256 seconds]
spew has quit [Read error: Connection reset by peer]
jimmyrcom has joined #ocaml
isd has quit [Ping timeout: 248 seconds]
ygrek has quit [Ping timeout: 256 seconds]
Algebr has joined #ocaml
Algebr has quit [Remote host closed the connection]
mengu has joined #ocaml
mengu has quit [Ping timeout: 248 seconds]
<allm7ght> has anyone got neovim with ocaml language server working?
jao has quit [Ping timeout: 248 seconds]
govg has joined #ocaml
mengu has joined #ocaml
mengu has quit [Ping timeout: 260 seconds]
isd has joined #ocaml
cbot has joined #ocaml
mbuf has joined #ocaml
mengu has joined #ocaml
ome has joined #ocaml
isd has quit [Read error: Connection reset by peer]
mengu has quit [Ping timeout: 248 seconds]
mengu has joined #ocaml
mengu has quit [Remote host closed the connection]
jimmyrcom has quit [Ping timeout: 240 seconds]
jimmyrcom has joined #ocaml
jimmyrcom has quit [Max SendQ exceeded]
letaris has joined #ocaml
jimmyrcom has joined #ocaml
pierpa has quit [Quit: Page closed]
mengu has joined #ocaml
esum has quit [Ping timeout: 256 seconds]
tobiasBora has quit [Ping timeout: 260 seconds]
esum has joined #ocaml
tobiasBora has joined #ocaml
MercurialAlchemi has joined #ocaml
tobiasBora has quit [Ping timeout: 255 seconds]
esum has quit [Ping timeout: 255 seconds]
Fardale has quit [Ping timeout: 260 seconds]
ome has quit [Quit: Connection closed for inactivity]
orbifx1 has joined #ocaml
xfbs has joined #ocaml
orbifx1 has quit [Ping timeout: 256 seconds]
AltGr has joined #ocaml
letaris has quit [Ping timeout: 256 seconds]
mengu has quit [Remote host closed the connection]
mengu has joined #ocaml
cuicui has joined #ocaml
dhil has joined #ocaml
argent_smith has joined #ocaml
cbot has quit [Quit: Leaving]
ontologiae has joined #ocaml
sapristi has joined #ocaml
zolk3ri has joined #ocaml
argent_smith has quit [Quit: Leaving.]
Haudegen has joined #ocaml
raduom has joined #ocaml
mk9 has joined #ocaml
aziem has quit [Quit: leaving]
infinity0_ has joined #ocaml
infinity0_ has quit [Changing host]
infinity0 is now known as Guest97244
infinity0 has joined #ocaml
Guest97244 has quit [Ping timeout: 256 seconds]
reynir has quit [Quit: WeeChat 2.0.1]
reynir has joined #ocaml
esum has joined #ocaml
Fardale has joined #ocaml
reynir has quit [Client Quit]
reynir has joined #ocaml
reynir has quit [Client Quit]
reynir has joined #ocaml
ontologiae has quit [Quit: WeeChat 1.4]
reynir has quit [Quit: WeeChat 2.0.1]
reynir has joined #ocaml
nopf has quit [Ping timeout: 264 seconds]
tobiasBora has joined #ocaml
mfp has joined #ocaml
reynir has quit [Quit: WeeChat 2.0.1]
argent_smith has joined #ocaml
sapristi_ has joined #ocaml
reynir has joined #ocaml
sapristi has quit [Ping timeout: 260 seconds]
shinnya has joined #ocaml
jnavila has joined #ocaml
kakadu has joined #ocaml
jnavila has quit [Quit: Konversation terminated!]
jnavila has joined #ocaml
silver has joined #ocaml
jimmyrcom has quit [Ping timeout: 268 seconds]
mk9 has quit [Ping timeout: 255 seconds]
mk9 has joined #ocaml
baboum has joined #ocaml
Haudegen has quit [Remote host closed the connection]
jmiven has quit [Ping timeout: 260 seconds]
shinnya has quit [Ping timeout: 276 seconds]
jmiven has joined #ocaml
baboum has quit [Quit: WeeChat 2.0.1]
mk9 has quit [Quit: mk9]
jmiven has quit [Ping timeout: 255 seconds]
tarptaeya has joined #ocaml
mk9 has joined #ocaml
jmiven has joined #ocaml
_andre has joined #ocaml
Haudegen has joined #ocaml
rwmjones is now known as rwmjones|mtgs
malc_ has joined #ocaml
mk9 has quit [Remote host closed the connection]
govg has quit [Ping timeout: 256 seconds]
mk9 has joined #ocaml
dhil has quit [Ping timeout: 256 seconds]
govg has joined #ocaml
xfbs has quit []
cuicui has quit [Remote host closed the connection]
cuicui has joined #ocaml
spew has joined #ocaml
cuicui has quit [Read error: Connection reset by peer]
cuicui has joined #ocaml
nullifidian__ is now known as nullifidian
cuicui has quit [Remote host closed the connection]
mbuf has quit [Quit: Leaving]
cuicui has joined #ocaml
cuicui has quit [Remote host closed the connection]
ziyourenxiang has joined #ocaml
allm7ght has quit [Quit: Page closed]
rwmjones|mtgs is now known as rwmjones
melesigenes has joined #ocaml
sh0t has joined #ocaml
ontologiae has joined #ocaml
<melesigenes> Hi. Suppose I have a variant type (maybe even a polymorphic variant type) a = X of x | Y of y. If I want to define a lifting functionality on a it might look like val lift : (a->a) -> a -> a. But actually it really should look something like val lift : (a1 -> a2) -> a1 -> 22, where a1 and a2 are constrained to be of type a. How would you achieve this?
<flux> melesigenes, what is a1? X of x?
<flux> or, you actually said it. but how is a1 different from a2?
MercurialAlchemi has quit [Ping timeout: 264 seconds]
<flux> you mean type ('x, 'y) a = X of 'x | Y of 'y ?
tarptaeya has quit [Quit: Leaving]
xfbs has joined #ocaml
dhil has joined #ocaml
<melesigenes> let's say a = Float of float | Int of int. My lifting functionality on type a needs to do the mapping right. The generic lift would be val lift: ('x -> 'y) -> 'x ->'y. How would you implement this generic lift so it would only operate on the variants that comprise type a
<Drup> melesigenes: your generic lift doesn't really make sense
<Drup> I mean, except by calling it the identity
moei has joined #ocaml
<Drup> You want `lift f` to either apply f to the X case or the Y case depending on the type of `f` ?
BitPuffin has joined #ocaml
<flux> variants aren't really indexed by type, but by the constructor, so the type of the variant is not really visible
<melesigenes> Drup: yep - that's exactly it
<Drup> melesigenes: you can't.
<flux> ..except in case of GADTs, which might be applicaple here. but once GADTs enter the picture, you need to think it deeply if it's worth it ;-).
<Drup> even with GADTs, you would need more information.
<Drup> the simplest is just to have two lift function, liftX and liftY
<Drup> (and if you are thinking "well, I could do it with ad-hoc polymorphism" ... I'm pretty sure you need overlaping/undecidable instances in haskell to do that, it's not exactly advisable ;)
<melesigenes> Drup. What about the alternate case: If I want to extend my definition of type a to X of x | Y of y | Lift of (a->a) * a. Now I have a recursive definition of a. But I have no guarantees in the definition of the lift variant that the first argument of the function is of the same type as the second argument of the tuple
<Drup> Ah, then you can use GADTs :)
<melesigenes> OK - found a GADT tutorial. I'll look into that. Thxs DRUP
sapristi_ has quit [Ping timeout: 276 seconds]
sapristi_ has joined #ocaml
mengu has quit [Remote host closed the connection]
mengu has joined #ocaml
mengu has quit [Ping timeout: 255 seconds]
jao has joined #ocaml
dhil has quit [Ping timeout: 268 seconds]
maattdd_ has joined #ocaml
al-damiri has joined #ocaml
<orbifx[m]> Is there a way to kill Lwt_main.run when running in utop?
cbot has joined #ocaml
Denommus has joined #ocaml
Haudegen has quit [Remote host closed the connection]
allm7ght has joined #ocaml
mk9_ has joined #ocaml
mk9_ has quit [Client Quit]
mk9 has quit [Ping timeout: 252 seconds]
maattdd_ has quit [Ping timeout: 264 seconds]
allm7ght has quit [Ping timeout: 260 seconds]
dhil has joined #ocaml
pspwtys has joined #ocaml
ziyourenxiang has quit [Ping timeout: 248 seconds]
jnavila has quit [Quit: Konversation terminated!]
jnavila has joined #ocaml
letaris has joined #ocaml
pspwtys has quit [Ping timeout: 276 seconds]
mk9 has joined #ocaml
mk9 has quit [Quit: mk9]
ontologiae has quit [Ping timeout: 264 seconds]
allm7ght has joined #ocaml
kakadu has quit [Quit: Konversation terminated!]
mk9 has joined #ocaml
Haudegen has joined #ocaml
mk9_ has joined #ocaml
raduom has quit [Read error: Connection reset by peer]
mk9 has quit [Ping timeout: 264 seconds]
mk9_ is now known as mk9
mk9_ has joined #ocaml
tarptaeya has joined #ocaml
mk9 has quit [Ping timeout: 256 seconds]
mk9_ is now known as mk9
mk9 has quit [Client Quit]
mk9 has joined #ocaml
mk9 has quit [Client Quit]
mk9 has joined #ocaml
mk9_ has joined #ocaml
mk9 has quit [Ping timeout: 240 seconds]
mk9_ is now known as mk9
dhil has quit [Ping timeout: 256 seconds]
orbifx1 has joined #ocaml
VermillionAzure has joined #ocaml
sapristi_ has quit [Remote host closed the connection]
sapristi_ has joined #ocaml
jack5638 has quit [Ping timeout: 264 seconds]
slash^ has joined #ocaml
mk9 has quit [Ping timeout: 268 seconds]
dhil has joined #ocaml
Denommus has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
mk9 has joined #ocaml
jack5638 has joined #ocaml
BitPuffin has quit [Remote host closed the connection]
Denommus has joined #ocaml
xfbs has quit []
isd has joined #ocaml
mengu has joined #ocaml
isd has quit [Ping timeout: 240 seconds]
kakadu has joined #ocaml
allm7ght has quit [Ping timeout: 260 seconds]
Denommus has quit [Remote host closed the connection]
shinnya has joined #ocaml
slash^ has quit [Quit: Leaving]
dhil has quit [Ping timeout: 256 seconds]
Denommus has joined #ocaml
<Leonidas> I have this parser: https://gist.github.com/Leonidas-from-XIV/052bdb3277d90ccea8802a68764ed2f6 but I am getting a shift-reduce conflict. Why?
VermillionAzure has quit [Ping timeout: 252 seconds]
<Leonidas> got it, the just-EOF situation was conflicting with both the prog rule and the value sequence rule
<Leonidas> thanks for being my rubber ducks :-)
<Drup> Leonidas: call menhir with --explain
sapristi_ has quit [Quit: Leaving]
VermillionAzure has joined #ocaml
jimmyrcom has joined #ocaml
mk9 has quit [Quit: mk9]
mk9 has joined #ocaml
tarptaeya has quit [Quit: Leaving]
mk9 has quit [Ping timeout: 248 seconds]
mengu has quit [Remote host closed the connection]
cbot has quit [Ping timeout: 256 seconds]
xfbs has joined #ocaml
xfbs has quit [Client Quit]
isd has joined #ocaml
Denommus has quit [Quit: restarting emacs]
_andre has quit [Quit: leaving]
gemishho1d has joined #ocaml
mengu has joined #ocaml
gemishho1d has quit [Quit: leaving]
cbot has joined #ocaml
AltGr has left #ocaml [#ocaml]
Haudegen has quit [Read error: Connection reset by peer]
VermillionAzure has quit [Ping timeout: 252 seconds]
pierpa has joined #ocaml
justin_smith has quit [Ping timeout: 276 seconds]
jnavila has quit [Ping timeout: 265 seconds]
nomicflux has joined #ocaml
malc_ has quit [Quit: ERC (IRC client for Emacs 25.0.50.2)]
argent_smith has quit [Quit: Leaving.]
nomicflux has quit [Quit: nomicflux]
justin_smith has joined #ocaml
melesigenes has quit [Ping timeout: 260 seconds]
barcabuona has joined #ocaml
jrslepak has quit [Read error: Connection reset by peer]
jrslepak_ has joined #ocaml
jrslepak_ is now known as jrslepak
fds_ is now known as fds
fds has quit [Changing host]
fds has joined #ocaml
Haudegen has joined #ocaml
moei has quit [Quit: Leaving...]
kakadu has quit [Remote host closed the connection]
nicoo has quit [Ping timeout: 255 seconds]
shinnya has quit [Ping timeout: 256 seconds]
nicoo has joined #ocaml
orbifx1 has quit [Ping timeout: 240 seconds]
nomicflux has joined #ocaml
zolk3ri has quit [Quit: leaving]