fix build with stackage LTS 22
This commit is contained in:
parent
dd3bc74708
commit
70d029c24c
@ -34,7 +34,7 @@ executable breve
|
||||
DataKinds, KindSignatures, TypeOperators
|
||||
build-depends: base >=4.8 && <5.0,
|
||||
warp, warp-tls, tls, blaze-html,
|
||||
servant-server, servant-rawm, servant-blaze,
|
||||
servant-server, servant-rawm-server, servant-blaze,
|
||||
wai, wai-extra, streaming-commons, http-api-data,
|
||||
|
||||
mtl, text, aeson, bytestring, binary,
|
||||
|
@ -31,8 +31,8 @@ import Text.Blaze.Html.Renderer.Utf8 (renderHtml)
|
||||
-- API definition
|
||||
import Servant
|
||||
import Servant.HTML.Blaze (HTML)
|
||||
import Servant.RawM as R
|
||||
import Web.FormUrlEncoded (FromForm(..), parseUnique)
|
||||
import qualified Servant.RawM.Server as R
|
||||
|
||||
|
||||
-- * Types
|
||||
@ -96,7 +96,7 @@ type Breve = API :<|> App
|
||||
-- +----------+------+----------------------+
|
||||
type App =
|
||||
Get '[HTML] Html
|
||||
:<|> "static" :> RawM
|
||||
:<|> "static" :> R.RawM
|
||||
:<|> Capture "name" Name :> Redirect
|
||||
:<|> ReqBody '[FormUrlEncoded] UrlForm :> Post '[HTML] Html
|
||||
|
||||
|
@ -9,6 +9,7 @@ module Breve.Generator
|
||||
, intHash
|
||||
) where
|
||||
|
||||
import Control.Monad (replicateM)
|
||||
import Control.Monad.State
|
||||
import System.Random
|
||||
import Crypto.Hash.SHA256 (hash)
|
||||
|
11
src/Views.hs
11
src/Views.hs
@ -11,7 +11,7 @@ import Text.Blaze.Html5.Attributes as A
|
||||
|
||||
-- | The homepage
|
||||
index :: Html
|
||||
index = template $ do
|
||||
index = breveTemplate $ do
|
||||
H.form ! method "POST" $ do
|
||||
"your url:"
|
||||
input ! type_ "text" ! name "url"
|
||||
@ -21,20 +21,20 @@ index = template $ do
|
||||
-- submitted successfully. Takes the resulting
|
||||
-- url as an argument.
|
||||
done :: Text -> Html
|
||||
done url = template $ do
|
||||
done url = breveTemplate $ do
|
||||
"here's your new link: "
|
||||
a ! href (toValue url) $ (toHtml url)
|
||||
|
||||
-- | Displays a text message in the page center
|
||||
message :: Text -> Html
|
||||
message = template . toHtml
|
||||
message = breveTemplate . toHtml
|
||||
|
||||
-- | The main Breve template
|
||||
--
|
||||
-- Takes HTML code and embeds it in the
|
||||
-- inner page container.
|
||||
template :: Html -> Html
|
||||
template fill =
|
||||
breveTemplate :: Html -> Html
|
||||
breveTemplate fill =
|
||||
docTypeHtml $ do
|
||||
H.head $ do
|
||||
H.title "breve: url shortener"
|
||||
@ -42,6 +42,7 @@ template fill =
|
||||
meta ! name "keywords" ! content "url, shortener"
|
||||
meta ! name "author" ! content "Michele Guerini Rocco"
|
||||
meta ! charset "utf-8"
|
||||
meta ! name "color-scheme" ! content "dark"
|
||||
link ! rel "stylesheet" ! href "/static/main.css" ! type_ "text/css"
|
||||
link ! rel "apple-touch-icon" ! href "static/icon-big.png"
|
||||
link ! rel "icon" ! type_ "image/png" ! href "/static/icon-medium.png" ! sizes "96x96"
|
||||
|
Loading…
Reference in New Issue
Block a user