diff --git a/asana.cabal b/asana.cabal index 36badce..ea761ea 100644 --- a/asana.cabal +++ b/asana.cabal @@ -61,6 +61,7 @@ library OverloadedStrings RankNTypes RecordWildCards + RoleAnnotations ScopedTypeVariables StandaloneDeriving TypeApplications diff --git a/library/Asana/Api/Request.hs b/library/Asana/Api/Request.hs index fc403b1..c417901 100644 --- a/library/Asana/Api/Request.hs +++ b/library/Asana/Api/Request.hs @@ -50,6 +50,7 @@ maxRequests :: Int maxRequests = 50 -- | Type for a single-resource response, containing @{ data: { ... } }@ +type role Single representational newtype Single a = Single { sData :: a } @@ -60,6 +61,7 @@ instance (FromJSON a) => FromJSON (Single a) where parseJSON = genericParseJSON $ aesonPrefix snakeCase -- | Type for a list-resource response, containing @{ data: [{ ... }] }@ +type role Page representational data Page a = Page { pData :: [a], pNextPage :: Maybe NextPage @@ -81,6 +83,7 @@ instance FromJSON NextPage where parseJSON = genericParseJSON $ aesonPrefix snakeCase -- | Generic type for un/wrapping an item as @{ data: }@ +type role ApiData representational newtype ApiData a = ApiData { adData :: a } diff --git a/package.yaml b/package.yaml index f95bb3b..73d7c2f 100644 --- a/package.yaml +++ b/package.yaml @@ -55,6 +55,7 @@ default-extensions: - OverloadedStrings - RankNTypes - RecordWildCards + - RoleAnnotations - ScopedTypeVariables - StandaloneDeriving - TypeApplications