Move Post to its own module
This commit is contained in:
parent
5a14a1849a
commit
b6ca8364a4
|
@ -1,24 +1,9 @@
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
module Main where
|
module Main where
|
||||||
|
|
||||||
import Control.Applicative
|
|
||||||
import Data.Monoid
|
|
||||||
import Data.Text hiding (head)
|
|
||||||
import Database.SQLite.Simple
|
import Database.SQLite.Simple
|
||||||
import Database.SQLite.Simple.FromRow
|
|
||||||
import Web.Spock.Safe hiding (head)
|
import Web.Spock.Safe hiding (head)
|
||||||
|
import Within.DBMemorial.Post
|
||||||
data Post = Post {
|
|
||||||
postID :: Int
|
|
||||||
, postOID :: Text
|
|
||||||
, postBody :: Text
|
|
||||||
, postMarkdown :: Text
|
|
||||||
, postAuthor :: Text
|
|
||||||
, postPage :: Int
|
|
||||||
} deriving (Show, Eq)
|
|
||||||
|
|
||||||
instance FromRow Post where
|
|
||||||
fromRow = Post <$> field <*> field <*> field <*> field <*> field <*> field
|
|
||||||
|
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
main = do
|
main = do
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
|
module Within.DBMemorial.Post where
|
||||||
|
|
||||||
|
import Control.Applicative
|
||||||
|
import Data.Monoid()
|
||||||
|
import Data.Text
|
||||||
|
import Database.SQLite.Simple.FromRow
|
||||||
|
|
||||||
|
data Post = Post {
|
||||||
|
postID :: Int
|
||||||
|
, postOID :: Text
|
||||||
|
, postBody :: Text
|
||||||
|
, postMarkdown :: Text
|
||||||
|
, postAuthor :: Text
|
||||||
|
, postPage :: Int
|
||||||
|
} deriving (Show, Eq)
|
||||||
|
|
||||||
|
instance FromRow Post where
|
||||||
|
fromRow = Post <$> field <*> field <*> field <*> field <*> field <*> field
|
Loading…
Reference in New Issue