From 951a0d209899baf05cd932342740f3791282a0b5 Mon Sep 17 00:00:00 2001 From: Chris Martin Date: Thu, 18 Jan 2024 16:19:12 -0700 Subject: [PATCH] role annotations - it seems ghc 9.8 wants them --- asana.cabal | 1 + library/Asana/Api/Request.hs | 3 +++ package.yaml | 1 + 3 files changed, 5 insertions(+) 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