Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Thanks to mightybyte I got the basic stuff working.

  • Loading branch information...
commit 84667bad891d0869323e5715d8dae1972eeab915 1 parent 47becef
@Palmik authored
Showing with 4 additions and 5 deletions.
  1. +2 −2 src/Controller/Paste.hs
  2. +2 −3 src/Model/Paste.hs
View
4 src/Controller/Paste.hs
@@ -5,6 +5,7 @@ module Controller.Paste
) where
import qualified Data.Text as T
+import Control.Monad.Trans
import Text.Templating.Heist
@@ -19,8 +20,7 @@ pasteParts paste = map applyAndPack [ ("title", pasteTitle)
, ("language", pasteLanguage) ]
where applyAndPack (x, f) = (T.pack x, T.pack $ f paste)
--- recentPastesSplice :: (Monad m, DbAccess (TemplateMonad m), MonadMongoDB (TemplateMonad m)) => Splice m
recentPastesSplice :: Splice Application
recentPastesSplice = do
- pastes <- getRecentPastes
+ pastes <- lift getRecentPastes
mapSplices (runChildrenWithText . pasteParts) pastes
View
5 src/Model/Paste.hs
@@ -30,8 +30,7 @@ $(deriveAll ''Paste "PFPaste")
type instance PF Paste = PFPaste
fromDocList :: (Regular a, FromDoc (PF a)) => [Document] -> [a]
-fromDocList = map fromJust . filter isJust . map fromDoc
+fromDocList = catMaybes . map fromDoc
--- getRecentPastes :: (MonadMongoDB m, DbAccess m) => m [Paste]
getRecentPastes :: Application [Paste]
-getRecentPastes = liftM fromDocList (rest =<< (withDB' $ find (select [] "pastes")))
+getRecentPastes = liftM fromDocList (withDB' $ rest =<< (find (select [] "pastes")))
Please sign in to comment.
Something went wrong with that request. Please try again.