Skip to content

Commit 0c66b9c

Browse files
authored
Merge pull request #953 from haskell-servant/fileserving-polymorphic-monad
servant-server: make file-serving functions polymorphic in the monad
2 parents 63253f0 + fd21e92 commit 0c66b9c

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

servant-server/src/Servant/Utils/StaticFiles.hs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ module Servant.Utils.StaticFiles
1818
import Data.ByteString (ByteString)
1919
import Network.Wai.Application.Static
2020
import Servant.API.Raw (Raw)
21-
import Servant.Server (Server, Tagged (..))
21+
import Servant.Server (ServerT, Tagged (..))
2222
import System.FilePath (addTrailingPathSeparator)
2323
#if !MIN_VERSION_wai_app_static(3,1,0)
2424
import Filesystem.Path.CurrentOS (decodeString)
@@ -47,33 +47,33 @@ import WaiAppStatic.Storage.Filesystem (ETagLookup)
4747
-- in order.
4848
--
4949
-- Corresponds to the `defaultWebAppSettings` `StaticSettings` value.
50-
serveDirectoryWebApp :: FilePath -> Server Raw
50+
serveDirectoryWebApp :: FilePath -> ServerT Raw m
5151
serveDirectoryWebApp = serveDirectoryWith . defaultWebAppSettings . fixPath
5252

5353
-- | Same as 'serveDirectoryWebApp', but uses `defaultFileServerSettings`.
54-
serveDirectoryFileServer :: FilePath -> Server Raw
54+
serveDirectoryFileServer :: FilePath -> ServerT Raw m
5555
serveDirectoryFileServer = serveDirectoryWith . defaultFileServerSettings . fixPath
5656

5757
-- | Same as 'serveDirectoryWebApp', but uses 'webAppSettingsWithLookup'.
58-
serveDirectoryWebAppLookup :: ETagLookup -> FilePath -> Server Raw
58+
serveDirectoryWebAppLookup :: ETagLookup -> FilePath -> ServerT Raw m
5959
serveDirectoryWebAppLookup etag =
6060
serveDirectoryWith . flip webAppSettingsWithLookup etag . fixPath
6161

6262
-- | Uses 'embeddedSettings'.
63-
serveDirectoryEmbedded :: [(FilePath, ByteString)] -> Server Raw
63+
serveDirectoryEmbedded :: [(FilePath, ByteString)] -> ServerT Raw m
6464
serveDirectoryEmbedded files = serveDirectoryWith (embeddedSettings files)
6565

6666
-- | Alias for 'staticApp'. Lets you serve a directory
6767
-- with arbitrary 'StaticSettings'. Useful when you want
6868
-- particular settings not covered by the four other
6969
-- variants. This is the most flexible method.
70-
serveDirectoryWith :: StaticSettings -> Server Raw
70+
serveDirectoryWith :: StaticSettings -> ServerT Raw m
7171
serveDirectoryWith = Tagged . staticApp
7272

7373
-- | Same as 'serveDirectoryFileServer'. It used to be the only
7474
-- file serving function in servant pre-0.10 and will be kept
7575
-- around for a few versions, but is deprecated.
76-
serveDirectory :: FilePath -> Server Raw
76+
serveDirectory :: FilePath -> ServerT Raw m
7777
serveDirectory = serveDirectoryFileServer
7878
{-# DEPRECATED serveDirectory "Use serveDirectoryFileServer instead" #-}
7979

0 commit comments

Comments
 (0)