Skip to content

Commit f309224

Browse files
authored
Minor refactors in UpdateVersions.purs (#17)
1 parent ab49dee commit f309224

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/update.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Setup/UpdateVersions.purs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import Data.Argonaut.Encode ((:=), (~>))
1313
import Data.Array (foldl)
1414
import Data.Array as Array
1515
import Data.Either (Either(..), hush)
16-
import Data.Foldable (fold)
16+
import Data.Foldable (fold, maximum)
1717
import Data.Int (toNumber)
1818
import Data.Maybe (Maybe(..), fromMaybe, isNothing)
1919
import Data.String as String
@@ -128,9 +128,9 @@ fetchLatestReleaseVersion tool = Tool.repository tool # case tool of
128128
, printJsonDecodeError e
129129
]
130130
Right isDraft ->
131-
if isDraft
132-
then pure Nothing
133-
else pure (Just version)
131+
pure if isDraft
132+
then Nothing
133+
else Just version
134134

135135
tagStrToVersion tagStr =
136136
tagStr
@@ -158,10 +158,9 @@ fetchLatestReleaseVersion tool = Tool.repository tool # case tool of
158158

159159
Right arr -> do
160160
let
161-
tags = Array.catMaybes $ map (tagStrToVersion >>> hush) arr
162-
sorted = Array.reverse $ Array.sort tags
161+
tags = Array.mapMaybe (tagStrToVersion >>> hush) arr
163162

164-
case Array.head sorted of
163+
case maximum tags of
165164
Nothing ->
166165
throwError $ error "Could not download latest release version."
167166

0 commit comments

Comments
 (0)