[GHC] #11439: Request for comments: Allow duplicate type signatures
GHC
ghc-devs at haskell.org
Sat Jan 16 01:59:11 UTC 2016
#11439: Request for comments: Allow duplicate type signatures
-------------------------------------+-------------------------------------
Reporter: Iceland_jack | Owner:
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.10.3
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):
I do think something like this would be useful. But recall that type
signatures and function definitions need not be next to each other. And
I'm very suspicious of a proposal that cares about top-to-bottom ordering
of definitions (nowhere else in Haskell is that done).
On the other hand, this is a good idea for a pragma. Perhaps
{{{
foo :: a -> a
foo x = x
{-# TYPECHECK
foo :: Bool -> Bool
foo :: Int -> Int
foo :: Maybe a -> Maybe a
foo True :: Bool
map id []
#-}
}}}
The idea here is that the `TYPECHECK` pragma allows to you list a bunch of
expressions. GHC checks that the expressions are well-typed. If one isn't,
an error is issued. You could imagine Haddock looking for examples where
the expression is a type signature for a bare variable and then using the
types as extra documentation for that variable.
While we're at it, I'd also love
{{{
{-# ILL_TYPED
map True
False - 'x'
#-}
}}}
If an expression in `ILL_TYPED` is actually well-typed, an error is
issued. This would be very useful in putting in unit tests for fancy type-
level features.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11439#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list