Reading type families from interface files

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Reading type families from interface files

Jan Stolarek
Devs,

Is there a plumbing for returning declarations (not instances) of type families from an interface
file?

Janek

Reply | Threaded
Open this post in threaded view
|

Reading type families from interface files

Simon Peyton Jones
I don't know what you mean. Can you be more explicit.  The mi_fam_insts field of a ModIface sounds like what you want

|  -----Original Message-----
|  From: ghc-devs [mailto:ghc-devs-bounces at haskell.org] On Behalf Of Jan
|  Stolarek
|  Sent: 23 October 2014 08:50
|  To: ghc-devs at haskell.org
|  Subject: Reading type families from interface files
|  
|  Devs,
|  
|  Is there a plumbing for returning declarations (not instances) of type
|  families from an interface file?
|  
|  Janek
|  _______________________________________________
|  ghc-devs mailing list
|  ghc-devs at haskell.org
|  http://www.haskell.org/mailman/listinfo/ghc-devs

Reply | Threaded
Open this post in threaded view
|

Reading type families from interface files

Jan Stolarek
Say I have:

module Foo where
 type family F a
 type instance F Int = Char

mi_fam_insts stores type family instances, in that case "F Int = Char". What I would like to load
is type family declaration: "F a". If that does not exist already I wonder whether information
about type family declarations should be cached in ModDetails in the same way md_fam_insts caches
information about instances?

Rationale: I want to load information about tyfam declarations in FamInst.checkFamInstConsistency
and pass these definitions of type families to FamInst.checkForConflicts. My plan is to verify
whether an open type family is injective at the same time when looking for conflicts.

Janek

Dnia czwartek, 23 pa?dziernika 2014, napisa?e?:

> I don't know what you mean. Can you be more explicit.  The mi_fam_insts
> field of a ModIface sounds like what you want
>
> |  -----Original Message-----
> |  From: ghc-devs [mailto:ghc-devs-bounces at haskell.org] On Behalf Of Jan
> |  Stolarek
> |  Sent: 23 October 2014 08:50
> |  To: ghc-devs at haskell.org
> |  Subject: Reading type families from interface files
> |
> |  Devs,
> |
> |  Is there a plumbing for returning declarations (not instances) of type
> |  families from an interface file?
> |
> |  Janek
> |  _______________________________________________
> |  ghc-devs mailing list
> |  ghc-devs at haskell.org
> |  http://www.haskell.org/mailman/listinfo/ghc-devs



Reply | Threaded
Open this post in threaded view
|

Reading type families from interface files

Simon Peyton Jones
It's in mi_decls, along with data type declarations, class declarations, and the like.

If you are talking about a ModDetails, then look in the range of md_types; the TyThings there include all the data types, classes, and type families declared in this module

S

|  -----Original Message-----
|  From: Jan Stolarek [mailto:jan.stolarek at p.lodz.pl]
|  Sent: 23 October 2014 11:31
|  To: Simon Peyton Jones
|  Cc: ghc-devs at haskell.org
|  Subject: Re: Reading type families from interface files
|  
|  Say I have:
|  
|  module Foo where
|   type family F a
|   type instance F Int = Char
|  
|  mi_fam_insts stores type family instances, in that case "F Int =
|  Char". What I would like to load is type family declaration: "F a". If
|  that does not exist already I wonder whether information about type
|  family declarations should be cached in ModDetails in the same way
|  md_fam_insts caches information about instances?
|  
|  Rationale: I want to load information about tyfam declarations in
|  FamInst.checkFamInstConsistency and pass these definitions of type
|  families to FamInst.checkForConflicts. My plan is to verify whether an
|  open type family is injective at the same time when looking for
|  conflicts.
|  
|  Janek
|  
|  Dnia czwartek, 23 pa?dziernika 2014, napisa?e?:
|  > I don't know what you mean. Can you be more explicit.  The
|  > mi_fam_insts field of a ModIface sounds like what you want
|  >
|  > |  -----Original Message-----
|  > |  From: ghc-devs [mailto:ghc-devs-bounces at haskell.org] On Behalf Of
|  > | Jan  Stolarek
|  > |  Sent: 23 October 2014 08:50
|  > |  To: ghc-devs at haskell.org
|  > |  Subject: Reading type families from interface files
|  > |
|  > |  Devs,
|  > |
|  > |  Is there a plumbing for returning declarations (not instances) of
|  > | type  families from an interface file?
|  > |
|  > |  Janek
|  > |  _______________________________________________
|  > |  ghc-devs mailing list
|  > |  ghc-devs at haskell.org
|  > |  http://www.haskell.org/mailman/listinfo/ghc-devs
|  


Reply | Threaded
Open this post in threaded view
|

Reading type families from interface files

Jan Stolarek
> If you are talking about a ModDetails, then look in the range of md_types;
> the TyThings there include all the data types, classes, and type families
> declared in this module
Ah, typeEnvTyCons looks like the thing I was looking for. Thanks.

Janek