[GHC] #11439: Request for comments: Allow duplicate type signatures

GHC ghc-devs at haskell.org
Wed Feb 24 22:39:34 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 Iceland_jack):

 Replying to [comment:1 goldfire]:

 > 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 []
 >   #-}
 > }}}

 My gut feeling is that it must take local assumptions into account,
 swapping equations may confuse more than it helps (resulting from shifting
 equations around):

 {{{#!hs
 {-# TYPECHECK
 sum :: SBool False -> [Natural] -> Natural
 #-}
 sum STrue  x        = x

 {-# TYPECHECK
 sum :: SBool True -> Natural -> Natural
 #-}
 sum SFalse []       = 0
 sum SFalse (x : xs) = x + sum SFalse xs
 }}}

 One of my syntax suggestions was an attempt to capture the local
 assumptions (#11387?):

 {{{#!hs
 sum @False        :: SBool False -> [Natural] -> Natural
 sum @False SFalse ::                [Natural] -> Natural
 }}}

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


More information about the ghc-tickets mailing list