[GHC] #13480: GHCi display visible type application

GHC ghc-devs at haskell.org
Sat Mar 25 15:25:17 UTC 2017


#13480: GHCi display visible type application
-------------------------------------+-------------------------------------
        Reporter:  Iceland_jack      |                Owner:  Iceland_jack
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #8751             |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by Iceland_jack):

 * owner:  (none) => Iceland_jack


Old description:

> Similar to #8751, have a way to get GHCi to dump which types an
> expression is applied to:
>
> {{{
> ghci> :tyapp length [1,2,3]
> length @[] @Integer [1,2,3]
> }}}
>
> It could also function as the [https://downloads.haskell.org/~ghc/master
> /users-guide/ghci.html#ghci-cmd-:all-types :all-types],
> [https://downloads.haskell.org/~ghc/master/users-guide/ghci.html#ghci-cmd
> -:type-at :type-at] commands where we can specify a region of code (from
> [https://www.researchgate.net/publication
> /282487445_Combining_Deep_and_Shallow_Embedding_of_Domain-
> Specific_Languages?ev=pubitem-pub_cit_inc Combining Deep and Shallow
> Embedding of Domain-Specific Languages])
>
> {{{#!hs
>   fromFunC :: FunC (m (Internal a)) -> Mon m a
>   fromFunC m   = M $ \k -> fromFunC Bind m k
> }}}
>
> displays
>
> {{{#!hs
>   fromFunC :: FunC (m (Internal a)) -> Mon m a
>   fromFunC m = M @m @a $ \(k :: a -> FunC (m b)) -> fromFunC @(FunC (m
> (Internal a)) -> (a -> FunC (m b)) -> FunC (m b)) (Bind @m @(Internal a)
> @b) m k
> }}}
>
> Would be great to get this feature as an IDE support.

New description:

 Similar to #8751, have a way to get GHCi to dump which types an expression
 is applied to:

 {{{
 ghci> :tyapp length [1,2,3]
 length @[] @Integer [1,2,3]
 }}}

 It could also function as the [https://downloads.haskell.org/~ghc/master
 /users-guide/ghci.html#ghci-cmd-:all-types :all-types],
 [https://downloads.haskell.org/~ghc/master/users-guide/ghci.html#ghci-cmd
 -:type-at :type-at] commands where we can specify a region of code (from
 [https://www.researchgate.net/publication
 /282487445_Combining_Deep_and_Shallow_Embedding_of_Domain-
 Specific_Languages?ev=pubitem-pub_cit_inc Combining Deep and Shallow
 Embedding of Domain-Specific Languages])

 {{{#!hs
   fromFunC :: FunC (m (Internal a)) -> Mon m a
   fromFunC m = M $ \k -> fromFunC Bind m k
 }}}

 displays

 {{{#!hs
   fromFunC :: FunC (m (Internal a)) -> Mon m a
   fromFunC m = M @m @a $ \(k :: a -> FunC (m b)) -> fromFunC @(FunC (m
 (Internal a)) -> (a -> FunC (m b)) -> FunC (m b)) (Bind @m @(Internal a)
 @b) m k
 }}}

 Would be great to get this feature as an IDE support.

--

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13480#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list