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 <alicekoroleva...@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@haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs >
_______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs