Commits

Luke Plant  committed 9635e27

Removed utility functions that are now in Ella

  • Participants
  • Parent commits cf0f633

Comments (0)

Files changed (4)

File src/Blog/Forms.hs

 
 import Blog.Formats (Format(..), getFormatter)
 import Blog.Model (checkPassword)
-import Blog.Utils (getTimestamp)
 import Control.Monad (liftM)
 import Data.Maybe (fromJust, isNothing)
 import Ella.Forms.Widgets.TextInput (TextInput(..))
 import Ella.Forms.Widgets.Textarea  (Textarea(..))
-import Ella.GenUtils (exactParse)
+import Ella.GenUtils (exactParse, getTimestamp)
 import Ella.Param (captureOrDefault, Param(..))
 import Data.String.Utils (strip)
 import qualified Blog.Comment as Cm

File src/Blog/Model.hs

 import Data.Digest.Pure.SHA (showDigest, sha1)
 import Database.HDBC
 import Blog.DBUtils (makeSlugGeneric, pagedQuery, sqlInIds, getDbId)
-import Blog.Utils (regexReplace, randomStr, split)
-import Ella.GenUtils (utf8)
+import Blog.Utils (regexReplace, split)
+import Ella.GenUtils (utf8, randomStr)
 import qualified Blog.DB as DB
 import qualified Blog.Post as P
 import qualified Blog.Category as Ct

File src/Blog/Utils.hs

 {-# LANGUAGE BangPatterns, FlexibleContexts  #-}
 module Blog.Utils where
 
-import Control.Monad (liftM)
 import Data.Char
-import Random (randomRs, newStdGen)
 import System.Environment(getArgs)
-import System.Posix.Time (epochTime)
 import System.Posix.Types
 import Text.Regex.Base
 import Text.Regex.PCRE
    where
        rest = split cs delim
 
--- | Return current time as a UNIX timestamp
-getTimestamp :: IO Int
-getTimestamp = liftM (floor . toRational) epochTime
-
--- | Returns a randomly generated string of length n
-randomStr :: Int -> IO String
-randomStr n = do
-    g <- newStdGen
-    return $ take n (randomRs chars g)
-  where chars = ('a','z')

File src/Blog/Views.hs

 import Blog.Links
 import Blog.Model
 import Blog.Templates
-import Blog.Utils (getTimestamp)
 import Ella.Framework (default404, View)
-import Ella.GenUtils (utf8, with, exactParse)
+import Ella.GenUtils (utf8, with, exactParse, getTimestamp)
 import Ella.Param (captureOrDefault, capture)
 import Ella.Request
 import Ella.Response