I want to take a pattern and get a set of matching types. The set of types does not need to be complete, but it needs to satisfy, say, 90% of the cases.
Here's is a (definitely not complete) set of examples:
arg_ -> "Arbitrary" arg__ -> "Arbitrary sequence" arg___ -> "Arbitrary blank sequence" a__Head -> "Head sequence" a_?IntegerQ -> "Integer" b_Real -> "Real number" b_Real?Internal`RealValuedNumericQ -> "Real number" b_?(Not@*IntegerQ) :> "Arbitrary non-integer" b_?randomTest -> If[MatchQ[randomTest, Symbol], "Arbitrary object passing randomTest", "Indeterminate" ] b_?(Not@*randomTest) :> "Arbitrary object failing randomTest" OptionsPattern -> "Options" ops : OptionsPattern -> "Options"
Being able to spelunk like this will allow me to automatically generate more useful documentation than the trash I generate right now. Even better, we can finally document lots of WRIs trash in a useful way. Bonus points if you can take this and extend it to return a reasonable example a user could execute to get a sense for what the function does.
TypeSystem`$AtomPattern HoldPattern[ Integer | Real | String | TypeSystem`Boolean | Rational | TypeSystem`Enumeration[__String] | DateObject | TimeObject | TemporalData | Image | Entity[_String] | _Quantity?TypeSystem`ValidQuantityQ | GeoPosition | Graph | Graphics | GeoGraphics | Sound | CloudObject | File | URL | Hyperlink | IPAddress | HTTPResponse | HTTPRequest | TypeSystem`AnyType]