telegraph 1.1.0 → 1.1.1
raw patch · 5 files changed
+30/−3 lines, 5 filesdep +optics-th
Dependencies added: optics-th
Files
- CHANGELOG.md +6/−0
- src/Control/Effect/Telegraph.hs +5/−0
- src/Web/Telegraph/Types.hs +15/−0
- telegraph.cabal +2/−1
- test/Spec.hs +2/−2
CHANGELOG.md view
@@ -13,3 +13,9 @@ - Performance optimizations - Remove `errorToIO'` and `errorToErrorIO'` - Rename `errorToIOThrowing` to `errorToIOAsExc` and `errorToErrorIOThrowing` to `errorToErrorIOAsExc`++## 1.1.1++- Performance optimizations+- Fix tests+- Generate labeled optics
src/Control/Effect/Telegraph.hs view
@@ -95,18 +95,23 @@ takeTS :: Eff Telegraph m => m TS takeTS = send TakeTS+{-# INLINE takeTS #-} readTS :: Eff Telegraph m => m TS readTS = send ReadTS+{-# INLINE readTS #-} putTS :: Eff Telegraph m => TS -> m () putTS !s = send (PutTS s)+{-# INLINE putTS #-} httpLbs :: Effs '[Http, Error HttpException] m => Request -> m (Response LBS.ByteString) httpLbs !r = send (HttpLbs r)+{-# INLINE httpLbs #-} genBoundary :: Eff Http m => m ByteString genBoundary = send GenBoundary+{-# INLINE genBoundary #-} -- | Telegraph state data TS = TS
src/Web/Telegraph/Types.hs view
@@ -3,6 +3,8 @@ {-# LANGUAGE DerivingVia #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE StrictData #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE UndecidableInstances #-} -- | Type definitions, note that all fields are strict module Web.Telegraph.Types where@@ -14,6 +16,7 @@ import Deriving.Aeson import Deriving.Aeson.Stock import Generic.Data.Surgery+import Optics.TH -- | A Telegraph account data Account = Account@@ -157,3 +160,15 @@ instance Show TelegraphError where show (APICallFailure e) = "API call failed with error: " ++ unpack e++makeFieldLabelsWith noPrefixFieldLabels ''Account+makeFieldLabelsWith noPrefixFieldLabels ''PageList+makeFieldLabelsWith noPrefixFieldLabels ''Page+makeFieldLabelsWith noPrefixFieldLabels ''PageViews+makeFieldLabelsWith noPrefixFieldLabels ''NodeElement+makeFieldLabelsWith noPrefixFieldLabels ''Image+makeFieldLabelsWith noPrefixFieldLabels ''UploadResult++makePrismLabels ''Result+makePrismLabels ''Node+makePrismLabels ''UploadResult
telegraph.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: telegraph-version: 1.1.0+version: 1.1.1 synopsis: Binding to the telegraph API description: Binding to the telegraph API category: Web@@ -63,6 +63,7 @@ , generic-data-surgery ^>=0.3.0 , http-conduit ^>=2.3.7 , mtl ^>=2.2.2+ , optics-th ^>=0.3 , text ^>=1.2.4 exposed-modules:
test/Spec.hs view
@@ -13,8 +13,8 @@ main = do manager <- newTlsManager runM $- errorToIOThrowing @TelegraphError $- errorToIOThrowing @HttpException $+ errorToIOAsExc @TelegraphError $+ errorToIOAsExc @HttpException $ runReader manager $ runTelegraph "b968da509bb76866c35425099bc0989a5ec3b32997d55286c657e6994bbb" $ do pl <- getPageList 0 3