Skip to content

Suggest default definition of Applicative

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:

<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
Trac metadata
Trac field Value
Version 8.1
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component GHCi
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information