From b6ca8364a44f43d95be92e89edb0fed18a168ed4 Mon Sep 17 00:00:00 2001 From: Christine Dodrill Date: Mon, 27 Jul 2015 23:18:58 -0700 Subject: [PATCH] Move Post to its own module --- web/src/Main.hs | 17 +---------------- web/src/Within/DBMemorial/Post.hs | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 16 deletions(-) create mode 100644 web/src/Within/DBMemorial/Post.hs diff --git a/web/src/Main.hs b/web/src/Main.hs index 3b323bb..d320c7b 100644 --- a/web/src/Main.hs +++ b/web/src/Main.hs @@ -1,24 +1,9 @@ {-# LANGUAGE OverloadedStrings #-} module Main where -import Control.Applicative -import Data.Monoid -import Data.Text hiding (head) import Database.SQLite.Simple -import Database.SQLite.Simple.FromRow import Web.Spock.Safe hiding (head) - -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 +import Within.DBMemorial.Post main :: IO () main = do diff --git a/web/src/Within/DBMemorial/Post.hs b/web/src/Within/DBMemorial/Post.hs new file mode 100644 index 0000000..25cfb23 --- /dev/null +++ b/web/src/Within/DBMemorial/Post.hs @@ -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