[GHC] #7395: DefaultSignatures conflict with default implementations

GHC ghc-devs at haskell.org
Wed May 17 14:18:50 UTC 2017


#7395: DefaultSignatures conflict with default implementations
-------------------------------------+-------------------------------------
        Reporter:  cgaebel           |                Owner:  (none)
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.6.1
      Resolution:                    |             Keywords:
                                     |  DefaultSignatures
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  GHC rejects       |  Unknown/Multiple
  valid program                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  7346              |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by Iceland_jack):

 Replying to [comment:19 aspiwack]:
 > I found myself, today, in a situation where I wanted to have two default
 signatures, something like:

 You might be interested in
 [https://gist.github.com/Icelandjack/e1ddefb0d5a79617a81ee98c49fbbdc4 an
 idea] I'm developing,

 {{{#!hs
 newtype WrapInt  = WrapInt  Int
 newtype WrapBool = WrapBool Bool

 instance Foo WrapInt where
   foo :: WrapInt
   foo = WrapInt 0

 instance Foo WrapBool where
   foo :: WrapBool
   foo = WrapBool False
 }}}

 and you should be able to derive

 {{{#!hs
 newtype I = MkI Int
   deriving as WrapInt (Foo)

 newtype B = MkB Bool
   deriving as WrapBool (Foo)
 }}}

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


More information about the ghc-tickets mailing list