[GHC] #11692: Suggest default definition of Applicative

GHC ghc-devs at haskell.org
Thu Mar 10 06:16:20 UTC 2016


#11692: Suggest default definition of Applicative
-------------------------------------+-------------------------------------
           Reporter:  Iceland_jack   |             Owner:
               Type:  feature        |            Status:  new
  request                            |
           Priority:  normal         |         Milestone:
          Component:  GHCi           |           Version:  8.1
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  Incorrect
  Unknown/Multiple                   |  warning at compile-time
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 {{{#!hs
 ghci> data A a = A a deriving (Show, Functor)
 ghci> instance Monad A

 <interactive>:3:10: error:
     • No instance for (Applicative A)
         arising from the superclasses of an instance declaration
     • In the instance declaration for ‘Monad A’
 }}}

 could suggest defining it in terms of `Monad`:

 {{{#!hs
 <interactive>:3:10: error:
     • No instance for (Applicative A)
         arising from the superclasses of an instance declaration
     • In the instance declaration for ‘Monad A’
     • Default implementation given a `Monad` instance:
         instance Applicative A where
           pure  = return
           (<*>) = Control.Monad.ap
 }}}

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


More information about the ghc-tickets mailing list