1{-# LANGUAGE QuasiQuotes, TypeFamilies, GeneralizedNewtypeDeriving, GADTs #-}
2{-# LANGUAGE TemplateHaskell #-}
3{-# LANGUAGE OverloadedStrings #-}
4module FullApp (fullApp) where
7import Network.HTTP.Types
8import Data.ByteString.Lazy.Char8 (pack)
9import Database.Persist.TH
10import Database.Persist.Sqlite
11import System.Directory
12import Control.Monad (when)
15import Text.Blaze.Renderer.Text (renderHtml)
16import Data.Text.Lazy.Encoding (encodeUtf16LE)
18mkPersist sqlSettings [persist|
24 putStrLn "testApp called, this should happen only once per reload"
25 -- Swap between the following two lines as necessary to generate errors
26 exi <- doesFileExist "db"
28 when exi $ removeFile "db"
29 withSqlitePool "db" 10 $ \pool -> do
30 flip runSqlPool pool $ runMigration $ migrate $ Dummy ""
32 if pathInfo req == "/favicon.ico"
33 then return $ responseLBS status301 [("Location", "http://docs.yesodweb.com/favicon.ico")]
37 x <- flip runSqlPool pool $ do
39 count ([] :: [Filter Dummy])
40 return $ responseLBS status200
41 [("Content-Type", "text/html; charset=utf-8")] $
42 encodeUtf16LE $ renderHtml
43 $(htmlFile "hamlet/testapp.hamlet")
44 putStrLn "handler completed, this should only happen at the beginning of a reload"
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list