aboutsummaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorpacien2022-12-01 20:00:12 +0100
committerpacien2022-12-01 20:39:42 +0100
commit922481cfd39543128396dca05c7a83588bcd332e (patch)
tree20f1411a4e20620d644f5b7900548d84f67dbd72 /compiler
parent84560140ee006c8bff7e2c2d4b7140fe9b09c62d (diff)
downloadldgallery-922481cfd39543128396dca05c7a83588bcd332e.tar.gz
compiler: fix build for ghc 9.2
Diffstat (limited to 'compiler')
-rw-r--r--compiler/package.yaml2
-rw-r--r--compiler/src/Input.hs6
-rw-r--r--compiler/src/Resource.hs15
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:
33 33
34default-extensions: 34default-extensions:
35- DuplicateRecordFields 35- DuplicateRecordFields
36- DisambiguateRecordFields
37- OverloadedRecordDot
36- DeriveGeneric 38- DeriveGeneric
37- DeriveDataTypeable 39- DeriveDataTypeable
38- DeriveAnyClass 40- 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 @@
1-- ldgallery - A static generator which turns a collection of tagged 1-- ldgallery - A static generator which turns a collection of tagged
2-- pictures into a searchable web gallery. 2-- pictures into a searchable web gallery.
3-- 3--
4-- Copyright (C) 2019-2021 Pacien TRAN-GIRARD 4-- Copyright (C) 2019-2022 Pacien TRAN-GIRARD
5-- 5--
6-- This program is free software: you can redistribute it and/or modify 6-- This program is free software: you can redistribute it and/or modify
7-- it under the terms of the GNU Affero General Public License as 7-- it under the terms of the GNU Affero General Public License as
@@ -153,6 +153,4 @@ filterInputTree cond = filterNode
153 filterNode :: InputTree -> InputTree 153 filterNode :: InputTree -> InputTree
154 filterNode inputFile@InputFile{} = inputFile 154 filterNode inputFile@InputFile{} = inputFile
155 filterNode inputDir@InputDir{items} = 155 filterNode inputDir@InputDir{items} =
156 filter cond items 156 inputDir { Input.items = filter cond items & map filterNode }
157 & map filterNode
158 & \curatedItems -> inputDir { items = curatedItems } :: InputTree
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 @@
1-- ldgallery - A static generator which turns a collection of tagged 1-- ldgallery - A static generator which turns a collection of tagged
2-- pictures into a searchable web gallery. 2-- pictures into a searchable web gallery.
3-- 3--
4-- Copyright (C) 2019-2021 Pacien TRAN-GIRARD 4-- Copyright (C) 2019-2022 Pacien TRAN-GIRARD
5-- 5--
6-- This program is free software: you can redistribute it and/or modify 6-- This program is free software: you can redistribute it and/or modify
7-- it under the terms of the GNU Affero General Public License as 7-- it under the terms of the GNU Affero General Public License as
@@ -56,7 +56,7 @@ encodingOptions :: JSON.Options
56encodingOptions = JSON.defaultOptions 56encodingOptions = JSON.defaultOptions
57 { JSON.fieldLabelModifier = map toLower 57 { JSON.fieldLabelModifier = map toLower
58 , JSON.constructorTagModifier = map toLower 58 , JSON.constructorTagModifier = map toLower
59 , JSON.sumEncoding = JSON.defaultTaggedObject 59 , JSON.sumEncoding = JSON.TaggedObject
60 { JSON.tagFieldName = "type" 60 { JSON.tagFieldName = "type"
61 , JSON.contentsFieldName = "contents" 61 , JSON.contentsFieldName = "contents"
62 } 62 }
@@ -180,7 +180,7 @@ buildGalleryTree processItem processThumbnail tagsFromDirsConfig =
180 & map (prefix tagsFromDirsConfig ++) 180 & map (prefix tagsFromDirsConfig ++)
181 181
182 aggregateTags :: [GalleryItem] -> [Tag] 182 aggregateTags :: [GalleryItem] -> [Tag]
183 aggregateTags = concatMap (\item -> tags (item::GalleryItem)) 183 aggregateTags = concatMap Resource.tags
184 184
185 maybeThumbnail :: Path -> Maybe Path -> IO (Maybe Thumbnail) 185 maybeThumbnail :: Path -> Maybe Path -> IO (Maybe Thumbnail)
186 maybeThumbnail _ Nothing = return Nothing 186 maybeThumbnail _ Nothing = return Nothing
@@ -188,7 +188,7 @@ buildGalleryTree processItem processThumbnail tagsFromDirsConfig =
188 188
189 mostRecentModTime :: [GalleryItem] -> Maybe ZonedTime 189 mostRecentModTime :: [GalleryItem] -> Maybe ZonedTime
190 mostRecentModTime = 190 mostRecentModTime =
191 maximumByMay comparingTime . map (datetime::(GalleryItem -> ZonedTime)) 191 maximumByMay comparingTime . map Resource.datetime
192 192
193 comparingTime :: ZonedTime -> ZonedTime -> Ordering 193 comparingTime :: ZonedTime -> ZonedTime -> Ordering
194 comparingTime l r = compare (zonedTimeToUTC l) (zonedTimeToUTC r) 194 comparingTime l r = compare (zonedTimeToUTC l) (zonedTimeToUTC r)
@@ -220,14 +220,11 @@ galleryOutputDiff resources ref =
220 220
221 resPath :: GalleryItemProps -> Maybe Path 221 resPath :: GalleryItemProps -> Maybe Path
222 resPath Directory{} = Nothing 222 resPath Directory{} = Nothing
223 resPath resourceProps = 223 resPath resourceProps = Just $ resourcePath $ resourceProps.resource
224 Just
225 $ resourcePath
226 $ (resource :: (GalleryItemProps -> Resource)) resourceProps
227 224
228 thumbnailPaths :: [GalleryItem] -> [Path] 225 thumbnailPaths :: [GalleryItem] -> [Path]
229 thumbnailPaths = 226 thumbnailPaths =
230 map (resourcePath . (resource :: (Thumbnail -> Resource))) 227 map (\thumbnail -> resourcePath thumbnail.resource)
231 . mapMaybe thumbnail 228 . mapMaybe thumbnail
232 229
233 (\\) :: [Path] -> [Path] -> [Path] 230 (\\) :: [Path] -> [Path] -> [Path]