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

GHC cvs-ghc at haskell.org
Wed Jul 7 03:05:21 EDT 2010


#4175: GHCi support for type/data families should match that of related features
---------------------------------+------------------------------------------
    Reporter:  claus             |       Owner:              
        Type:  bug               |      Status:  new         
    Priority:  normal            |   Component:  GHCi        
     Version:  6.12.3            |    Keywords:  FD TF       
          Os:  Unknown/Multiple  |    Testcase:              
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown
---------------------------------+------------------------------------------
 Currently, GHCi queries are not as helpful with type and data families as
 they are with type synonyms or class instances. Consider this module:
 {{{
 {-# LANGUAGE FunctionalDependencies #-}
 {-# LANGUAGE MultiParamTypeClasses #-}
 {-# LANGUAGE TypeFamilies #-}

 type family TF a
 type instance TF Bool = Char
 type instance TF Int  = Bool

 data family DF a
 data instance DF Bool = DFC Char
 data instance DF Int  = DFB Bool

 class FD a b | a -> b
 instance FD Bool Char
 instance FD Int  Bool

 type TS a = (a,a)
 }}}
 and compare the output of `:info` for these items:
 {{{
 *Main> :i TS
 type TS a = (a, a)
         -- Defined at C:\Users\claus\Desktop\tmp\fd-tf\tf-df-
 info.hs:17:5-6
 *Main> :i TF
 type family TF a :: *
         -- Defined at C:\Users\claus\Desktop\tmp\fd-tf\tf-df-
 info.hs:5:12-13
 *Main> :i FD
 class FD a b | a -> b
         -- Defined at C:\Users\claus\Desktop\tmp\fd-tf\tf-df-
 info.hs:13:6-7
 instance FD Bool Char
   -- Defined at C:\Users\claus\Desktop\tmp\fd-tf\tf-df-info.hs:14:9-20
 instance FD Int Bool
   -- Defined at C:\Users\claus\Desktop\tmp\fd-tf\tf-df-info.hs:15:9-20
 *Main> :i DF
 data family DF a
         -- Defined at C:\Users\claus\Desktop\tmp\fd-tf\tf-df-
 info.hs:9:12-13
 }}}
 Neither the type family definition nor the data family instances are
 listed. If we try `:browse` instead
 {{{
 *Main> :browse
 type family TF a :: *
 data family DF a
 data instance Main.R:DFBool Bool = DFC Char
 data instance Main.R:DFInt Int = DFB Bool
 class FD a b | a -> b
 type TS a = (a, a)
 }}}
 we get some form of info about the data family instances, though no
 instances are listed for the plain old class, and the data family instance
 info shows internal encoding details.

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


More information about the Glasgow-haskell-bugs mailing list