fork download
  1. {-# LANGUAGE KindSignatures #-}
  2. {-# LANGUAGE ExistentialQuantification #-}
  3. {-# LANGUAGE StandaloneDeriving #-}
  4. {-# LANGUAGE DeriveAnyClass #-}
  5.  
  6. import Data.Monoid
  7. import Data.Kind
  8. import Data.Functor.Identity
  9.  
  10. data Logger = LFile | LStdout deriving Show
  11.  
  12. data Database = DPG | DMem deriving Show
  13.  
  14. data App (m :: Type -> Type) = App
  15. { _logger :: m Logger
  16. , _db :: m Database
  17. }
  18.  
  19. deriving instance forall m a. Monoid (m a) => Monoid (App m)
  20.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
[1 of 1] Compiling Main             ( prog.hs, prog.o )

prog.hs:19:19: error:
    • Variable ‘a’ occurs more often
        in the constraint ‘Monoid (m a)’ than in the instance head
      (Use UndecidableInstances to permit this)
    • In the stand-alone deriving instance for
        ‘forall m a. Monoid (m a) => Monoid (App m)’
   |
19 | deriving instance forall m a. Monoid (m a) => Monoid (App m)
   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
stdout
Standard output is empty