imp: ghc9.2: fix an incomplete-uni-pattern warning

This commit is contained in:
Simon Michael 2022-03-25 20:45:06 -10:00
parent 3eddd913e3
commit 5858bb7b6d

View File

@ -65,30 +65,32 @@ versionStringWith egitinfo progname packageversion =
| otherwise = os | otherwise = os
version = case egitinfo of version = case egitinfo of
Left _err -> packageversion Left _err -> packageversion
Right gitinfo -> intercalate "-" [packageversion , hash, date] Right gitinfo ->
where case words $ giCommitDate gitinfo of
hash = 'g' : take 9 (giHash gitinfo) -- like git describe -- git log's date format is normally --date=default ("similar to --date=rfc2822")
date = concat [year,mm,dd] _weekday:mon:day:_localtime:year:_offset:_ ->
where intercalate "-" [packageversion , hash, date]
-- XXX PARTIAL: depends on git log's date format, which by default where
-- is --date=default ("similar to --date=rfc2822"), but could be hash = 'g' : take 9 (giHash gitinfo) -- like git describe
-- overridden by a log.date config variable in repo or user git config. date = concat [year,mm,dd]
_weekday:mon:day:_localtime:year:_offset:_ = words $ giCommitDate gitinfo where
mm = fromMaybe mon $ lookup mon $ [ mm = fromMaybe mon $ lookup mon $ [
("Jan","01") ("Jan","01")
,("Feb","02") ,("Feb","02")
,("Mar","03") ,("Mar","03")
,("Apr","04") ,("Apr","04")
,("May","05") ,("May","05")
,("Jun","06") ,("Jun","06")
,("Jul","07") ,("Jul","07")
,("Aug","08") ,("Aug","08")
,("Sep","09") ,("Sep","09")
,("Oct","10") ,("Oct","10")
,("Nov","11") ,("Nov","11")
,("Dec","12") ,("Dec","12")
] ]
dd = (if length day < 2 then ('0':) else id) day dd = (if length day < 2 then ('0':) else id) day
-- but could be overridden by a log.date config variable in repo or user git config
_ -> packageversion
-- -- | Given a program name, return a precise platform-specific executable -- -- | Given a program name, return a precise platform-specific executable
-- -- name suitable for naming downloadable binaries. Can raise an error if -- -- name suitable for naming downloadable binaries. Can raise an error if