Strictify!
Getty Ritter
5 years ago
29 | 29 | -- | A 'PostRef' is just the information needed to identify a post |
30 | 30 | -- internally, including when it was posted and its title and slug |
31 | 31 | data PostRef = PostRef |
32 | { prYear :: Int | |
33 | , prMonth :: Int | |
34 | , prSlug :: T.Text | |
35 | , prName :: T.Text | |
36 |
|
|
32 | { prYear :: !Int | |
33 | , prMonth :: !Int | |
34 | , prSlug :: !T.Text | |
35 | , prName :: !T.Text | |
36 | , prDate :: !Time.UTCTime | |
37 | 37 | } deriving Show |
38 | 38 | |
39 | 39 | -- | A 'Post' is all the information needed to display a post in full, |
40 | 40 | -- including the raw Markdown of the post itself |
41 | 41 | 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) | |
50 | 50 | } deriving Show |
51 | 51 | |
52 | 52 | -- | A 'RawPost' is the information needed to create a new post, and |
53 | 53 | -- thus may not have a post ID (as it might not have been submitted |
54 | 54 | -- yet!) |
55 | 55 | 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 | |
60 | 60 | } deriving Show |
61 | 61 | |
62 | 62 | -- | A blank post for populating an editing field |
69 | 69 | } |
70 | 70 | |
71 | 71 | data Page = Page |
72 | { pageName :: T.Text | |
73 | , pageText :: T.Text | |
72 | { pageName :: !T.Text | |
73 | , pageText :: !T.Text | |
74 | 74 | } deriving Show |
75 | 75 | |
76 | 76 | instance SQL.FromRow Page where |
77 | 77 | fromRow = uncurry Page <$> SQL.fromRow |
78 | 78 | |
79 | 79 | data URL = URL |
80 | { urlRelative :: T.Text | |
81 | , urlAbsolute :: T.Text | |
80 | { urlRelative :: !T.Text | |
81 | , urlAbsolute :: !T.Text | |
82 | 82 | } deriving Show |
83 | 83 | |
84 | 84 | |
142 | 142 | |
143 | 143 | |
144 | 144 | data DBException |
145 | = MissingPost PostId | |
146 | | MissingPage T.Text | |
147 |
|
|
145 | = MissingPost !PostId | |
146 | | MissingPage !T.Text | |
147 | | NoPostFound !T.Text !T.Text !T.Text | |
148 | 148 | | NonUniqueResult |
149 | 149 | | BadUserError |
150 | 150 | | NoSuchPost |