Difference in Partial TypeFamily application between 7.8.3 & 7.8.4

Richard Eisenberg eir at cis.upenn.edu
Tue Jan 13 17:16:30 UTC 2015


It sounds like you're doing something quite like the defunctionalization trick I've used for partially applied type families: https://typesandkinds.wordpress.com/2013/04/01/defunctionalization-for-the-win/

That blog post eventually became an implementation and paper (co-authored with Jan Stolarek). The implementation is in the `singletons` package; the paper is http://www.cis.upenn.edu/~eir/papers/2014/promotion/promotion.pdf

I have some ideas (written toward the end of that paper) about how to get this into GHC proper, but it's years away, so don't hold your breath!

Richard

On Jan 13, 2015, at 11:24 AM, magesh b <magesh85 at gmail.com> wrote:

> Thanks Richard. Basically I was storing the type family and its arguments in the data type, so that I can transform its arguments before it gets applied to stored typefamily (via. another closed type function). Is this even possible to do by any chance in 7.8.4 & later?
> 
> On Tue, Jan 13, 2015 at 8:32 PM, Richard Eisenberg <eir at cis.upenn.edu> wrote:
> Hello Magesh,
> 
> The bug is in 7.8.3, which should never have allowed your `Test1`. Haskell type families may not be partially applied -- the type system and type inference just don't know how to handle such things. In 7.8.3, the check was accidentally turned off, as discussed in #9433, as you found. 7.8.3 allows you to do a few limited things with partially applied families, but you'll get very strange errors if you continue down that road, as GHC quickly gets horribly confused.
> 
> I'm afraid you'll have to find a different way to express what you want.
> 
> Richard
> 
> On Jan 13, 2015, at 9:49 AM, magesh b <magesh85 at gmail.com> wrote:
> 
>> Hi,
>> 
>> {-# LANGUAGE TypeFamilies, ConstraintKinds #-}
>> 
>> import GHC.Exts
>> 
>> type family TyFun a
>> 
>> data DictC (c :: * -> Constraint)
>> 
>> data DictTF (tf :: * -> *)
>> 
>> type Test1 = DictTF TyFun -- Fails here in 7.8.4
>> 
>> type Test2 = DictC Show
>> 
>> When I compile the above code, I'm getting the following error in 7.8.4 and the same code works in 7.8.3. 
>> 
>> Test.hs:11:1:
>>     Type synonym ‘TyFun’ should have 1 argument, but has been given none
>>     In the type declaration for ‘Test1’
>> 
>> Is this a bug or a expected behavior? 
>> For reference, I could find two fixes to type family related bug in this release.
>> https://ghc.haskell.org/trac/ghc/ticket/9433
>> https://ghc.haskell.org/trac/ghc/ticket/9316
>> 
>> 
>> Thanks & Regards,
>> Magesh B
>> 
>> 
>> _______________________________________________
>> ghc-devs mailing list
>> ghc-devs at haskell.org
>> http://www.haskell.org/mailman/listinfo/ghc-devs
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20150113/ad29df77/attachment-0001.html>


More information about the ghc-devs mailing list