Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Removed remnants of the Timer code and redundant imports

  • Loading branch information...
commit 3fe6232117a55ccc0ffd7215665443ed5ddb32e3 1 parent 718c1e7
@Palmik authored
View
3  src/Application.hs
@@ -14,7 +14,6 @@ module Application
import Snap.Extension
import Snap.Extension.Heist.Impl
-import Snap.Extension.Timer.Impl
import Snap.Extension.DB.MongoDB
@@ -54,4 +53,4 @@ applicationInitializer :: Initializer ApplicationState
applicationInitializer = do
heist <- heistInitializer "resources/templates"
database <- mongoDBInitializer (Host "127.0.0.1" $ PortNumber 27017) 1 "pastie"
- return $ ApplicationState heist timer database
+ return $ ApplicationState heist database
View
23 src/Controller/Paste.hs
@@ -9,20 +9,15 @@ module Controller.Paste
, possibleLanguagesSplice
) where
-import qualified Data.Text as T
+import qualified Data.Text as T
import Data.Text (Text)
-import Data.Maybe
import qualified Data.Text.Encoding as T (decodeUtf8)
-import qualified Text.XmlHtml as X
import Control.Monad.Trans
-import Control.Monad (mzero)
-import qualified Data.ByteString.Char8 as BS (unpack)
import Snap.Types
import Text.Templating.Heist
-import Application
-import Model.Utils
+import Application
import Model.Paste
@@ -37,12 +32,12 @@ possibleLanguagesSplice :: Splice Application
possibleLanguagesSplice = mapSplices (runChildrenWithText . languageParts) possibleLanguages
pasteParts :: Paste -> [(Text, Text)]
-pasteParts p = map applyAndPack [ ("title", pasteTitle)
- , ("source-code", pasteCode)
- , ("description", pasteDescription)
- , ("language", pasteLanguage)
- , ("paste-id", pasteLink) ]
- where applyAndPack (x, f) = (x, f p)
+pasteParts paste = map applyAndPack [ ("title", pasteTitle)
+ , ("source-code", pasteCode)
+ , ("description", pasteDescription)
+ , ("language", pasteLanguage)
+ , ("paste-id", pasteLink) ]
+ where applyAndPack (x, f) = (x, f paste)
pasteLink p = maybe "#" id $ pasteIDText p
@@ -66,7 +61,7 @@ addPasteHandler = do
c <- getParam "source-code" >>= maybe (redirect "/") (return . T.decodeUtf8)
d <- getParam "description" >>= maybe (redirect "/") (return . T.decodeUtf8)
l <- getParam "language" >>= maybe (redirect "/") (return . T.decodeUtf8)
- if (not $ any T.null [t, c, d, l]) then insertPaste $ paste t c d l else return ()
+ if (not $ any T.null [t, c, d, l]) then insertPaste $ makePaste t c d l else return ()
redirect "/"
View
10 src/Model/Paste.hs
@@ -5,7 +5,7 @@
module Model.Paste
( Paste(..)
- , paste
+ , makePaste
, getRecentPastes
, getPaste
, pastesTable
@@ -14,10 +14,6 @@ module Model.Paste
, ObjectId
) where
-import Data.Either
-import Control.Monad
-import Control.Monad.IO.Class
-import qualified Data.Text as T
import qualified Data.Text.Encoding as T (decodeUtf8)
import Data.Text (Text)
@@ -43,8 +39,8 @@ pastesTable :: Collection
pastesTable = "pastes"
-- | Smart Paste constructor which takes care of RecKey initialization
-paste :: Text -> Text -> Text -> Text -> Paste
-paste t c d l = Paste (RecKey Nothing) t c d l
+makePaste :: Text -> Text -> Text -> Text -> Paste
+makePaste t c d l = Paste (RecKey Nothing) t c d l
-- | Returns all pastes in descending order by date
getRecentPastes :: Application [Paste]
View
4 src/Site.hs
@@ -13,14 +13,10 @@ module Site
import Control.Applicative
import Control.Monad
-import Debug.Trace
-import Control.Monad.Trans
import Data.Maybe
-import qualified Data.Text.Encoding as T
import Snap.Extension.DB.MongoDB (bs2objid)
import Snap.Extension.Heist
-import Snap.Extension.Timer
import Snap.Util.FileServe
import Snap.Types
import Text.Templating.Heist
Please sign in to comment.
Something went wrong with that request. Please try again.