Permalink
Browse files

Deleted the backup files

  • Loading branch information...
1 parent 1f6b396 commit a3f937e0c37d167ee6b74df847c6077eab68577b @Palmik committed Mar 21, 2011
Showing with 0 additions and 169 deletions.
  1. +0 −67 src/Main.hs~
  2. +0 −34 src/Model/Paste.hs~
  3. +0 −68 src/Site.hs~
View
67 src/Main.hs~
@@ -1,67 +0,0 @@
-{-# LANGUAGE CPP #-}
-{-# LANGUAGE TemplateHaskell #-}
-
-{-|
-
-This is the entry point for this web server application. It supports
-easily switching between interpreting source and running statically
-compiled code.
-
-In either mode, the generated program should be run from the root of
-the project tree. When it is run, it locates its templates, static
-content, and source files in development mode, relative to the current
-working directory.
-
-When compiled with the development flag, only changes to the
-libraries, your cabal file, or this file should require a recompile to
-be picked up. Everything else is interpreted at runtime. There are a
-few consequences of this.
-
-First, this is much slower. Running the interpreter takes a
-significant chunk of time (a couple tenths of a second on the author's
-machine, at this time), regardless of the simplicity of the loaded
-code. In order to recompile and re-load server state as infrequently
-as possible, the source directories are watched for updates, as are
-any extra directories specified below.
-
-Second, the generated server binary is MUCH larger, since it links in
-the GHC API (via the hint library).
-
-Third, and the reason you would ever want to actually compile with
-development mode, is that it enables a faster development cycle. You
-can simply edit a file, save your changes, and hit reload to see your
-changes reflected immediately.
-
-When this is compiled without the development flag, all the actions
-are statically compiled in. This results in faster execution, a
-smaller binary size, and having to recompile the server for any code
-change.
-
--}
-
-module Main
-( main
-) where
-
-#ifdef DEVELOPMENT
-import Snap.Extension.Loader.Devel
-import Snap.Http.Server (quickHttpServe)
-#else
-import Snap.Extension.Server
-#endif
-
-import Application
-import Site
-
-main :: IO ()
-#ifdef DEVELOPMENT
-main = do
- -- All source directories will be watched for updates
- -- automatically. If any extra directories should be watched for
- -- updates, include them here.
- snap <- $(let extraWatcheDirs = ["resources/templates"]
- in loadSnapTH 'applicationInitializer 'site extraWatcheDirs)
- quickHttpServe snap
-#else
-main = quickHttpServe applicationInitializer site
-#endif
View
34 src/Model/Paste.hs~
@@ -1,34 +0,0 @@
-{-# LANGUAGE TemplateHaskell #-}
-{-# LANGUAGE OverloadedStrings #-}
-{-# LANGUAGE EmptyDataDecls #-}
-{-# LANGUAGE TypeFamilies #-}
-{-# LANGUAGE FlexibleContexts #-}
-
-module Model.Paste
-( Paste(..)
-, getRecentPastes
-, DbAccess
-, MonadMongoDB
-) where
-
-import Control.Monad (liftM)
-import Data.Maybe
-
-import Snap.Extension.DB.MongoDB
-import Snap.Extension.DB.MongoDB.Generics
-
-data Paste = Paste { pasteID :: RecKey
- , pasteTitle :: String
- , pasteContent :: String
- , pasteDescription :: String
- , pasteLanguage :: String
- } deriving (Eq, Show)
-
-$(deriveAll ''Paste "PFPaste")
-type instance PF Paste = PFPaste
-
-fromDocList :: (Regular a, FromDoc (PF a)) => [Document] -> [a]
-fromDocList = map fromJust . filter isJust . map fromDoc
-
-getRecentPastes :: (MonadMongoDB m, DbAccess m) => m [Paste]
-getRecentPastes = liftM fromDocList (rest =<< (withDB' $ find (select [] "pastes")))
View
68 src/Site.hs~
@@ -1,68 +0,0 @@
-{-# LANGUAGE OverloadedStrings #-}
-
-{-|
-
-This is where all the routes and handlers are defined for your site. The
-'site' function combines everything together and is exported by this module.
-
--}
-
-module Site
-( site
-) where
-
-import Control.Applicative
-import Data.Maybe
-import qualified Data.Text.Encoding as T
-import Snap.Extension.Heist
-import Snap.Extension.Timer
-import Snap.Util.FileServe
-import Snap.Types
-import Text.Templating.Heist
-
-import Application
-import Controller.Paste
-
-
-------------------------------------------------------------------------------
--- | Renders the front page of the sample site.
---
--- The 'ifTop' is required to limit this to the top of a route.
--- Otherwise, the way the route table is currently set up, this action
--- would be given every request.
-index :: Application ()
-index = ifTop $ heistLocal (bindSplices indexSplices) $ render "index"
- where
- indexSplices =
- [ ("start-time", startTimeSplice)
- , ("current-time", currentTimeSplice)
- ]
-
-
-------------------------------------------------------------------------------
--- | Renders the echo page.
-echo :: Application ()
-echo = do
- message <- decodedParam "stuff"
- heistLocal (bindString "message" (T.decodeUtf8 message)) $ render "echo"
- where
- decodedParam p = fromMaybe "" <$> getParam p
-
-
-------------------------------------------------------------------------------
--- | Render recent pastes
-pastes :: Application ()
-echo = ifTop $ heistLocal (bindSplices pastesSplices) $ render "pastes"
- where
- pastesSplices =
- [ ("recent-pastes", recentPastesSplice)
- ]
-
-------------------------------------------------------------------------------
--- | The main entry point handler.
-site :: Application ()
-site = route [ ("/", index)
- , ("/echo/:stuff", echo)
- , ("/pastes", pastes)
- ]
- <|> serveDirectory "resources/static"

0 comments on commit a3f937e

Please sign in to comment.