1{-# LANGUAGE QuasiQuotes, TypeFamilies, GeneralizedNewtypeDeriving, GADTs #-}
2{-# LANGUAGE TemplateHaskell #-}
3{-# LANGUAGE OverloadedStrings #-}
4{-# LANGUAGE FlexibleContexts #-}
5module FullApp (fullApp) where
8import Network.HTTP.Types
9import Data.ByteString.Lazy.Char8 (pack)
10import Database.Persist.TH
11import Database.Persist.Sqlite
12import System.Directory
13import Control.Monad (when)
15import Text.Blaze.Html.Renderer.Utf8 (renderHtml)
16import Data.Text.Lazy.Encoding (encodeUtf16LE)
17import Control.Monad.Trans.Resource (runResourceT)
18import Control.Monad.IO.Class (liftIO)
20share [mkPersist sqlSettings, mkMigrate "migrateAll"] [persist|
25fullApp :: (Application -> IO ()) -> IO ()
27 putStrLn "testApp called, this should happen only once per reload"
28 -- Swap between the following two lines as necessary to generate errors
29 exi <- doesFileExist "db"
31 when exi $ removeFile "db"
32 withSqlitePool "db" 10 $ \pool -> do
33 flip runSqlPool pool $ runMigration migrateAll
35 if pathInfo req == ["favicon.ico"]
36 then return $ responseLBS status301 [("Location", "http://www.yesodweb.com/favicon.ico")]
39 liftIO $ print (pathInfo req)
40 x <- runResourceT $ flip runSqlPool pool $ do
41 _ <- insert (Dummy "")
42 count ([] :: [Filter Dummy])
43 return $ responseLBS status200
44 [("Content-Type", "text/html; charset=utf-8")] $
46 $(shamletFile "hamlet/testapp.hamlet")
47 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