removed a lot of warnings

This commit is contained in:
Yann Esposito 2012-08-20 13:20:44 +02:00
parent 47c0a20664
commit 783f32f56a
3 changed files with 5 additions and 5 deletions

View file

@ -24,7 +24,6 @@ import Yesod.Logger (Logger, logMsg, formatLogText)
import Network.HTTP.Conduit (Manager)
import qualified Settings
import qualified Database.Persist.Store
import Settings.StaticFiles
import Database.Persist.GenericSql
import Settings (widgetFile, Extra (..))
import Model

View file

@ -14,7 +14,7 @@ import Data.Text (pack)
cssClassVote :: [Entity Vote] -> Text
cssClassVote [] = ""
cssClassVote ((Entity voteId vote):vs) = case voteValue vote of
cssClassVote ((Entity _ vote):_) = case voteValue vote of
1 -> " yeah_voted"
(-1) -> " neah_voted"
_ -> ""
@ -36,7 +36,7 @@ getEntryR entryId = do
votes <- return []
defaultLayoutJson
(htmlWidget titleEntry entry currentUserId votes)
(jsonWidget titleEntry entry currentUserId votes)
(jsonWidget titleEntry)
Just userId -> do
votes <- runDB $ selectList
[VoteCreator ==. userId,
@ -44,10 +44,10 @@ getEntryR entryId = do
[LimitTo 1]
defaultLayoutJson
(htmlWidget titleEntry entry currentUserId votes)
(jsonWidget titleEntry entry currentUserId votes)
(jsonWidget titleEntry)
Nothing -> errorPageJson titleEntry
where
jsonWidget titleStr entry currentUserId votes = object ["msg" .= titleStr]
jsonWidget titleStr = object ["msg" .= titleStr]
htmlWidget titleStr entry currentUserId votes = do
setTitle $ toHtml titleStr
$(widgetFile "entry")

View file

@ -14,6 +14,7 @@ import qualified Data.Map as M
-- Show the id number from an entry
-- Can be used inside HTML
showId :: Key backend entity -> String
showId k = showInt64 $ unKey k
where showInt64 (PersistInt64 i) = show i
showInt64 _ = "unknow"