HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulewai-app-static-3.1.9Haskell2010

WaiAppStatic.Types

  • 9 types
  • 4 values

Pieces

6 declarations
newtypenewtype Piece
#

An individual component of a path, or of a filepath.

This is the core type used by wai-app-static for doing lookups. It provides a smart constructor to avoid the possibility of constructing unsafe path segments (though unsafeToPiece can get around that as necessary).

Individual file lookup backends must know how to convert from a Piece to their storage system.

Instances3Eq, Ord, Show
  • Eq PieceDefined in wai-app-static-3.1.9 · WaiAppStatic.Types
  • Ord PieceDefined in wai-app-static-3.1.9 · WaiAppStatic.Types
  • Show PieceDefined in wai-app-static-3.1.9 · WaiAppStatic.Types
valuetoPiece :: Text -> Maybe Piece
#

Smart constructor for a Piece. Won't allow unsafe components, such as pieces beginning with a period or containing a slash. This will, however, allow null pieces.

typetype Pieces = [Piece]
#

Request coming from a user. Corresponds to pathInfo.

The root path is the empty list.

Caching

1 declaration
datadata MaxAge
#

Values for the max-age component of the cache-control response header.

Constructors

File/folder serving

5 declarations
datadata File
#

Information on an individual file.

Constructors

typetype Listing = Pieces -> Folder -> IO Builder
#

How to construct a directory listing page for the given request path and the resulting folder.

Settings

1 declaration
datadata StaticSettings
#

All of the settings available to users for tweaking wai-app-static.

Note that you should use the settings type approach for modifying values. See http://www.yesodweb.com/book/settings-types for more information.

Constructors

  • StaticSettings
    • ssLookupFile :: Pieces -> IO LookupResult

      Lookup a single file or folder. This is how you can control storage backend (filesystem, embedded, etc) and where to lookup.

    • ssGetMimeType :: File -> IO MimeType

      Determine the mime type of the given file. Note that this function lives in IO in case you want to perform more complicated mimetype analysis, such as via the file utility.

    • ssIndices :: [Piece]

      Ordered list of filenames to be used for indices. If the user requests a folder, and a file with the given name is found in that folder, that file is served. This supercedes any directory listing.

    • ssListing :: Maybe Listing

      How to perform a directory listing. Optional. Will be used when the user requested a folder.

    • ssMaxAge :: MaxAge

      Value to provide for max age in the cache-control.

    • ssMkRedirect :: Pieces -> ByteString -> ByteString

      Given a requested path and a new destination, construct a string that will go there. Default implementation will use relative paths.

    • ssRedirectToIndex :: Bool

      If True, send a redirect to the user when a folder is requested and an index page should be displayed. When False, display the content immediately.

    • ssUseHash :: Bool

      Prefer usage of etag caching to last-modified caching.

    • ssAddTrailingSlash :: Bool

      Force a trailing slash at the end of directories

    • ss404Handler :: Maybe Application

      Optional Application to be used in case of 404 errors

      Since 3.1.3