aws-arn 0.3.1.0 → 0.3.2.0
raw patch · 10 files changed
+51/−136 lines, 10 filesdep +microlens-prodep ~basedep ~hashabledep ~tastyPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies added: microlens-pro
Dependency ranges changed: base, hashable, tasty, text
API changes (from Hackage documentation)
- Network.AWS.ARN.Internal.Lens: (.~) :: Setter s a -> a -> s -> s
- Network.AWS.ARN.Internal.Lens: (^.) :: s -> Getting a s a -> a
- Network.AWS.ARN.Internal.Lens: (^?) :: s -> Prism' s a -> Maybe a
- Network.AWS.ARN.Internal.Lens: Exchange :: (s -> a) -> (b -> t) -> Exchange a b s t
- Network.AWS.ARN.Internal.Lens: data Exchange a b s t
- Network.AWS.ARN.Internal.Lens: from :: AnIso' s a -> Iso' a s
- Network.AWS.ARN.Internal.Lens: infixl 8 ^?
- Network.AWS.ARN.Internal.Lens: infixr 4 .~
- Network.AWS.ARN.Internal.Lens: instance Data.Profunctor.Unsafe.Profunctor (Network.AWS.ARN.Internal.Lens.Exchange a b)
- Network.AWS.ARN.Internal.Lens: iso :: (s -> a) -> (a -> s) -> Iso' s a
- Network.AWS.ARN.Internal.Lens: ix :: Int -> Traversal' [a] a
- Network.AWS.ARN.Internal.Lens: over :: Setter s a -> (a -> a) -> s -> s
- Network.AWS.ARN.Internal.Lens: preview :: Prism' s a -> s -> Maybe a
- Network.AWS.ARN.Internal.Lens: prism' :: forall s a. (a -> s) -> (s -> Maybe a) -> Prism' s a
- Network.AWS.ARN.Internal.Lens: review :: Prism' s a -> a -> s
- Network.AWS.ARN.Internal.Lens: set :: Setter s a -> a -> s -> s
- Network.AWS.ARN.Internal.Lens: type Traversal' s a = forall f. Applicative f => (a -> f a) -> s -> f s
- Network.AWS.ARN.Internal.Lens: type AnIso' s a = Exchange a a a (Identity a) -> Exchange a a s (Identity s)
- Network.AWS.ARN.Internal.Lens: type Getting r s a = (a -> Const r a) -> s -> Const r s
- Network.AWS.ARN.Internal.Lens: type Setter s a = (a -> Identity a) -> s -> Identity s
- Network.AWS.ARN.Internal.Lens: type Iso' s a = forall p f. (Profunctor p, Functor f) => p a (f a) -> p s (f s)
Files
- CHANGELOG.md +4/−0
- README.md +17/−7
- aws-arn.cabal +19/−21
- src/Network/AWS/ARN.hs +2/−2
- src/Network/AWS/ARN/Internal/Lens.hs +0/−97
- src/Network/AWS/ARN/Lambda.hs +2/−2
- src/Network/AWS/ARN/S3.hs +2/−2
- test/Network/AWS/ARN/Lambda/Test.hs +1/−1
- test/Network/AWS/ARN/S3/Test.hs +3/−3
- test/Network/AWS/ARN/Test.hs +1/−1
CHANGELOG.md view
@@ -1,5 +1,9 @@ # Revision history for aws-arn +## 0.3.2.0 -- 2024-08-22++* Use prisms and isos from `microlens-pro`.+ ## 0.3.1.0 -- 2023-03-01 * Add `Network.AWS.ARN.S3` with support for S3 bucket and object ARNs.
README.md view
@@ -55,8 +55,7 @@ `test/Network/AWS/ARN/SomeAWSService/Test.hs` 4. Define a `_Foo` `Prism'` that combines the parsing/unparsing- functions above. Use the local definitions of prisms in- `Network.AWS.ARN.Internal.Lens`:+ functions above: ```haskell _Function :: Prism' Text Function@@ -80,22 +79,33 @@ 6. Test your work and make a PR. -## Formatters+## Formatting code The formatters used in this repo are provided by `shell.nix`: -* `*.hs`: [`ormolu`](https://github.com/tweag/ormolu)-* `*.cabal`:+- `*.hs`: [`ormolu`](https://github.com/tweag/ormolu)+- `*.cabal`: [`cabal-fmt`](https://hackage.haskell.org/package/cabal-fmt) (`cabal-fmt --inplace aws-arn.cabal`)-* `*.nix`:+- `*.nix`: [`nixpkgs-fmt`](https://github.com/nix-community/nixpkgs-fmt) (`nixpkgs-fmt *.nix`) -## Regenerate CI+## Regenerating CI This repo uses `haskell-ci`, which is provided by `shell.nix`: ```shell haskell-ci regenerate ```++### Fixing CI not being able to install tools++So you ran the above command but `haskell-ci` couldn't install one of its tools+(e.g. `hlint`, `doctest`) due to version incompatibilities. `haskell-ci`+selects particular versions by default, but this can be changed with command+line flags (e.g. `--hlint-version '>=3.5 && <3.6'`, `--doctest-version ==0.20.1`).+If you do this, please check+[`haskell-ci`](https://github.com/haskell-CI/haskell-ci); if the HEAD version+does not select the latest version of a tool, please contribute a PR to that+repository.
aws-arn.cabal view
@@ -1,11 +1,10 @@-cabal-version: 2.2-name: aws-arn-version: 0.3.1.0+cabal-version: 2.2+name: aws-arn+version: 0.3.2.0 synopsis: Types and optics for manipulating Amazon Resource Names (ARNs) description:- This library provides a type representing [Amazon Resource Names (ARNs)](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html), and parsing/unparsing functions for them. The provided prisms, when@@ -26,21 +25,20 @@ add this support for more AWS resource types are __especially__ welcome. -bug-reports: http://github.com/bellroy/aws-arn/issues-license: BSD-3-Clause-license-file: LICENSE-author: Bellroy Tech Team <haskell@bellroy.com>-maintainer: Bellroy Tech Team <haskell@bellroy.com>-copyright: Copyright (C) 2020-2022 Bellroy Pty Ltd-category: AWS, Cloud-build-type: Simple-extra-source-files:+bug-reports: http://github.com/bellroy/aws-arn/issues+license: BSD-3-Clause+license-file: LICENSE+author: Bellroy Tech Team <haskell@bellroy.com>+maintainer: Bellroy Tech Team <haskell@bellroy.com>+copyright: Copyright (C) 2020-2022 Bellroy Pty Ltd+category: AWS, Cloud+build-type: Simple+extra-doc-files: CHANGELOG.md README.md --- Once hlint supports GHC 9.2.2, we can add it to tested-with;--- Otherwise a hlint build failure breaks CI.-tested-with: GHC ==8.6.5 || ==8.8.4 || ==8.10.7 || ==9.0.2+tested-with:+ GHC ==8.10.7 || ==9.0.2 || ==9.2.5 || ==9.4.5 || ==9.6.6 || ==9.8.2 common opts default-language: Haskell2010@@ -53,21 +51,21 @@ common deps build-depends:- , base >=4.12 && <4.18+ , base >=4.12 && <4.20 , deriving-compat >=0.5.10 && <0.7+ , microlens-pro ^>=0.2 , profunctors >=5.0 && <5.7 , tagged ^>=0.8- , text ^>=1.2.3 || ^>=2.0+ , text ^>=1.2.3 || ^>=2.0 || ^>=2.1 library import: opts, deps exposed-modules: Network.AWS.ARN- Network.AWS.ARN.Internal.Lens Network.AWS.ARN.Lambda Network.AWS.ARN.S3 - build-depends: hashable >=1.3.0.0 && <1.5+ build-depends: hashable >=1.3.0.0 && <1.6 hs-source-dirs: src test-suite spec@@ -83,7 +81,7 @@ ghc-options: -threaded build-depends: , aws-arn- , tasty ^>=1.4.0.2+ , tasty ^>=1.4.0.2 || ^>=1.5 , tasty-hunit ^>=0.10.0.3 build-tool-depends: tasty-discover:tasty-discover >=4.2.2 && <5.1
src/Network/AWS/ARN.hs view
@@ -64,13 +64,13 @@ import Data.Text (Text) import qualified Data.Text as T import GHC.Generics (Generic, Generic1)-import Network.AWS.ARN.Internal.Lens (Iso', Prism', iso, prism')+import Lens.Micro.Pro (Iso', Prism', iso, prism') import Text.Show.Deriving (deriveShow1) -- $setup -- >>> :set -XOverloadedStrings -- >>> import Data.Function ((&))--- >>> import Network.AWS.ARN.Internal.Lens (from, ix, (.~), (^.), (^?))+-- >>> import Lens.Micro.Pro (from, ix, (.~), (^.), (^?)) -- | A parsed ARN. Either use the '_ARN' 'Prism'', or the 'parseARN' and -- 'renderARN' functions to convert @'Text' \<-\> 'ARN'@. The
− src/Network/AWS/ARN/Internal/Lens.hs
@@ -1,97 +0,0 @@-{-# LANGUAGE RankNTypes #-}-{-# LANGUAGE ScopedTypeVariables #-}---- |------ Module : Network.AWS.ARN.Internal.Lens--- Copyright : (C) 2020-2022 Bellroy Pty Ltd--- License : BSD-3-Clause--- Maintainer : Bellroy Tech Team <haskell@bellroy.com>--- Stability : experimental------ Reimplement a few lens types and combinators to keep the dependency--- footprint down.-module Network.AWS.ARN.Internal.Lens where--import Data.Functor.Const (Const (..))-import Data.Functor.Identity (Identity (..))-import Data.Monoid (First (..))-import Data.Profunctor (Profunctor (..))-import Data.Profunctor.Choice (Choice (..))-import Data.Tagged (Tagged (..))--type Lens' s a = forall f. Functor f => (a -> f a) -> s -> f s--type Getting r s a = (a -> Const r a) -> s -> Const r s--type Setter s a = (a -> Identity a) -> s -> Identity s--set :: Setter s a -> a -> s -> s-set l = over l . const-{-# INLINE set #-}--(.~) :: Setter s a -> a -> s -> s-(.~) = set--infixr 4 .~--over :: Setter s a -> (a -> a) -> s -> s-over l f = runIdentity . l (Identity . f)-{-# INLINE over #-}--(^.) :: s -> Getting a s a -> a-s ^. l = getConst $ l Const s--infixl 8 ^.--type Prism' s a =- forall p f. (Choice p, Applicative f) => p a (f a) -> p s (f s)--prism' :: forall s a. (a -> s) -> (s -> Maybe a) -> Prism' s a-prism' inj prj p = dimap prj' inj' $ right' p- where- inj' :: Applicative f => Either s (f a) -> f s- inj' = either pure (fmap inj)-- prj' :: s -> Either s a- prj' s = maybe (Left s) Right $ prj s-{-# INLINE prism' #-}--preview :: Prism' s a -> s -> Maybe a-preview p s = (getFirst . getConst . ($ s)) $ p (Const . First . Just)-{-# INLINE preview #-}--review :: Prism' s a -> a -> s-review p = runIdentity . unTagged . p . Tagged . Identity-{-# INLINE review #-}--(^?) :: s -> Prism' s a -> Maybe a-s ^? p = preview p s-{-# INLINE (^?) #-}--infixl 8 ^?--type Traversal' s a = forall f. Applicative f => (a -> f a) -> s -> f s--ix :: Int -> Traversal' [a] a-ix 0 f (x : xs) = (: xs) <$> f x-ix n f (x : xs) = (x :) <$> ix (n - 1) f xs-ix _ _ [] = pure []--type Iso' s a = forall p f. (Profunctor p, Functor f) => p a (f a) -> p s (f s)--type AnIso' s a = Exchange a a a (Identity a) -> Exchange a a s (Identity s)--data Exchange a b s t = Exchange (s -> a) (b -> t)--instance Profunctor (Exchange a b) where- dimap f g (Exchange sa bt) = Exchange (sa . f) (g . bt)--iso :: (s -> a) -> (a -> s) -> Iso' s a-iso f t = dimap f (fmap t)-{-# INLINE iso #-}--from :: AnIso' s a -> Iso' a s-from l = iso (runIdentity . t) f- where- Exchange f t = l $ Exchange id Identity
src/Network/AWS/ARN/Lambda.hs view
@@ -26,11 +26,11 @@ import Data.Text (Text) import qualified Data.Text as T import GHC.Generics (Generic)-import Network.AWS.ARN.Internal.Lens (Prism', prism')+import Lens.Micro.Pro (Prism', prism') -- $setup -- >>> :set -XOverloadedStrings--- >>> import Network.AWS.ARN.Internal.Lens ((^?))+-- >>> import Lens.Micro.Pro ((^?)) -- | An AWS Lambda function name, and optional alias/version qualifier. --
src/Network/AWS/ARN/S3.hs view
@@ -34,11 +34,11 @@ import Data.Text (Text) import qualified Data.Text as T import GHC.Generics (Generic)-import Network.AWS.ARN.Internal.Lens (Prism', prism')+import Lens.Micro.Pro (Prism', prism') -- $setup -- >>> :set -XOverloadedStrings--- >>> import Network.AWS.ARN.Internal.Lens ((^?))+-- >>> import Lens.Micro.Pro ((^?)) -- | An AWS S3 object, made of a bucket and an object key. --
test/Network/AWS/ARN/Lambda/Test.hs view
@@ -4,7 +4,7 @@ module Network.AWS.ARN.Lambda.Test where import Data.Text (Text)-import Network.AWS.ARN.Internal.Lens (Lens', set, (^?))+import Lens.Micro.Pro (Lens', set, (^?)) import Network.AWS.ARN.Lambda import Test.Tasty import Test.Tasty.HUnit
test/Network/AWS/ARN/S3/Test.hs view
@@ -4,7 +4,7 @@ module Network.AWS.ARN.S3.Test where import Data.Text (Text)-import Network.AWS.ARN.Internal.Lens (Lens', set, (^?))+import Lens.Micro.Pro (Lens', set, (^?)) import Network.AWS.ARN.S3 import Test.Tasty import Test.Tasty.HUnit@@ -28,8 +28,8 @@ set (_Object . rObjectKey) "my/other/object" "bucket-name/my/object" @?= "bucket-name/my/other/object" ]- ]- , testGroup+ ],+ testGroup "S3 bucket" [ testGroup "parsing"
test/Network/AWS/ARN/Test.hs view
@@ -5,8 +5,8 @@ import Data.List.NonEmpty (NonEmpty (..)) import Data.Text (Text)+import Lens.Micro.Pro (Lens', over, preview, review) import Network.AWS.ARN-import Network.AWS.ARN.Internal.Lens (Lens', over, preview, review) import Test.Tasty import Test.Tasty.HUnit