packages feed

servant-xstatic (empty) → 0.1.0

raw patch · 4 files changed

+99/−0 lines, 4 filesdep +basedep +servantdep +servant-server

Dependencies added: base, servant, servant-server, xstatic

Files

+ CHANGELOG.md view
@@ -0,0 +1,5 @@+# Changelog++## 0.1.0++- Initial release
+ LICENSE view
@@ -0,0 +1,29 @@+BSD 3-Clause License++Copyright (c) 2022, Tristan de Cacqueray+All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:++1. Redistributions of source code must retain the above copyright notice, this+   list of conditions and the following disclaimer.++2. Redistributions in binary form must reproduce the above copyright notice,+   this list of conditions and the following disclaimer in the documentation+   and/or other materials provided with the distribution.++3. Neither the name of the copyright holder nor the names of its+   contributors may be used to endorse or promote products derived from+   this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ servant-xstatic.cabal view
@@ -0,0 +1,39 @@+cabal-version: 1.12++-- This file has been generated from package.yaml by hpack version 0.35.0.+--+-- see: https://github.com/sol/hpack++name:           servant-xstatic+version:        0.1.0+synopsis:       XStatic adapter for servant+description:    Use this library to serve XStatic through servant.+category:       JavaScript+homepage:       https://github.com/TristanCacqueray/haskell-xstatic#readme+bug-reports:    https://github.com/TristanCacqueray/haskell-xstatic/issues+author:         Tristan Cacqueray+maintainer:     tdecacqu@redhat.com+license:        BSD3+license-file:   LICENSE+build-type:     Simple+extra-source-files:+    CHANGELOG.md++source-repository head+  type: git+  location: https://github.com/TristanCacqueray/haskell-xstatic++library+  exposed-modules:+      Servant.XStatic+  other-modules:+      Paths_servant_xstatic+  hs-source-dirs:+      src/+  ghc-options: -Weverything -Wno-implicit-prelude -Wno-missing-import-lists -Wno-missing-safe-haskell-mode -Wno-unsafe+  build-depends:+      base <5+    , servant+    , servant-server+    , xstatic+  default-language: Haskell2010
+ src/Servant/XStatic.hs view
@@ -0,0 +1,26 @@+{-# LANGUAGE ImportQualifiedPost #-}++{- | Serve a XStaticFiles in your servant api:++@+type ServerAPI =+    Get '[HTML] (Html ())+        :\<|\> "xstatic" :> Raw++server :: Server ServerAPI+server = pure mempty \<|\> xstaticServant xfiles+  where+    xfiles = [XStatic.htmx]+@+-}++module Servant.XStatic (xstaticServant) where++import Servant.API (Raw)+import Servant.Server (ServerT, Tagged (..))+import XStatic (XStaticFile)+import XStatic qualified++-- | Create a 'Raw' handler.+xstaticServant :: [XStaticFile] -> ServerT Raw m+xstaticServant = Tagged . XStatic.xstaticApp