From 922481cfd39543128396dca05c7a83588bcd332e Mon Sep 17 00:00:00 2001 From: pacien Date: Thu, 1 Dec 2022 20:00:12 +0100 Subject: compiler: fix build for ghc 9.2 --- compiler/package.yaml | 2 ++ compiler/src/Input.hs | 6 ++---- compiler/src/Resource.hs | 15 ++++++--------- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/compiler/package.yaml b/compiler/package.yaml index 04cafd4..539bf9d 100644 --- a/compiler/package.yaml +++ b/compiler/package.yaml @@ -33,6 +33,8 @@ dependencies: default-extensions: - DuplicateRecordFields +- DisambiguateRecordFields +- OverloadedRecordDot - DeriveGeneric - DeriveDataTypeable - DeriveAnyClass diff --git a/compiler/src/Input.hs b/compiler/src/Input.hs index 4cfabe6..7990571 100644 --- a/compiler/src/Input.hs +++ b/compiler/src/Input.hs @@ -1,7 +1,7 @@ -- ldgallery - A static generator which turns a collection of tagged -- pictures into a searchable web gallery. -- --- Copyright (C) 2019-2021 Pacien TRAN-GIRARD +-- Copyright (C) 2019-2022 Pacien TRAN-GIRARD -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU Affero General Public License as @@ -153,6 +153,4 @@ filterInputTree cond = filterNode filterNode :: InputTree -> InputTree filterNode inputFile@InputFile{} = inputFile filterNode inputDir@InputDir{items} = - filter cond items - & map filterNode - & \curatedItems -> inputDir { items = curatedItems } :: InputTree + inputDir { Input.items = filter cond items & map filterNode } diff --git a/compiler/src/Resource.hs b/compiler/src/Resource.hs index 1868512..e8ca58c 100644 --- a/compiler/src/Resource.hs +++ b/compiler/src/Resource.hs @@ -1,7 +1,7 @@ -- ldgallery - A static generator which turns a collection of tagged -- pictures into a searchable web gallery. -- --- Copyright (C) 2019-2021 Pacien TRAN-GIRARD +-- Copyright (C) 2019-2022 Pacien TRAN-GIRARD -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU Affero General Public License as @@ -56,7 +56,7 @@ encodingOptions :: JSON.Options encodingOptions = JSON.defaultOptions { JSON.fieldLabelModifier = map toLower , JSON.constructorTagModifier = map toLower - , JSON.sumEncoding = JSON.defaultTaggedObject + , JSON.sumEncoding = JSON.TaggedObject { JSON.tagFieldName = "type" , JSON.contentsFieldName = "contents" } @@ -180,7 +180,7 @@ buildGalleryTree processItem processThumbnail tagsFromDirsConfig = & map (prefix tagsFromDirsConfig ++) aggregateTags :: [GalleryItem] -> [Tag] - aggregateTags = concatMap (\item -> tags (item::GalleryItem)) + aggregateTags = concatMap Resource.tags maybeThumbnail :: Path -> Maybe Path -> IO (Maybe Thumbnail) maybeThumbnail _ Nothing = return Nothing @@ -188,7 +188,7 @@ buildGalleryTree processItem processThumbnail tagsFromDirsConfig = mostRecentModTime :: [GalleryItem] -> Maybe ZonedTime mostRecentModTime = - maximumByMay comparingTime . map (datetime::(GalleryItem -> ZonedTime)) + maximumByMay comparingTime . map Resource.datetime comparingTime :: ZonedTime -> ZonedTime -> Ordering comparingTime l r = compare (zonedTimeToUTC l) (zonedTimeToUTC r) @@ -220,14 +220,11 @@ galleryOutputDiff resources ref = resPath :: GalleryItemProps -> Maybe Path resPath Directory{} = Nothing - resPath resourceProps = - Just - $ resourcePath - $ (resource :: (GalleryItemProps -> Resource)) resourceProps + resPath resourceProps = Just $ resourcePath $ resourceProps.resource thumbnailPaths :: [GalleryItem] -> [Path] thumbnailPaths = - map (resourcePath . (resource :: (Thumbnail -> Resource))) + map (\thumbnail -> resourcePath thumbnail.resource) . mapMaybe thumbnail (\\) :: [Path] -> [Path] -> [Path] -- cgit v1.2.3