-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTypes.hs
More file actions
39 lines (34 loc) · 1.17 KB
/
Types.hs
File metadata and controls
39 lines (34 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
module Types
( Milagos(..)
, FullPost
, Padded(..)
) where
import qualified Data.Text as T
import Database.Persist.GenericSql.Raw
import qualified Database.Persist.Store
import Model.Post
import Network.HTTP.Conduit (Manager)
import Prelude
import qualified Settings
import Settings (Extra (..))
import Yesod (PathPiece(..))
import Yesod.Default.Config
import Yesod.Logger (Logger)
import Yesod.Static
data Milagos = Milagos
{ settings :: AppConfig DefaultEnv Extra
, getLogger :: Logger
, getStatic :: Static -- ^ Settings for static file serving.
, getTheme :: Static
, connPool :: Database.Persist.Store.PersistConfigPool Settings.PersistConfig -- ^ Database connection pool.
, httpManager :: Manager
, persistConfig :: Settings.PersistConfig
}
type FullPost = FullPostGeneric SqlPersist
newtype Padded = Padded Int deriving (Eq, Ord, Read)
instance Show Padded where
show (Padded x) | x < 10 = '0' : show x
| otherwise = show x
instance PathPiece Padded where
fromPathPiece = fmap Padded . fromPathPiece
toPathPiece = T.pack . show