remove TransformListComp which panics in ghc ≥ 9.6

This commit is contained in:
rhiannon morris 2024-07-07 16:22:14 +02:00
parent 6554dfd54c
commit 61fd58413f
3 changed files with 24 additions and 17 deletions

View file

@ -4,7 +4,7 @@
module Info
(Info (..),
tagsFor, descFor, imagesFor, linksFor, updatesFor, lastUpdate,
compareFor, sortFor,
CompareKey (..), compareKeyFor, compareFor, sortFor,
Artist (..), Images' (..), Images, Image (..), Desc (..), DescField (..),
Link (..), Update (..), Bg (..),
GalleryInfo (..), GalleryFilters (..), ArtistFilter (..), NsfwFilter (..),
@ -225,8 +225,14 @@ lastUpdate :: Bool -> Info -> Maybe Date
lastUpdate nsfw info =
case updatesFor nsfw info of [] -> Nothing; us -> Just $ fst $ last us
data CompareKey = MkCompareKey !Date !Text !Text
deriving (Eq, Ord)
compareKeyFor :: Bool -> Info -> CompareKey
compareKeyFor nsfw i = MkCompareKey (#latestDate i nsfw) (#sortEx i) (#title i)
compareFor :: Bool -> Info -> Info -> Ordering
compareFor nsfw = comparing \i -> (#latestDate i nsfw, #sortEx i, #title i)
compareFor nsfw = comparing $ compareKeyFor nsfw
sortFor :: Bool -> [Info] -> [Info]
sortFor = sortBy . compareFor