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

GHC ghc-devs at haskell.org
Sat Jan 16 16:51:50 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:                    |
-------------------------------------+-------------------------------------
Changes (by adamgundry):

 * cc: adamgundry (added)


Comment:

 I'm not really convinced by the original ticket: couldn't you just as well
 do something like
 {{{#!hs
 sum :: SBool single -> IsSingleton single -> Natural
 sum STrue  = sumTrue
 sum SFalse = sumFalse

 sumTrue :: Natural -> Natural
 sumTrue  x        = x

 sumFalse :: [Natural] -> Natural
 sumFalse []       = 0
 sumFalse (x : xs) = x + sumFalse xs
 }}}
 without needing any additional syntax or rules for associating duplicate
 signatures with parts of definitions?

 On the other hand, being able to declare a bunch of specializations such
 that GHCi or Haddock can display them does seem rather useful, especially
 for the kind of very polymorphic code you get in `lens` or the post-FTP
 Prelude.

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


More information about the ghc-tickets mailing list