Version Bump: Removed some compile errors; mostly due to Eq is now a superclass of Hashable

This commit is contained in:
Stephan Barth 2024-01-21 04:24:47 +01:00
parent d5faeaefe3
commit dad1f6db7e
9 changed files with 30 additions and 24 deletions

View File

@ -17,5 +17,5 @@ import Control.Lens
import Data.Proxy import Data.Proxy
instance (ToSample a, Hashable a, Eq a) => ToSample (HashSet a) where instance (ToSample a, Hashable a) => ToSample (HashSet a) where
toSamples _ = over _2 HashSet.fromList <$> toSamples (Proxy @[a]) toSamples _ = over _2 HashSet.fromList <$> toSamples (Proxy @[a])

View File

@ -8,10 +8,11 @@ module Data.Set.Instances
( (
) where ) where
import ClassyPrelude --import ClassyPrelude
import qualified Data.Set as Set --import qualified Data.Set as Set
instance (Ord a, Hashable a) => Hashable (Set a) where -- Duplicate instance declaration: Defined in hashable-1.4.0.0:Data.Hashable.Class
hashWithSalt s xs = hashWithSalt s $ Set.toAscList xs --instance (Ord a, Hashable a) => Hashable (Set a) where
-- hashWithSalt s xs = hashWithSalt s $ Set.toAscList xs

View File

@ -30,11 +30,13 @@ import qualified Language.Haskell.TH as TH
import qualified Language.Haskell.TH.Syntax as TH import qualified Language.Haskell.TH.Syntax as TH
instance Hashable DiffTime where -- Duplicate instance declaration: Defined in time-compat-1.9.6.1:Data.Time.Orphans
hashWithSalt s = hashWithSalt s . toRational --instance Hashable DiffTime where
-- hashWithSalt s = hashWithSalt s . toRational
instance Hashable NominalDiffTime where -- Duplicate instance declaration: Defined in time-compat-1.9.6.1:Data.Time.Orphans
hashWithSalt s = hashWithSalt s . toRational --instance Hashable NominalDiffTime where
-- hashWithSalt s = hashWithSalt s . toRational
instance PersistField NominalDiffTime where instance PersistField NominalDiffTime where
toPersistValue = toPersistValue . toRational toPersistValue = toPersistValue . toRational
@ -45,7 +47,8 @@ instance PersistFieldSql NominalDiffTime where
deriving instance Generic Day deriving instance Generic Day
deriving instance Generic UTCTime deriving instance Generic UTCTime
instance Hashable UTCTime -- Duplicate instance declaration: Defined in time-compat-1.9.6.1:Data.Time.Orphans
--instance Hashable UTCTime
instance PathPiece UTCTime where instance PathPiece UTCTime where
toPathPiece = pack . iso8601Show toPathPiece = pack . iso8601Show

View File

@ -1,4 +1,4 @@
-- SPDX-FileCopyrightText: 2022 Gregor Kleen <gregor.kleen@ifi.lmu.de> -- SPDX-FileCopyrightText: 2024 Stephan Barth <stephan.barth@uniworx.de>, 2022 Gregor Kleen <gregor.kleen@ifi.lmu.de>
-- --
-- SPDX-License-Identifier: AGPL-3.0-or-later -- SPDX-License-Identifier: AGPL-3.0-or-later
@ -12,6 +12,8 @@ import ClassyPrelude
import Data.Universe import Data.Universe
instance (Eq b, Finite a) => Eq (a -> b) where
(==) f g = [ f k | k <- universeF ] == [ g k | k <- universeF ]
instance (Hashable a, Hashable b, Finite a) => Hashable (a -> b) where instance (Hashable a, Hashable b, Finite a) => Hashable (a -> b) where
hashWithSalt s f = s `hashWithSalt` [ (k, f k) | k <- universeF ] hashWithSalt s f = s `hashWithSalt` [ (k, f k) | k <- universeF ]

View File

