Cannot compute type fingerprint in plugin, kinds/types are mixed

alice alicekoroleva239 at gmail.com
Wed May 23 04:10:18 UTC 2018


Yes, I’ve looked through this file, but it seems to me that I can't use anything there in my function.

> 22 мая 2018 г., в 18:52, Nicolas Frisby <nicolas.frisby at gmail.com> написал(а):
> 
> Hi Alice.
> 
> I'm having trouble following your question -- I'm not familiar with the internals of fingerprint generation.
> 
> But, have you scoured the compiler/typecheck/TcTypeable.hs file? It seems likely to have similar logic to what you seem to be seeking.
> 
> HTH. -Nick
> 
> On Tue, May 22, 2018, 06:38 alice <alicekoroleva239 at gmail.com <mailto:alicekoroleva239 at gmail.com>> wrote:
> Hello again. I’m trying to make a function in a type-checking plugin that takes TyCoRep#Type and makes its fingerprint that matches `typeRepFingerprint (typeRep :: TypeRep (type))`. As I understood the type’s fingerprint is made in DsBinds#dsEvTypeable by generating a code that makes the fingerprint, so I can’t reuse functions which are already written.
> 
> My goal is to write a function that makes fingerprints of types which are not type variables such as Int, Maybe Int, ‘[Int] etc. So I tried to follow `mkTrCon` and `mkTrApp` style, and I think I managed to process simple types like Int, Maybe Int — right now I’m processing TyConApp only. But when I tried to make promoted data fingerprint like ‘[Int] I faced some problems. 
> 
> For example, for making `’Just Int` fingerprint first I have to compute 'Just fingerprint by computing  'Just tyCon’s and * fingerprints, then combining them into one fingerprint. Then I have to apply ‘Just to Int. But when I try to do something like that while type checking I cannot separate two cases that match runtime’s`TypeRep (a b)` (a representation for a type application) and `TypeRep a` (a representation for a type constructor) because they are represented by TyConApp. Also I can’t separate tyCon kinds and types for type application because they are merged into one list which is stored in `TyConApp _ [KindOrType]`. [KindOrType] list for `’Just Int` is `[*, Int]`. Is there any way to separate this two cases and kinds/types?
> 
> Probably there is an easier way to make this function? If not, does type fingerprint function seem possible to make?
> 
> Any help would be appreciated,
> 
> Alice.
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at haskell.org <mailto:ghc-devs at haskell.org>
> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs <http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20180523/87afcdd5/attachment.html>


More information about the ghc-devs mailing list