Specialisation doesn't kick in (RE: Instantiation of overloaded definition *in Core*)

2021-10-05 Thread Erdi, Gergo via ghc-devs
PUBLIC PUBLIC Hi, Thanks! Originally I was going to reply to this saying that my transformation isn't running in CoreM so where do I get that environment from, but then I realized I can just build it from the md_insts field of ModDetails. However, after thinking more about it, I also realize

Re: GHC indecisive whether matching on GADT constructors in arrow notation is allowed

2021-10-05 Thread Alexis King
I have already discussed this particular issue at some length in #20470 , and I propose a possible desugaring, using higher-rank lambdas to encode existential quantification, in a comment

Re: GHC indecisive whether matching on GADT constructors in arrow notation is allowed

2021-10-05 Thread Oleg Grenrus
A simple desugaring example may illustrate:     {-# LANGUAGE Arrows, GADTs #-}     import Control.Arrow     data X a where   X :: Bool -> Int -> X (Bool, Int)     ex1 :: Arrow a => a (X x) (Int, Bool)     ex1 = proc (X b i) -> returnA -< (i, b)     ex1expl :: Arrow a => a (X x) (Int, Bool)

Re: GHC indecisive whether matching on GADT constructors in arrow notation is allowed

2021-10-05 Thread Richard Eisenberg
I think the real difference is whether new type variables are brought into scope. It seems that GHC can't deal with a proc-pattern-match that introduces type variables, but it *can* deal with introduced constraints. I have no idea *why* this is the case, but it seems a plausible (if accidental)