Skip to content

Commit e5a1acc

Browse files
authored
Merge pull request #439 from TomMD/fix/allow-paged-query-of-semigroups
Generalize PagedQuery to allow its reuse by preview github APIs
2 parents 8590fd0 + c705c34 commit e5a1acc

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

src/GitHub/Data/Request.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ instance IReadOnly 'RA where iro = ROA
154154
-- /Note:/ 'Request' is not 'Functor' on purpose.
155155
data GenRequest (mt :: MediaType *) (rw :: RW) a where
156156
Query :: Paths -> QueryString -> GenRequest mt rw a
157-
PagedQuery :: Paths -> QueryString -> FetchCount -> GenRequest mt rw (Vector a)
157+
PagedQuery :: (a ~ t b, Foldable t, Semigroup a) => Paths -> QueryString -> FetchCount -> GenRequest mt rw a
158158

159159
-- | Command
160160
Command

src/GitHub/Request.hs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ import qualified Data.ByteString as BS
100100
import qualified Data.ByteString.Lazy as LBS
101101
import qualified Data.Text as T
102102
import qualified Data.Text.Encoding as TE
103-
import qualified Data.Vector as V
104103
import qualified Network.HTTP.Client as HTTP
105104
import qualified Network.HTTP.Client.Internal as HTTP
106105

@@ -242,7 +241,7 @@ executeRequestWithMgrAndRes mgr auth req = runExceptT $ do
242241
performHttpReq httpReq (PagedQuery _ _ l) =
243242
unTagged (performPagedRequest httpLbs' predicate httpReq :: Tagged mt (ExceptT Error IO (HTTP.Response b)))
244243
where
245-
predicate v = lessFetchCount (V.length v) l
244+
predicate v = lessFetchCount (length v) l
246245

247246
performHttpReq httpReq (Command _ _ _) = do
248247
res <- httpLbs' httpReq

0 commit comments

Comments
 (0)