Skip to content

Commit 23cbb4b

Browse files
Fix warnings (#636)
1 parent a6132b8 commit 23cbb4b

File tree

8 files changed

+11
-21
lines changed

8 files changed

+11
-21
lines changed

app/src/App/API.purs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ module Registry.App.API
1616

1717
import Registry.App.Prelude
1818

19-
import Control.Alternative as Alternative
2019
import Data.Argonaut.Parser as Argonaut.Parser
2120
import Data.Array as Array
2221
import Data.Array.NonEmpty as NEA
@@ -177,7 +176,7 @@ packageSetUpdate payload = do
177176
prevVersion <- Map.lookup name prevPackages
178177
-- We want to fail if the existing version is greater than the
179178
-- new proposed version.
180-
Alternative.guard (prevVersion > newVersion)
179+
guard (prevVersion > newVersion)
181180
pure (Tuple name { old: prevVersion, new: newVersion })
182181

183182
when (not (Array.null downgradedPackages)) do
@@ -707,7 +706,7 @@ validateResolutions manifest resolutions = do
707706
]
708707

709708
missingPackagesError = do
710-
guardA (not Array.null missingPackages)
709+
guard (not Array.null missingPackages)
711710
pure
712711
$ String.joinWith "\n - "
713712
$ Array.cons "The build plan is missing dependencies that are listed in the manifest:"
@@ -724,7 +723,7 @@ validateResolutions manifest resolutions = do
724723
]
725724

726725
incorrectVersionsError = do
727-
guardA (not Array.null incorrectVersions)
726+
guard (not Array.null incorrectVersions)
728727
pure
729728
$ String.joinWith "\n - "
730729
$ Array.cons "The build plan provides dependencies at versions outside the range listed in the manifest:"

app/src/App/Effect/PackageSets.purs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ module Registry.App.Effect.PackageSets where
55

66
import Registry.App.Prelude
77

8-
import Control.Alternative (guard)
98
import Data.Array as Array
109
import Data.DateTime as DateTime
1110
import Data.Filterable as Filterable
@@ -308,17 +307,17 @@ handle env = case _ of
308307
commitMessage :: PackageSet -> ChangeSet -> Version -> String
309308
commitMessage (PackageSet set) accepted newVersion = String.joinWith "\n" $ fold
310309
[ [ "Release " <> Version.print newVersion <> " package set.\n" ]
311-
, guardA (not (Array.null added)) $> (addedLines <> "\n")
312-
, guardA (not (Array.null updated)) $> (updatedLines <> "\n")
313-
, guardA (not (Array.null removed)) $> (removedLines <> "\n")
310+
, guard (not (Array.null added)) $> (addedLines <> "\n")
311+
, guard (not (Array.null updated)) $> (updatedLines <> "\n")
312+
, guard (not (Array.null removed)) $> (removedLines <> "\n")
314313
]
315314
where
316315
added = do
317316
Tuple packageName change <- Map.toUnfoldable accepted
318317
version <- case change of
319318
Remove -> []
320319
Update version -> [ version ]
321-
guardA (not (Map.member packageName set.packages))
320+
guard (not (Map.member packageName set.packages))
322321
pure $ Tuple packageName version
323322

324323
addedLines = "New packages:\n" <> String.joinWith "\n" do
@@ -339,7 +338,7 @@ commitMessage (PackageSet set) accepted newVersion = String.joinWith "\n" $ fold
339338

340339
removed = do
341340
Tuple packageName change <- Map.toUnfoldable accepted
342-
guardA (change == Remove)
341+
guard (change == Remove)
343342
version <- maybe [] pure (Map.lookup packageName set.packages)
344343
pure $ Tuple packageName version
345344

app/src/App/Effect/Storage.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ handleS3 env = Cache.interpret _storageCache (Cache.handleFs env.cache) <<< case
136136
$ resources
137137
>>= \resource -> do
138138
{ name: parsedName, version } <- Array.fromFoldable $ parsePackagePath resource
139-
version <$ guardA (name == parsedName)
139+
version <$ guard (name == parsedName)
140140

141141
Download name version path reply -> map (map reply) Except.runExcept do
142142
let package = formatPackageVersion name version

app/src/App/Prelude.purs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ module Registry.App.Prelude
55
, class Functor2
66
, formatPackageVersion
77
, fromJust'
8-
, guardA
98
, map2
109
, mapKeys
1110
, module Either
@@ -34,7 +33,7 @@ module Registry.App.Prelude
3433
import Prelude
3534

3635
import Control.Alt ((<|>)) as Extra
37-
import Control.Alternative (class Alternative, empty)
36+
import Control.Alternative (guard) as Extra
3837
import Control.Monad.Except (ExceptT(..)) as Extra
3938
import Control.Monad.Trans.Class (lift) as Extra
4039
import Control.Parallel.Class as Parallel
@@ -148,9 +147,6 @@ mapKeys k = Map.fromFoldable <<< map (Extra.lmap k) <<< (Map.toUnfoldable :: _ -
148147
traverseKeys :: forall a b v. Ord a => Ord b => (a -> Either.Either String b) -> Extra.Map a v -> Either.Either String (Extra.Map b v)
149148
traverseKeys k = map Map.fromFoldable <<< Extra.traverse (Extra.ltraverse k) <<< (Map.toUnfoldable :: _ -> Array _)
150149

151-
guardA :: forall f. Alternative f => Boolean -> f Unit
152-
guardA = if _ then pure unit else empty
153-
154150
-- | Attempt an effectful computation with exponential backoff.
155151
withBackoff' :: forall a. Extra.Aff a -> Extra.Aff (Maybe.Maybe a)
156152
withBackoff' action = withBackoff

app/test/App/CLI/Purs.purs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ module Test.Registry.App.CLI.Purs (spec) where
22

33
import Registry.App.Prelude
44

5-
import Data.Array as Array
65
import Data.Foldable (traverse_)
76
import Node.FS.Aff as FS.Aff
87
import Node.Path as Path

scripts/src/CompilerVersions.purs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import ArgParse.Basic as Arg
77
import Data.Array as Array
88
import Data.Array.NonEmpty as NEA
99
import Data.Formatter.DateTime as Formatter.DateTime
10-
import Data.List (filterM)
1110
import Data.Map as Map
1211
import Data.String as String
1312
import Data.Tuple (uncurry)
@@ -35,7 +34,6 @@ import Registry.Internal.Format as Internal.Format
3534
import Registry.Manifest (Manifest(..))
3635
import Registry.ManifestIndex as ManifestIndex
3736
import Registry.PackageName as PackageName
38-
import Registry.Range as Range
3937
import Registry.Version as Version
4038
import Run (AFF, EFFECT, Run)
4139
import Run as Run

scripts/src/LegacyImporter.purs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import Registry.App.Prelude
1010

1111
import ArgParse.Basic (ArgParser)
1212
import ArgParse.Basic as Arg
13-
import Control.Alternative (guard)
1413
import Control.Apply (lift2)
1514
import Data.Array as Array
1615
import Data.Codec.Argonaut as CA

scripts/src/PackageSetUpdater.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ findRecentUploads limit = do
179179
versions <- Array.fromFoldable $ NonEmptyArray.fromArray do
180180
Tuple version { publishedTime } <- Map.toUnfoldable metadata.published
181181
let diff = DateTime.diff now publishedTime
182-
guardA (diff <= limit)
182+
guard (diff <= limit)
183183
pure version
184184
pure (Tuple name versions)
185185

0 commit comments

Comments
 (0)