Generalise type of emptyServer so it can be Entered

This commit is contained in:
David Turner 2017-05-17 05:12:23 +00:00
parent f3ac10a1c4
commit a3c5f17749
2 changed files with 3 additions and 3 deletions

View file

@ -221,8 +221,8 @@ layoutWithContext p context =
-- --
-- >>> import Control.Monad.Reader -- >>> import Control.Monad.Reader
-- >>> import qualified Control.Category as C -- >>> import qualified Control.Category as C
-- >>> type ReaderAPI = "ep1" :> Get '[JSON] Int :<|> "ep2" :> Get '[JSON] String :<|> Raw -- >>> type ReaderAPI = "ep1" :> Get '[JSON] Int :<|> "ep2" :> Get '[JSON] String :<|> Raw :<|> EmptyAPI
-- >>> let readerServer = return 1797 :<|> ask :<|> Tagged (error "raw server") :: ServerT ReaderAPI (Reader String) -- >>> let readerServer = return 1797 :<|> ask :<|> Tagged (error "raw server") :<|> emptyServer :: ServerT ReaderAPI (Reader String)
-- >>> let nt = generalizeNat C.. (runReaderTNat "hi") :: Reader String :~> Handler -- >>> let nt = generalizeNat C.. (runReaderTNat "hi") :: Reader String :~> Handler
-- >>> let mainServer = enter nt readerServer :: Server ReaderAPI -- >>> let mainServer = enter nt readerServer :: Server ReaderAPI
-- --

View file

@ -537,7 +537,7 @@ instance HasServer api context => HasServer (HttpVersion :> api) context where
data EmptyServer = EmptyServer deriving (Typeable, Eq, Show, Bounded, Enum) data EmptyServer = EmptyServer deriving (Typeable, Eq, Show, Bounded, Enum)
-- | Server for `EmptyAPI` -- | Server for `EmptyAPI`
emptyServer :: Server EmptyAPI emptyServer :: ServerT EmptyAPI m
emptyServer = Tagged EmptyServer emptyServer = Tagged EmptyServer
-- | The server for an `EmptyAPI` is `emptyAPIServer`. -- | The server for an `EmptyAPI` is `emptyAPIServer`.