
#10963: Beginner-targeted language extension -------------------------------------+------------------------------------- Reporter: kanetw | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by goldfire): In a fit of frustration at the thought of teaching Haskell in a year's time without this feature, I've implemented it. Phab patch to be posted shortly. Here's the user's guide description. Bikeshedding and design improvements welcome. {{{ .. ghci-cmd:: :type-def; (expression) .. ghci-cmd:: :td; (expression) Infers and prints the type of (expression), defaulting type variables if possible. In this mode, if the inferred type is constrained by any interactive class (``Num``, ``Show``, ``Eq``, ``Ord``, ``Foldable``, or ``Traversable``), the constrained type variable(s) are defaulted according to the rules described under :ghc- flag:`-XExtendedDefaultRules`. This mode is quite useful when the inferred type is quite general (such as for ``foldr``) and it may be helpful to see a more concrete instantiation. }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10963#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler