Re: Availability of Coercible Instances at TH Runtime

2018-05-07 Thread Shayan Najd
> I think this may be waiting for the trees-that-grow work to be completed, and > as far as I know, no one is actively working on this. We've just got a new Google SoC project accepted to push this forward :) /Shayan On Mon, May 7, 2018 at 3:14 PM, Richard Eisenberg

Re: Availability of Coercible Instances at TH Runtime

2018-05-07 Thread Richard Eisenberg
Yes: https://ghc.haskell.org/trac/ghc/wiki/TemplateHaskell/Introspective I think this may be waiting for the trees-that-grow work to be completed, and as far as I know, no one is actively working on this. But I still think it would be a Good Thing. Richard > On May 7, 2018, at 12:37 AM,

Re: Availability of Coercible Instances at TH Runtime

2018-05-06 Thread David Kraeutmann
Tangentially related, but wasn't there a plan at some point to integrate TH more tightly with GHC? On 5/7/2018 4:39 AM, Richard Eisenberg wrote: No, it doesn't, but the Q monad is actually a wrapper around TcM, the type-checker monad. I don't think it would be all that hard to do this.

Re: Availability of Coercible Instances at TH Runtime

2018-05-06 Thread Richard Eisenberg
> On May 4, 2018, at 10:01 PM, Travis Whitaker wrote: > > I'm curious what it'd take to add a qReifyCoercible method; does the renamer > know anything about Coercible? No, it doesn't, but the Q monad is actually a wrapper around TcM, the type-checker monad. I don't

Re: Availability of Coercible Instances at TH Runtime

2018-05-04 Thread Travis Whitaker
A workaround that's suitable for what I'm after is defining a class like this for some fixed T. instance (Coercible a T) => C a I'm curious what it'd take to add a qReifyCoercible method; does the renamer know anything about Coercible? Thanks, Travis On Fri, May 4, 2018 at 11:01 AM, Richard

Re: Availability of Coercible Instances at TH Runtime

2018-05-04 Thread Richard Eisenberg
I don't think there's an easy way to do this. We could imagine extending Quasi to have a method to check for coercibility, but I don't think there's a way to do this in the current TH API. Sorry! Richard > On May 4, 2018, at 3:44 AM, Travis Whitaker wrote: > > Given

Fwd: Availability of Coercible Instances at TH Runtime

2018-05-04 Thread Travis Whitaker
Given that Coercible instances are Deeply Magical, perhaps I'm being a bit naive here, but I recently tried to write a TH function that can check if one type is a newtype of another (or a newtype of a newtype of another, etc). coercibleToFrom :: Type -> Type -> Q Bool coercibleToFrom tx ty = (&&)