@@ -27,23 +27,23 @@
2727module Network.PagerDuty.Internal.Types where
2828
2929import Control.Applicative
30−import Control.Lens hiding ((.=), Empty)
30+import Control.Lens hiding ((.=))
3131import Control.Monad.IO.Class
32−import Data.Aeson hiding (Error, Key)
33−import qualified Data.Aeson.KeyMap as Map
32+import Data.Aeson hiding (Error)
3433import Data.Aeson.Types (Parser)
3534import Data.ByteString (ByteString)
3635import qualified Data.ByteString.Char8 as BS
3736import Data.ByteString.Conversion hiding (List)
3837import Data.Default.Class
3938import Data.Function (on)
39+import qualified Data.HashMap.Strict as Map
4040import Data.List (deleteBy, intersperse)
4141import Data.Monoid
4242import Data.String
4343import Data.Text (Text)
4444import qualified Data.Text as Text
4545import qualified Data.Text.Encoding as Text
46−import Data.Time (UTCTime, TimeZone, formatTime, utc, timeZoneName)
46+import Data.Time
4747import GHC.TypeLits
4848import Network.HTTP.Client (Manager)
4949import Network.HTTP.Types
@@ -53,7 +53,7 @@ import Network.PagerDuty.Internal.TH
5353import Data.Time.Locale.Compat
5454
5555newtype CSV a = CSV [a]
56− deriving (Eq, Show, Semigroup, Monoid)
56+ deriving (Eq, Show, Monoid)
5757
5858makePrisms ''CSV
5959
@@ -70,7 +70,7 @@ instance ToByteString a => ToJSON (CSV a) where
7070 toJSON = String . Text.decodeUtf8 . toByteString'
7171
7272newtype List a = L [a]
73− deriving (Eq, Show, Semigroup, Monoid)
73+ deriving (Eq, Show, Monoid)
7474
7575deriveJSON ''List
7676makePrisms ''List
@@ -133,8 +133,8 @@ data Security = Basic | Token
133133 deriving (Eq, Show)
134134
135135data Auth (a :: Security) where
136− AuthBasic :: ByteString -> ByteString -> Auth 'Basic
137− AuthToken :: ByteString -> Auth 'Token
136+ AuthBasic :: ByteString -> ByteString -> Auth Basic
137+ AuthToken :: ByteString -> Auth Token
138138
139139deriving instance Eq (Auth a)
140140deriving instance Show (Auth a)
@@ -279,13 +279,8 @@ data Pager = Pager
279279
280280makeLenses ''Pager
281281
282−data Page a = Page
283− { _pgItem :: a
284− , _pgPager :: Maybe Pager
285− }
286−
287−instance FromJSON a => FromJSON (Page a) where
288− parseJSON = withObject "paginated" $ \o -> Page
282+instance FromJSON a => FromJSON (a, Maybe Pager) where
283+ parseJSON = withObject "paginated" $ \o -> (,)
289284 <$> parseJSON (Object o)
290285 <*> optional (parse o)
291286 where
@@ -310,13 +305,11 @@ data Path where
310305 Path :: Path
311306 Seg :: ToByteString a => a -> Path
312307
313−instance Semigroup Path where
314− x <> Path = x
315− Path <> y = y
316− Seg x <> Seg y = Seg (builder x <> "/" <> builder y)
317−
318308instance Monoid Path where
319− mempty = Path
309+ mempty = Path
310+ mappend x Path = x
311+ mappend Path y = y
312+ mappend (Seg x) (Seg y) = Seg (builder x <> "/" <> builder y)
320313
321314instance IsString Path where
322315 fromString = Seg