Changes between Initial Version and Version 1 of MoreInfo


Ignore:
Timestamp:
Dec 18, 2015 5:28:59 PM (4 years ago)
Author:
javran
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • 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.
     2
     3= Motiviation
     4
     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.
     7
     8= Design of New `:info` Syntax
     9
     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`.
     11
     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)
     13
     14* There are some special cases where `(` can also begin a regular query: `()`, `(,)`, `(,,,)`, they are treated in the old way.
     15
     16= Dealing With More General Queries
     17
     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
     20
     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.
     22
     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
     24
     25- Finite data family application: print information like for any other finite type, or, if type is not finite
     26
     27- Finite type family application: print type assigned to this type family.
     28
     29= Roadmap
     30
     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.