[GHC] #12363: Type application for infix
GHC
ghc-devs at haskell.org
Sat Aug 20 17:11:29 UTC 2016
#12363: Type application for infix
-------------------------------------+-------------------------------------
Reporter: Iceland_jack | Owner:
Type: feature request | Status: new
Priority: lowest | Milestone:
Component: Compiler | Version: 8.0.1
(Parser) | Keywords:
Resolution: | TypeApplications
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 Iceland_jack):
Replying to [comment:8 goldfire]:
> These examples are very helpful. Now that you have collected them, I
think a good next step is soliciting feedback from the community so that
we can see if others agree with you. I'll admit to becoming more convinced
by your examples, but I'm still leaning against. Other voices in agreement
with yours would make a big difference here.
I agree that this needs input from the community. The notation often feels
clunky and asymmetric, mathematicians would use subscript instead.
Visual type application (+ partial type signatures) have been very useful
* '''Interactive use''' Toying around, getting ''ghci'' to resolve
instances for me
{{{#!hs
mappend @(_ -> _) :: Monoid b => (a -> b) -> (a -> b) -> (a -> b)
quickCheck @(_ -> _) :: (Arbitrary a, Show a, Testable b) => (a ->
b) -> IO ()
quickCheck @(Int -> _) :: Testable b => (Int ->
b) -> IO ()
}}}
* '''Teaching''' Using valid Haskell syntax to simplify complex signatures
that users can verify on their own
{{{#!hs
length @[] :: [a] -> Int
sequence @[] @IO :: [IO a] -> IO [a]
}}}
Less so in actual code. The same seems true for this so I am not overly
concerned with the syntax.
Indeed most of the benefits of the examples don't have to do with actual
code, rather presenting concepts with explicit/valid syntax or interactive
use: allowing users to quickly specify a type without
rearranging/rewriting syntax and adding parentheses (`(.) @A (id @A) f`).
No need to muck about with expressions which reduces mental load: if you
want `<$>` for lists, write `<$> @[]`.
If it's all the same I will post examples until told to stop ;)
(for operators, `_` with no spaces looks nicer (`1 +_Int 10`) but I won't
seriously suggest it)
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12363#comment:9>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list