Use explicit deriving strategies

This commit is contained in:
Andrzej Rybczak 2024-10-06 15:39:24 +02:00
parent 96ebf667a3
commit e2b1ffadf8
12 changed files with 31 additions and 18 deletions

View File

@ -29,7 +29,10 @@ source-repository head
location: https://github.com/haskell-effectful/effectful.git
common language
ghc-options: -Wall -Wcompat -Wno-unticked-promoted-constructors
ghc-options: -Wall
-Wcompat
-Wno-unticked-promoted-constructors
-Wmissing-deriving-strategies
-Werror=prepositive-qualified-module
default-language: Haskell2010

View File

@ -238,7 +238,7 @@ tryError m = (Right <$> m) `catchError` \es e -> pure $ Left (es, e)
-- Helpers
newtype ErrorId = ErrorId Unique
deriving Eq
deriving newtype Eq
-- | A unique is picked so that distinct 'Error' handlers for the same type
-- don't catch each other's exceptions.

View File

@ -119,7 +119,7 @@ type role Eff nominal representational
--
-- - Allows the effects to be handled in any order.
newtype Eff (es :: [Effect]) a = Eff (Env es -> IO a)
deriving (Monoid, Semigroup)
deriving newtype (Monoid, Semigroup)
-- | Run a pure 'Eff' computation.
--

View File

@ -96,7 +96,7 @@ data UnliftStrategy
-- ^ The concurrent strategy makes it possible for the unlifting function to
-- be called in threads distinct from its creator. See 'Persistence' and
-- 'Limit' settings for more information.
deriving (Eq, Generic, Ord, Show)
deriving stock (Eq, Generic, Ord, Show)
-- | Persistence setting for the 'ConcUnlift' strategy.
--
@ -116,7 +116,7 @@ data Persistence
| Persistent
-- ^ Persist the environment between calls to the unlifting function within a
-- particular thread.
deriving (Eq, Generic, Ord, Show)
deriving stock (Eq, Generic, Ord, Show)
-- | Limit setting for the 'ConcUnlift' strategy.
data Limit
@ -135,7 +135,7 @@ data Limit
-- when called in @N@ threads and @K+1@ copies when called in @K < N@ threads.
| Unlimited
-- ^ Unlimited use of the unlifting function.
deriving (Eq, Generic, Ord, Show)
deriving stock (Eq, Generic, Ord, Show)
----------------------------------------
-- Unlift functions
@ -229,7 +229,7 @@ persistentConcUnlift es0 cleanUp threads k = do
-- Data types
newtype EntryId = EntryId Int
deriving Eq
deriving newtype Eq
newEntryId :: EntryId
newEntryId = EntryId 0

View File

@ -47,7 +47,7 @@ data OnEmptyPolicy
--
-- /Note:/ state modifications are rolled back on 'Empty' only. In particular,
-- they are __not__ rolled back on exceptions.
deriving (Eq, Generic, Ord, Show)
deriving stock (Eq, Generic, Ord, Show)
-- | Run the 'NonDet' effect with a given 'OnEmptyPolicy'.
--

View File

@ -25,7 +25,10 @@ source-repository head
location: https://github.com/haskell-effectful/effectful.git
common language
ghc-options: -Wall -Wcompat -Wno-unticked-promoted-constructors
ghc-options: -Wall
-Wcompat
-Wno-unticked-promoted-constructors
-Wmissing-deriving-strategies
-Werror=prepositive-qualified-module
default-language: Haskell2010

View File

@ -72,7 +72,7 @@ errState = do
err
newtype MyString = MyString String
deriving (IsString, Eq, Show)
deriving newtype (IsString, Eq, Show)
data Janky = forall s. Janky (forall _i. Eff '[State s] ())

View File

@ -25,7 +25,10 @@ source-repository head
location: https://github.com/haskell-effectful/effectful.git
common language
ghc-options: -Wall -Wcompat -Wno-unticked-promoted-constructors
ghc-options: -Wall
-Wcompat
-Wno-unticked-promoted-constructors
-Wmissing-deriving-strategies
-Werror=prepositive-qualified-module
default-language: Haskell2010

View File

@ -363,7 +363,7 @@ fe_tryFileSize :: FE.Has FE_File sig m => FilePath -> m (Maybe Int)
fe_tryFileSize = FE.send . FE_tryFileSize
newtype FE_FileC m a = FE_FileC { fe_runFileC :: m a }
deriving (Applicative, Functor, Monad, MonadIO)
deriving newtype (Applicative, Functor, Monad, MonadIO)
instance
( MonadIO m
@ -380,7 +380,7 @@ fe_logMsg :: FE.Has FE_Logging sig m => String -> m ()
fe_logMsg = FE.send . FE_logMsg . T.pack
newtype FE_LoggingC m a = FE_LoggingC { fe_runLoggingC :: FE.StateC [Text] m a }
deriving (Applicative, Functor, Monad)
deriving newtype (Applicative, Functor, Monad)
instance
( FE.Algebra sig m
@ -440,7 +440,7 @@ class Monad m => MonadFile m where
mtl_tryFileSize :: FilePath -> m (Maybe Int)
newtype FileT m a = FileT { runFileT :: m a }
deriving (Functor, Applicative, Monad, MonadIO)
deriving newtype (Functor, Applicative, Monad, MonadIO)
instance M.MonadTrans FileT where
lift = FileT
@ -459,7 +459,7 @@ class Monad m => MonadLog m where
mtl_logMsg :: String -> m ()
newtype LoggingT m a = LoggingT (M.StateT [Text] m a)
deriving (Functor, Applicative, Monad, MonadIO, M.MonadTrans)
deriving newtype (Functor, Applicative, Monad, MonadIO, M.MonadTrans)
instance {-# OVERLAPPABLE #-}
( MonadLog m

View File

@ -34,7 +34,10 @@ flag benchmark-foreign-libraries
default: False
common language
ghc-options: -Wall -Wcompat -Wno-unticked-promoted-constructors
ghc-options: -Wall
-Wcompat
-Wno-unticked-promoted-constructors
-Wmissing-deriving-strategies
-Werror=prepositive-qualified-module
default-language: Haskell2010

View File

@ -474,7 +474,7 @@ data Conc :: [Effect] -> Type -> Type where
Alt :: Conc es a -> Conc es a -> Conc es a
Empty :: Conc es a
deriving instance Functor (Conc es)
deriving stock instance Functor (Conc es)
instance Applicative (Conc es) where
pure = Pure

View File

@ -43,5 +43,6 @@ assertThrowsErrorCall
=> String -> Eff es a -> Eff es ()
assertThrowsErrorCall err = assertThrows err (\ErrorCall{} -> True)
data Ex = Ex deriving (Eq, Show)
data Ex = Ex
deriving stock (Eq, Show)
instance Exception Ex