[GHC] #4175: GHCi support for type/data families should match that of related features

GHC cvs-ghc at haskell.org
Thu Mar 14 01:00:15 CET 2013


#4175: GHCi support for type/data families should match that of related features
---------------------------------+------------------------------------------
    Reporter:  claus             |       Owner:                  
        Type:  bug               |      Status:  patch           
    Priority:  low               |   Milestone:  7.6.2           
   Component:  GHCi              |     Version:  6.12.3          
    Keywords:  FD TF             |          Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown    
  Difficulty:  Unknown           |    Testcase:                  
   Blockedby:                    |    Blocking:                  
     Related:                    |  
---------------------------------+------------------------------------------

Comment(by parcs):

 `orphNamesOfClsInst` and `orphNamesOfTyFamInst` collect the names of all
 the concrete types and type constructors that make up a particular class
 instance head or family instance head.

 For example, supposing we have `class Foo a b` and `type family Bar a b`:

 `instance Foo (Either (Maybe Int) a) Bool where ...` would give `[Either,
 Maybe, Int, Bool]`

 `type instance Bar (F (G (H a))) b = ...` would give `[F, G, H]`


 In `TcRnDriver`, these functions are used to filter the list of in-scope
 type family instances and class instances, showing only the instances
 whose heads contain the name that was passed to `:info`. In
 `InteractiveEval`, the functions are used to filter instances based on
 whether all their constituent names are currently in scope.

 So `:i Int` would output the aforementioned class instance since the head
 of that particular instance contains the name `Int`.

 Similarly `:i G` would output the above type family instance, but only if
 `F` and `H` are in scope as well.

 Note that I didn't change any existing functionality, I only refactored
 some of the existing code in light of how similar the `:info` logic for
 type families instances and class instances turned out to be.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4175#comment:8>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler



More information about the ghc-tickets mailing list