Used stylish-haskell on all source files

This commit is contained in:
"Vincent Ambo ext:(%22) 2013-04-28 14:30:00 +02:00
parent 8f1b6b5c4e
commit 9719b5a62d
5 changed files with 125 additions and 105 deletions

View file

@ -1,25 +1,30 @@
{-# LANGUAGE OverloadedStrings, ScopedTypeVariables, DeriveDataTypeable, TemplateHaskell, QuasiQuotes, RecordWildCards #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TemplateHaskell #-}
module Blog where
import Control.Monad (when, unless)
import Data.Data (Data, Typeable)
import Data.List (intersperse)
import Data.Maybe (fromJust)
import Data.Monoid (mempty)
import Data.Text (Text, append, pack, empty)
import Data.Text.Lazy (fromStrict)
import Data.Time
import Network.Captcha.ReCaptcha
import System.Locale (defaultTimeLocale)
import Text.Blaze.Html (preEscapedToHtml)
import Text.Hamlet
import Text.Lucius
import Text.Markdown
import Locales
import BlogDB
import BlogDB
import Control.Monad (unless, when)
import Data.Data (Data, Typeable)
import Data.List (intersperse)
import Data.Maybe (fromJust)
import Data.Monoid (mempty)
import Data.Text (Text, append, empty, pack)
import Data.Text.Lazy (fromStrict)
import Data.Time
import Locales
import Network.Captcha.ReCaptcha
import System.Locale (defaultTimeLocale)
import Text.Blaze.Html (preEscapedToHtml)
import Text.Hamlet
import Text.Lucius
import Text.Markdown
import qualified Data.Text as T
import qualified Data.Text as T
-- custom list functions
intersperse' :: a -> [a] -> [a]

View file

@ -1,30 +1,36 @@
{-# LANGUAGE DeriveDataTypeable, GeneralizedNewtypeDeriving, RecordWildCards,
TemplateHaskell, TypeFamilies, OverloadedStrings, ScopedTypeVariables, BangPatterns #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
module BlogDB where
import Control.Monad.Reader (ask)
import Control.Monad.State (get, put)
import Data.Acid
import Data.Acid.Advanced
import Data.Acid.Local
import Data.ByteString (ByteString)
import Data.Char (toLower)
import Data.Data (Data, Typeable)
import Data.IxSet (Indexable(..), IxSet(..), (@=), Proxy(..), getOne, ixFun, ixSet)
import Data.List (insert)
import Data.SafeCopy (SafeCopy, base, deriveSafeCopy)
import Data.Text (Text, pack)
import Data.Text.Lazy (toStrict)
import Data.Time
import Happstack.Server (FromReqURI(..))
import System.Environment (getEnv)
import Control.Monad.Reader (ask)
import Control.Monad.State (get, put)
import Data.Acid
import Data.Acid.Advanced
import Data.Acid.Local
import Data.ByteString (ByteString)
import Data.Char (toLower)
import Data.Data (Data, Typeable)
import Data.IxSet (Indexable (..), IxSet (..), Proxy (..),
getOne, ixFun, ixSet, (@=))
import Data.List (insert)
import Data.SafeCopy (SafeCopy, base, deriveSafeCopy)
import Data.Text (Text, pack)
import Data.Text.Lazy (toStrict)
import Data.Time
import Happstack.Server (FromReqURI (..))
import System.Environment (getEnv)
import qualified Crypto.Hash.SHA512 as SHA (hash)
import qualified Data.ByteString.Char8 as B
import qualified Crypto.Hash.SHA512 as SHA (hash)
import qualified Data.ByteString.Base64 as B64 (encode)
import qualified Data.IxSet as IxSet
import qualified Data.Text as Text
import qualified Data.ByteString.Char8 as B
import qualified Data.IxSet as IxSet
import qualified Data.Text as Text
newtype EntryId = EntryId { unEntryId :: Integer }
@ -58,14 +64,14 @@ data Comment = Comment {
$(deriveSafeCopy 0 'base ''Comment)
data Entry = Entry {
entryId :: EntryId,
lang :: BlogLang,
author :: Text,
title :: Text,
btext :: Text,
mtext :: Text,
edate :: UTCTime,
tags :: [Text],
entryId :: EntryId,
lang :: BlogLang,
author :: Text,
title :: Text,
btext :: Text,
mtext :: Text,
edate :: UTCTime,
tags :: [Text],
comments :: [Comment]
} deriving (Eq, Ord, Show, Data, Typeable)

View file

@ -1,15 +1,17 @@
{-# LANGUAGE ScopedTypeVariables, DeriveDataTypeable, OverloadedStrings #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Locales where
import Data.Data (Data, Typeable)
import Data.Maybe (fromMaybe)
import Data.Text (Text)
import qualified Data.Text as T
import Data.Data (Data, Typeable)
import Data.Maybe (fromMaybe)
import Data.Text (Text)
import qualified Data.Text as T
import Network.URI
import BlogDB (BlogLang (..))
import BlogDB (BlogLang (..))
{- to add a language simply define its abbreviation and Show instance then
- translate the appropriate strings and add CouchDB views in Server.hs -}

View file

@ -1,36 +1,43 @@
{-# LANGUAGE OverloadedStrings, ScopedTypeVariables, GeneralizedNewtypeDeriving,
DeriveDataTypeable, FlexibleContexts, MultiParamTypeClasses, TemplateHaskell,
TypeFamilies, RecordWildCards, BangPatterns #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
module Main where
import Control.Applicative ((<$>), (<*>), optional, pure)
import Control.Exception (bracket)
import Control.Monad (msum, mzero, when, unless)
import Control.Monad.IO.Class (liftIO)
import Control.Monad.State (get, put)
import Control.Monad.Reader (ask)
import qualified Crypto.Hash.SHA512 as SHA
import Control.Applicative (optional, pure, (<$>), (<*>))
import Control.Exception (bracket)
import Control.Monad (msum, mzero, unless, when)
import Control.Monad.IO.Class (liftIO)
import Control.Monad.Reader (ask)
import Control.Monad.State (get, put)
import qualified Crypto.Hash.SHA512 as SHA
import Data.Acid
import Data.Acid.Advanced
import Data.Acid.Local
import qualified Data.ByteString.Base64 as B64 (encode)
import Data.ByteString.Char8 (ByteString, pack, unpack)
import Data.Data (Data, Typeable)
import Data.Maybe (fromJust)
import Data.Monoid (mempty)
import Data.Text (Text)
import qualified Data.Text as T
import qualified Data.ByteString.Base64 as B64 (encode)
import Data.ByteString.Char8 (ByteString, pack, unpack)
import Data.Data (Data, Typeable)
import Data.Maybe (fromJust)
import Data.Monoid (mempty)
import Data.SafeCopy (base, deriveSafeCopy)
import Data.Text (Text)
import qualified Data.Text as T
import Data.Time
import Data.SafeCopy (base, deriveSafeCopy)
import Happstack.Server hiding (Session)
import Happstack.Server hiding (Session)
import Happstack.Server.Compression
import Network.Captcha.ReCaptcha
import Options
import System.Locale (defaultTimeLocale)
import System.Locale (defaultTimeLocale)
import Blog
import BlogDB hiding (addComment, updateEntry, deleteComment)
import BlogDB hiding (addComment, deleteComment,
updateEntry)
import Locales
import RSS

View file

@ -2,15 +2,15 @@
module RSS (renderFeed) where
import qualified Data.Text as T
import qualified Data.Text as T
import Data.Maybe (fromMaybe)
import Data.Time (getCurrentTime, UTCTime)
import Network.URI
import Text.RSS
import Data.Maybe (fromMaybe)
import Data.Time (UTCTime, getCurrentTime)
import Network.URI
import Text.RSS
import Locales
import BlogDB hiding (Title)
import BlogDB hiding (Title)
import Locales
createChannel :: BlogLang -> UTCTime -> [ChannelElem]
createChannel l now = [ Language $ show l