gdritter repos new-inf-blog / 37fb348
Strictify! Getty Ritter 5 years ago
1 changed file(s) with 24 addition(s) and 24 deletion(s). Collapse all Expand all
2929 -- | A 'PostRef' is just the information needed to identify a post
3030 -- internally, including when it was posted and its title and slug
3131 data PostRef = PostRef
32 { prYear :: Int
33 , prMonth :: Int
34 , prSlug :: T.Text
35 , prName :: T.Text
36 , prDate :: Time.UTCTime
32 { prYear :: !Int
33 , prMonth :: !Int
34 , prSlug :: !T.Text
35 , prName :: !T.Text
36 , prDate :: !Time.UTCTime
3737 } deriving Show
3838
3939 -- | A 'Post' is all the information needed to display a post in full,
4040 -- including the raw Markdown of the post itself
4141 data Post = Post
42 { postId :: PostId
43 , postDate :: Time.UTCTime
44 , postTitle :: T.Text
45 , postSlug :: T.Text
46 , postContents :: T.Text
47 , postAuthor :: User
48 , postNext :: Maybe PostRef
49 , postPrev :: Maybe PostRef
42 { postId :: !PostId
43 , postDate :: !Time.UTCTime
44 , postTitle :: !T.Text
45 , postSlug :: !T.Text
46 , postContents :: !T.Text
47 , postAuthor :: !User
48 , postNext :: !(Maybe PostRef)
49 , postPrev :: !(Maybe PostRef)
5050 } deriving Show
5151
5252 -- | A 'RawPost' is the information needed to create a new post, and
5353 -- thus may not have a post ID (as it might not have been submitted
5454 -- yet!)
5555 data RawPost = RawPost
56 { rpId :: Maybe PostId
57 , rpTitle :: T.Text
58 , rpAuthor :: User
59 , rpContents :: T.Text
56 { rpId :: !(Maybe PostId)
57 , rpTitle :: !T.Text
58 , rpAuthor :: !User
59 , rpContents :: !T.Text
6060 } deriving Show
6161
6262 -- | A blank post for populating an editing field
6969 }
7070
7171 data Page = Page
72 { pageName :: T.Text
73 , pageText :: T.Text
72 { pageName :: !T.Text
73 , pageText :: !T.Text
7474 } deriving Show
7575
7676 instance SQL.FromRow Page where
7777 fromRow = uncurry Page <$> SQL.fromRow
7878
7979 data URL = URL
80 { urlRelative :: T.Text
81 , urlAbsolute :: T.Text
80 { urlRelative :: !T.Text
81 , urlAbsolute :: !T.Text
8282 } deriving Show
8383
8484
142142
143143
144144 data DBException
145 = MissingPost PostId
146 | MissingPage T.Text
147 | NoPostFound T.Text T.Text T.Text
145 = MissingPost !PostId
146 | MissingPage !T.Text
147 | NoPostFound !T.Text !T.Text !T.Text
148148 | NonUniqueResult
149149 | BadUserError
150150 | NoSuchPost