Inconsistent treatment of FlexibleInstances and MPTCs with standard vs. flexible deriving
Given {-# LANGUAGE GeneralizedNewtypeDeriving #-}
, I can write
import Control.Monad.State.Strict
newtype Foo s m a = Foo (StateT s m a)
deriving (Functor, Applicative, Monad, MonadState s)
However, if I want to use StandaloneDeriving
to make the MonadState
instance more explicit,
deriving instance Monad m => MonadState s (Foo s m)
I suddenly need to add FlexibleInstances
and MultiParamTypeClasses
.
In my personal opinion, the most sensible way to handle this is to change two things in two different directions:
- Allow MPTC instance declarations (but not class declarations) without
MultiParamTypeClasses
. - Require
FlexibleInstances
for standard deriving clauses when they would be required for standalone deriving declarations.
Trac metadata
Trac field | Value |
---|---|
Version | 8.1 |
Type | FeatureRequest |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler (Type checker) |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |