Changes between Initial Version and Version 1 of MoreInfo

Dec 18, 2015 5:28:59 PM (4 years ago)



  • MoreInfo

    v1 v1  
     1javran is working on extending `:info` to support more general cases (as requested in #9394), here is the detail of my plan.
     3= Motiviation
     5Current implementation of `:info <things>` of GHCi simply splits whatever in `<things>` and prints information for each of them in order.
     6The motivation is to extend `:info` to parse info query better and support searching data / type family instances.
     8= Design of New `:info` Syntax
     10* Keep the old behavior that if you input multiple queries, all of them are executed in sequence. For example `:info Int Char` has the same behavior as before, `:info Int (Foo Bar)` first searches things regarding `Int` and then things related to type application `Foo Bar`.
     12* When `(` is present, expect a type and a closing `)` (type can contain holes to serve as wildcards), after parsing this type, we search it against instances related (not sure about the detail, maybe some type checking facilities will do)
     14* There are some special cases where `(` can also begin a regular query: `()`, `(,)`, `(,,,)`, they are treated in the old way.
     16= Dealing With More General Queries
     18Most of the following are copied from s9gf4ult comments on #9394, as I myself am still new to some of those concepts.
     19Hopefully I'll make myself comfortable with them when getting into details
     21- Finite typeclass application: For finite typeclass application we can print detailed information about specific instance, for example `:info (Eq Int)` must print assigned type/data families, module where instance is defined, maybe something else.
     23- Finite data type: as application type parameters to ordinary data type with parameters. Here we can print the same as for other finite type like Int
     25- Finite data family application: print information like for any other finite type, or, if type is not finite
     27- Finite type family application: print type assigned to this type family.
     29= Roadmap
     31I'll like to split the plan into multiple steps, a rough plan is to first aim for querying data/type family instances while getting to detailed plan about handling more general cases.