servant-subscriber 0.6.0.1 → 0.6.0.2
raw patch · 4 files changed
+12/−10 lines, 4 filesdep ~servantPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: servant
API changes (from Hackage documentation)
- Servant.Subscriber: data Proxy k (t :: k) :: forall k. k -> *
- Servant.Subscriber: }
- Servant.Subscriber.Subscribable: instance Servant.Foreign.Internal.HasForeign lang ftype sublayout => Servant.Foreign.Internal.HasForeign lang ftype (Servant.Subscriber.Subscribable.Subscribable Servant.API.Sub.:> sublayout)
- Servant.Subscriber.Subscribable: instance Servant.Utils.Links.HasLink sub => Servant.Utils.Links.HasLink (Servant.Subscriber.Subscribable.Subscribable Servant.API.Sub.:> sub)
+ Servant.Subscriber: data Proxy (t :: k) :: forall k. () => k -> Type
+ Servant.Subscriber.Subscribable: instance Servant.Links.HasLink sub => Servant.Links.HasLink (Servant.Subscriber.Subscribable.Subscribable Servant.API.Sub.:> sub)
+ Servant.Subscriber.Subscribable: instance forall k (lang :: k) ftype sublayout. Servant.Foreign.Internal.HasForeign lang ftype sublayout => Servant.Foreign.Internal.HasForeign lang ftype (Servant.Subscriber.Subscribable.Subscribable Servant.API.Sub.:> sublayout)
+ Servant.Subscriber.Subscribable: type family IsValidEndpoint endpoint :: Constraint
- Servant.Subscriber: class HasLink k (endpoint :: k) where type MkLink k (endpoint :: k) :: * where {
+ Servant.Subscriber: class HasLink (endpoint :: k)
- Servant.Subscriber: data STM a :: * -> *
+ Servant.Subscriber: data STM a
- Servant.Subscriber: data URI :: *
+ Servant.Subscriber: data URI
- Servant.Subscriber: notify :: forall api endpoint. (IsElem endpoint api, HasLink endpoint, IsValidEndpoint endpoint, IsSubscribable endpoint api) => Subscriber api -> Event -> Proxy endpoint -> (MkLink endpoint -> URI) -> STM ()
+ Servant.Subscriber: notify :: forall api endpoint. (IsElem endpoint api, HasLink endpoint, IsValidEndpoint endpoint, IsSubscribable endpoint api) => Subscriber api -> Event -> Proxy endpoint -> (MkLink endpoint Link -> URI) -> STM ()
- Servant.Subscriber: serveSubscriber :: forall api. (HasServer api '[]) => Subscriber api -> Server api -> Application
+ Servant.Subscriber: serveSubscriber :: forall api. HasServer api '[] => Subscriber api -> Server api -> Application
- Servant.Subscriber: type family MkLink k (endpoint :: k) :: *;
+ Servant.Subscriber: type family MkLink (endpoint :: k) a :: Type
- Servant.Subscriber.Client: Client :: !(Subscriber api) -> !(TVar ClientMonitors) -> !(IO (Maybe Request)) -> !(Response -> IO ()) -> !(IORef (IO ())) -> !(TVar (IO ())) -> Client api
+ Servant.Subscriber.Client: Client :: !Subscriber api -> !TVar ClientMonitors -> !IO (Maybe Request) -> !Response -> IO () -> !IORef (IO ()) -> !TVar (IO ()) -> Client api
- Servant.Subscriber.Client: StatusMonitor :: !HttpRequest -> !(TVar (RefCounted ResourceStatus)) -> !(Maybe ResourceStatus) -> StatusMonitor
+ Servant.Subscriber.Client: StatusMonitor :: !HttpRequest -> !TVar (RefCounted ResourceStatus) -> !Maybe ResourceStatus -> StatusMonitor
- Servant.Subscriber.Client: [closeCommandRef] :: Client api -> !(TVar (IO ()))
+ Servant.Subscriber.Client: [closeCommandRef] :: Client api -> !TVar (IO ())
- Servant.Subscriber.Client: [monitor] :: StatusMonitor -> !(TVar (RefCounted ResourceStatus))
+ Servant.Subscriber.Client: [monitor] :: StatusMonitor -> !TVar (RefCounted ResourceStatus)
- Servant.Subscriber.Client: [monitors] :: Client api -> !(TVar ClientMonitors)
+ Servant.Subscriber.Client: [monitors] :: Client api -> !TVar ClientMonitors
- Servant.Subscriber.Client: [oldStatus] :: StatusMonitor -> !(Maybe ResourceStatus)
+ Servant.Subscriber.Client: [oldStatus] :: StatusMonitor -> !Maybe ResourceStatus
- Servant.Subscriber.Client: [pongCommandRef] :: Client api -> !(IORef (IO ()))
+ Servant.Subscriber.Client: [pongCommandRef] :: Client api -> !IORef (IO ())
- Servant.Subscriber.Client: [readRequest] :: Client api -> !(IO (Maybe Request))
+ Servant.Subscriber.Client: [readRequest] :: Client api -> !IO (Maybe Request)
- Servant.Subscriber.Client: [subscriber] :: Client api -> !(Subscriber api)
+ Servant.Subscriber.Client: [subscriber] :: Client api -> !Subscriber api
- Servant.Subscriber.Client: [writeResponse] :: Client api -> !(Response -> IO ())
+ Servant.Subscriber.Client: [writeResponse] :: Client api -> !Response -> IO ()
- Servant.Subscriber.Types: Subscriber :: !(TVar ResourceStatusMap) -> !Path -> LogRunner -> Subscriber api
+ Servant.Subscriber.Types: Subscriber :: !TVar ResourceStatusMap -> !Path -> LogRunner -> Subscriber api
- Servant.Subscriber.Types: [subState] :: Subscriber api -> !(TVar ResourceStatusMap)
+ Servant.Subscriber.Types: [subState] :: Subscriber api -> !TVar ResourceStatusMap
- Servant.Subscriber.Types: notify :: forall api endpoint. (IsElem endpoint api, HasLink endpoint, IsValidEndpoint endpoint, IsSubscribable endpoint api) => Subscriber api -> Event -> Proxy endpoint -> (MkLink endpoint -> URI) -> STM ()
+ Servant.Subscriber.Types: notify :: forall api endpoint. (IsElem endpoint api, HasLink endpoint, IsValidEndpoint endpoint, IsSubscribable endpoint api) => Subscriber api -> Event -> Proxy endpoint -> (MkLink endpoint Link -> URI) -> STM ()
- Servant.Subscriber.Types: notifyIO :: forall api endpoint. (IsElem endpoint api, HasLink endpoint, IsValidEndpoint endpoint, IsSubscribable endpoint api) => Subscriber api -> Event -> Proxy endpoint -> (MkLink endpoint -> URI) -> IO ()
+ Servant.Subscriber.Types: notifyIO :: forall api endpoint. (IsElem endpoint api, HasLink endpoint, IsValidEndpoint endpoint, IsSubscribable endpoint api) => Subscriber api -> Event -> Proxy endpoint -> (MkLink endpoint Link -> URI) -> IO ()
Files
- Readme.md +1/−1
- servant-subscriber.cabal +3/−3
- src/Servant/Subscriber/Subscribable.hs +3/−2
- src/Servant/Subscriber/Types.hs +5/−4
Readme.md view
@@ -9,7 +9,7 @@ ## Status -It seems to work - it is already tested in examples/central-counter of servant-purescript and used in production.+It seems to work - it is already tested in [examples/central-counter](https://github.com/eskimor/servant-purescript/tree/master/examples/central-counter) of servant-purescript and used in production. Still missing:
servant-subscriber.cabal view
@@ -1,5 +1,5 @@ name: servant-subscriber-version: 0.6.0.1+version: 0.6.0.2 synopsis: When REST is not enough ... description: Please see Readme.md homepage: http://github.com/eskimor/servant-subscriber#readme@@ -16,8 +16,8 @@ extra-source-files: Readme.md Flag WEBSOCKETS_0_11- + library hs-source-dirs: src if flag(WEBSOCKETS_0_11)@@ -50,7 +50,7 @@ , monad-control , monad-logger , network-uri- , servant+ , servant >= 0.14 , servant-foreign , servant-server , stm
src/Servant/Subscriber/Subscribable.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE ConstraintKinds #-}+{-# LANGUAGE PolyKinds #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleInstances #-}@@ -88,5 +89,5 @@ req & reqFuncName . _FunctionName %~ ("" :) -- Prepend empty string for marking as subscribable. instance HasLink sub => HasLink (Subscribable :> sub) where- type MkLink (Subscribable :> sub) = MkLink sub- toLink _ = toLink (Proxy :: Proxy sub)+ type MkLink (Subscribable :> sub) a = MkLink sub a+ toLink toA _ = toLink toA (Proxy :: Proxy sub)
src/Servant/Subscriber/Types.hs view
@@ -20,7 +20,7 @@ import qualified Data.Text as T import GHC.Generics import Network.URI (URI (..), pathSegments, unEscapeString)-import Servant.Utils.Links (IsElem, HasLink, MkLink, safeLink)+import Servant.Links (IsElem, HasLink, MkLink, safeLink, Link) import System.FilePath.Posix (splitPath) import Debug.Trace (trace) @@ -89,11 +89,12 @@ => Subscriber api -> Event -> Proxy endpoint- -> (MkLink endpoint -> URI)+ -> (MkLink endpoint Link -> URI) -> STM () notify subscriber event pEndpoint getLink = do let mkPath = Path . map (T.pack . unEscapeString) . pathSegments . getLink- let resource = mkPath $ safeLink (Proxy :: Proxy api) pEndpoint+ let sLink = safeLink (Proxy :: Proxy api) pEndpoint+ let resource = mkPath $ sLink trace ("NOTIFIED PATH:" <> show resource) (pure ()) modifyState event resource subscriber @@ -103,7 +104,7 @@ => Subscriber api -> Event -> Proxy endpoint- -> (MkLink endpoint -> URI)+ -> (MkLink endpoint Link -> URI) -> IO () notifyIO subscriber event pEndpoint getLink = atomically $ notify subscriber event pEndpoint getLink