Adjusting the verbosity of :type

#1

:type expands aliases which can make some types really complicated and hard to read. I’m working through chapter 3 of the book I was trying out :type insertEntry which resulted in:

{ address :: { city :: String          
             , state :: String         
             , street :: String        
             }                         
, firstName :: String                  
, lastName :: String                   
}                                      
-> List                                
     { address :: { city :: String     
                  , state :: String    
                  , street :: String   
                  }                    
     , firstName :: String             
     , lastName :: String              
     }                                 
   -> List                             
        { address :: { city :: String  
                     , state :: String 
                     , street :: String
                     }                 
        , firstName :: String          
        , lastName :: String           
        } 

instead of

Entry -> AddressBook -> AddressBook

Is there any way to control the verbosity fo what :type reports?

#2

Unfortunately not. As far as I can tell, the architecture of the type checker isn’t really built for this sort of thing; it can’t easily support delaying expansion of type synonyms or running them backwards. I think it could be good to make the type checker a bit smarter with respect to this sort of thing, as I’m sure it would also be helpful if we could use type synonyms in error messages in some cases too; currently type synonyms are almost always fully expanded in error messages.

Wrapping records with newtype
#3

The error message use case is covered by https://github.com/purescript/purescript/issues/1821. Should I mention the type introspection case in that ticket or open a new ticket?

#4

I think adding a comment there would be good, thanks!

#5

Perhaps worth noting that GHC handles this use case with its :kind! directive: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ghci.html#ghci-cmd-:kind