@ -22,10 +22,10 @@ import Data.Universe
import Control.Monad.Fail import Control.Monad.Fail
instance (Eq a, Hashable a, Finite a, ToJSON b, ToJSONKey a) => ToJSON (a -> b) where instance (Hashable a, Finite a, ToJSON b, ToJSONKey a) => ToJSON (a -> b) where
toJSON f = toJSON $ HashMap.fromList [(k, f k) | k <- universeF] toJSON f = toJSON $ HashMap.fromList [(k, f k) | k <- universeF]
instance (Eq a, Hashable a, Finite a, FromJSON b, FromJSONKey a) => FromJSON (a -> b) where instance (Hashable a, Finite a, FromJSON b, FromJSONKey a) => FromJSON (a -> b) where
parseJSON val = asObject <|> asConst parseJSON val = asObject <|> asConst
where where
asObject = do asObject = do

View File

@ -255,10 +255,10 @@ data AuthContext = AuthContext
deriving stock instance Eq (AuthId UniWorX) => Eq AuthContext deriving stock instance Eq (AuthId UniWorX) => Eq AuthContext
deriving stock instance Ord (AuthId UniWorX) => Ord AuthContext deriving stock instance Ord (AuthId UniWorX) => Ord AuthContext
deriving stock instance (Read (AuthId UniWorX), Eq (AuthId UniWorX), Hashable (AuthId UniWorX)) => Read AuthContext deriving stock instance (Read (AuthId UniWorX), Hashable (AuthId UniWorX)) => Read AuthContext
deriving stock instance (Show (AuthId UniWorX), Eq (AuthId UniWorX), Hashable (AuthId UniWorX)) => Show AuthContext deriving stock instance (Show (AuthId UniWorX), Hashable (AuthId UniWorX)) => Show AuthContext
deriving anyclass instance Hashable (AuthId UniWorX) => Hashable AuthContext deriving anyclass instance Hashable (AuthId UniWorX) => Hashable AuthContext
deriving anyclass instance (Binary (AuthId UniWorX), Eq (AuthId UniWorX), Hashable (AuthId UniWorX)) => Binary AuthContext deriving anyclass instance (Binary (AuthId UniWorX), Hashable (AuthId UniWorX)) => Binary AuthContext
getAuthContext :: forall m. getAuthContext :: forall m.
( MonadHandler m, HandlerSite m ~ UniWorX ( MonadHandler m, HandlerSite m ~ UniWorX

View File

@ -504,10 +504,10 @@ data NavigationCacheKey
deriving stock instance Eq (AuthId UniWorX) => Eq NavigationCacheKey deriving stock instance Eq (AuthId UniWorX) => Eq NavigationCacheKey
deriving stock instance Ord (AuthId UniWorX) => Ord NavigationCacheKey deriving stock instance Ord (AuthId UniWorX) => Ord NavigationCacheKey
deriving stock instance (Read (AuthId UniWorX), Eq (AuthId UniWorX), Hashable (AuthId UniWorX)) => Read NavigationCacheKey deriving stock instance (Read (AuthId UniWorX), Hashable (AuthId UniWorX)) => Read NavigationCacheKey
deriving stock instance (Show (AuthId UniWorX), Eq (AuthId UniWorX), Hashable (AuthId UniWorX)) => Show NavigationCacheKey deriving stock instance (Show (AuthId UniWorX), Hashable (AuthId UniWorX)) => Show NavigationCacheKey
deriving anyclass instance Hashable (AuthId UniWorX) => Hashable NavigationCacheKey deriving anyclass instance Hashable (AuthId UniWorX) => Hashable NavigationCacheKey
deriving anyclass instance (Binary (AuthId UniWorX), Eq (AuthId UniWorX), Hashable (AuthId UniWorX)) => Binary NavigationCacheKey deriving anyclass instance (Binary (AuthId UniWorX), Hashable (AuthId UniWorX)) => Binary NavigationCacheKey
navAccess :: (MonadHandler m, HandlerSite m ~ UniWorX, MonadCatch m, WithRunDB SqlReadBackend (HandlerFor UniWorX) m, BearerAuthSite UniWorX) => Nav -> MaybeT m Nav navAccess :: (MonadHandler m, HandlerSite m ~ UniWorX, MonadCatch m, WithRunDB SqlReadBackend (HandlerFor UniWorX) m, BearerAuthSite UniWorX) => Nav -> MaybeT m Nav

View File

@ -86,10 +86,10 @@ data BearerToken site = BearerToken
deriving stock instance (Eq (AuthId site), Eq (Route site)) => Eq (BearerToken site) deriving stock instance (Eq (AuthId site), Eq (Route site)) => Eq (BearerToken site)
deriving stock instance (Ord (AuthId site), Ord (Route site)) => Ord (BearerToken site) deriving stock instance (Ord (AuthId site), Ord (Route site)) => Ord (BearerToken site)
deriving stock instance (Read (AuthId site), Eq (Route site), Hashable (Route site), Read (Route site), Hashable (AuthId site), Eq (AuthId site)) => Read (BearerToken site) deriving stock instance (Read (AuthId site), Hashable (Route site), Read (Route site), Hashable (AuthId site)) => Read (BearerToken site)
deriving stock instance (Show (AuthId site), Show (Route site), Hashable (AuthId site)) => Show (BearerToken site) deriving stock instance (Show (AuthId site), Show (Route site), Hashable (AuthId site)) => Show (BearerToken site)
deriving anyclass instance (Hashable (AuthId site), Hashable (Route site)) => Hashable (BearerToken site) deriving anyclass instance (Hashable (AuthId site), Hashable (Route site)) => Hashable (BearerToken site)
deriving anyclass instance (Binary (AuthId site), Binary (Route site), Hashable (Route site), Eq (Route site), Hashable (AuthId site), Eq (AuthId site)) => Binary (BearerToken site) deriving anyclass instance (Binary (AuthId site), Binary (Route site), Hashable (Route site), Hashable (AuthId site)) => Binary (BearerToken site)
makeLenses_ ''BearerToken makeLenses_ ''BearerToken
instance HasTokenIdentifier (BearerToken site) TokenId where instance HasTokenIdentifier (BearerToken site) TokenId where

View File

@ -1860,11 +1860,11 @@ instance TraversableWithIndex k (MergeHashMap k) where
itraverse = _MergeHashMap .> itraverse itraverse = _MergeHashMap .> itraverse
instance FoldableWithIndex k (MergeHashMap k) instance FoldableWithIndex k (MergeHashMap k)
instance (Eq k, Hashable k, Semigroup v) => Semigroup (MergeHashMap k v) where instance (Hashable k, Semigroup v) => Semigroup (MergeHashMap k v) where
(MergeHashMap a) <> (MergeHashMap b) = MergeHashMap $ HashMap.unionWith (<>) a b (MergeHashMap a) <> (MergeHashMap b) = MergeHashMap $ HashMap.unionWith (<>) a b
instance (Eq k, Hashable k, Semigroup v) => Monoid (MergeHashMap k v) where instance (Hashable k, Semigroup v) => Monoid (MergeHashMap k v) where
mempty = MergeHashMap HashMap.empty mempty = MergeHashMap HashMap.empty
instance (Eq k, Hashable k, FromJSON v, FromJSONKey k, Semigroup v) => FromJSON (MergeHashMap k v) where instance (Hashable k, FromJSON v, FromJSONKey k, Semigroup v) => FromJSON (MergeHashMap k v) where
parseJSON = case Aeson.fromJSONKey of parseJSON = case Aeson.fromJSONKey of
Aeson.FromJSONKeyCoerce -> Aeson.withObject "HashMap ~Text" $ Aeson.FromJSONKeyCoerce -> Aeson.withObject "HashMap ~Text" $
coerce @(Aeson.Parser (HashMap k v)) @(Aeson.Parser (MergeHashMap k v)) . fmap HashMap.fromList . traverse (\(k, v) -> (coerce @Text @k k, ) <$> parseJSON v Aeson.<?> Aeson.Key k) . HashMap.toList coerce @(Aeson.Parser (HashMap k v)) @(Aeson.Parser (MergeHashMap k v)) . fmap HashMap.fromList . traverse (\(k, v) -> (coerce @Text @k k, ) <$> parseJSON v Aeson.<?> Aeson.Key k) . HashMap.toList