Permalink
Browse files

Port to GHC 7.10, latest LTS, builds with Stack

  • Loading branch information...
1 parent 142be15 commit bad90874d6052e817bd7163cbfdcab740bf7ff0b @chrisdone committed Nov 25, 2015
View
@@ -9,4 +9,5 @@ irclogs
cache/
TAGS
.hsenv/
-hpaste.conf
+hpaste.conf
+.stack-work
View
@@ -16,95 +16,18 @@ Category: Web
Build-type: Simple
Cabal-version: >=1.2
-Flag network-uri
- Description: Get Network.URI from the network-uri package
- Default: True
-
Executable hpaste
Main-is: Main.hs
Ghc-options: -threaded -Wall -O2 -fno-warn-name-shadowing
Hs-source-dirs: src
- Other-modules: Control.Monad.IO
- Control.Monad.Catch
- Control.Monad.Env
- HJScript.Objects.JQuery.Extra
- Data.Monoid.Operator
- Data.String.Extra
- Data.String.ToString
- Data.Time.Show
- Data.Maybe.Extra
- Data.Text.ToText
- Data.Text.FromText
- Data.Either.Extra
- Main
- Snap.App
- Network.URI.Params
- Network.Email
- Network.SendEmail
- Hpaste.Types.Stepeval
- Hpaste.Types.Cache
- Hpaste.Types.Language
- Hpaste.Types.Channel
- Hpaste.Types.Config
- Hpaste.Types.Report
- Hpaste.Types.Page
- Hpaste.Types.Newtypes
- Hpaste.Types.Announcer
- Hpaste.Types.Paste
- Hpaste.Types.Activity
- Hpaste.Types
- Hpaste.Controller.Admin
- Hpaste.Controller.Home
- Hpaste.Controller.Raw
- Hpaste.Controller.Cache
- Hpaste.Controller.Reported
- Hpaste.Controller.Irclogs
- Hpaste.Controller.Browse
- Hpaste.Controller.Report
- Hpaste.Controller.Script
- Hpaste.Controller.New
- Hpaste.Controller.Paste
- Hpaste.Controller.Activity
- Hpaste.Controller.Diff
- Hpaste.Model.Irclogs
- Hpaste.Model.Language
- Hpaste.Model.Channel
- Hpaste.Model.Report
- Hpaste.Model.Announcer
- Hpaste.Model.Spam
- Hpaste.Model.Paste
- Hpaste.Model.Activity
- Hpaste.Config
- Hpaste.View.Html
- Hpaste.View.Home
- Hpaste.View.Stepeval
- Hpaste.View.Reported
- Hpaste.View.Layout
- Hpaste.View.Annotate
- Hpaste.View.Irclogs
- Hpaste.View.Browse
- Hpaste.View.Report
- Hpaste.View.Script
- Hpaste.View.Thanks
- Hpaste.View.New
- Hpaste.View.Edit
- Hpaste.View.Paste
- Hpaste.View.Activity
- Hpaste.View.Diff
- Hpaste.View.Hlint
- Hpaste.View.Steps
- Hpaste.View.Highlight
- Text.Blaze.Html5.Extra
+ default-extensions: FlexibleContexts, ExtendedDefaultRules
Build-depends:
- -- Hard versions
- Diff==0.1.3
+ base >= 4 && < 5
+ ,Diff
,blaze-html
,blaze-markup
- -- Soft versions
- ,base >= 4 && < 5
,named-formlet
- ,snap-app == 0.6.0
- -- Free versions
+ ,snap-app
,ConfigFile
,HJScript
,MissingH
@@ -120,6 +43,8 @@ Executable hpaste
,hlint
,hscolour
,mtl
+ ,network
+ ,network-uri
,old-locale
,safe
,snap-core
@@ -129,7 +54,80 @@ Executable hpaste
,transformers
,utf8-string
,mime-mail
- ,cgi >= 3001.2.2.0
+ ,cgi
,process
,postgresql-simple
- ,network == 2.5.0.0
+ Other-modules:
+ Control.Monad.IO
+ Control.Monad.Catch
+ Data.Time.Relative
+ Hpaste.Controller.Rss
+ Control.Monad.Env
+ HJScript.Objects.JQuery.Extra
+ Data.Monoid.Operator
+ Data.String.Extra
+ Data.String.ToString
+ Data.Time.Show
+ Data.Maybe.Extra
+ Data.Text.ToText
+ Data.Text.FromText
+ Data.Either.Extra
+ Main
+ Snap.App
+ Network.URI.Params
+ Network.Email
+ Network.SendEmail
+ Hpaste.Types.Stepeval
+ Hpaste.Types.Cache
+ Hpaste.Types.Language
+ Hpaste.Types.Channel
+ Hpaste.Types.Config
+ Hpaste.Types.Report
+ Hpaste.Types.Page
+ Hpaste.Types.Newtypes
+ Hpaste.Types.Announcer
+ Hpaste.Types.Paste
+ Hpaste.Types.Activity
+ Hpaste.Types
+ Hpaste.Controller.Admin
+ Hpaste.Controller.Home
+ Hpaste.Controller.Raw
+ Hpaste.Controller.Cache
+ Hpaste.Controller.Reported
+ Hpaste.Controller.Irclogs
+ Hpaste.Controller.Browse
+ Hpaste.Controller.Report
+ Hpaste.Controller.Script
+ Hpaste.Controller.New
+ Hpaste.Controller.Paste
+ Hpaste.Controller.Activity
+ Hpaste.Controller.Diff
+ Hpaste.Model.Irclogs
+ Hpaste.Model.Language
+ Hpaste.Model.Channel
+ Hpaste.Model.Report
+ Hpaste.Model.Announcer
+ Hpaste.Model.Spam
+ Hpaste.Model.Paste
+ Hpaste.Model.Activity
+ Hpaste.Config
+ Hpaste.View.Html
+ Hpaste.View.Home
+ Hpaste.View.Stepeval
+ Hpaste.View.Reported
+ Hpaste.View.Layout
+ Hpaste.View.Annotate
+ Hpaste.View.Irclogs
+ Hpaste.View.Browse
+ Hpaste.View.Report
+ Hpaste.View.Script
+ Hpaste.View.Thanks
+ Hpaste.View.New
+ Hpaste.View.Edit
+ Hpaste.View.Paste
+ Hpaste.View.Activity
+ Hpaste.View.Diff
+ Hpaste.View.Hlint
+ Hpaste.View.Steps
+ Hpaste.View.Highlight
+ Text.Blaze.Html5.Extra
@@ -5,4 +5,4 @@ echo 'Killing ...'
killall hpaste
sleep 0.2
echo 'Starting ...'
-dist/build/hpaste/hpaste hpaste.conf & disown
+/home/chris/.local/bin/hpaste hpaste.conf & disown
View
@@ -1,4 +1,4 @@
#! /bin/bash
cd /home/chris/hpaste/
mkdir log -p
-dist/build/hpaste/hpaste hpaste.conf
+/home/chris/.local/bin/hpaste hpaste.conf
@@ -7,9 +7,8 @@
module Data.Time.Show
(showDateTime)
where
-
-import Data.Time (FormatTime,formatTime)
-import System.Locale (defaultTimeLocale)
+
+import Data.Time (FormatTime,formatTime,defaultTimeLocale)
showDateTime :: FormatTime t => t -> String
showDateTime time = formatTime defaultTimeLocale "%F %T %Z" time
@@ -15,7 +15,6 @@ import Data.Text.Lazy (pack)
import Data.Time
import Network.Curl.Download
import Snap.App.Types
-import System.Locale
import Text.Feed.Query
-- | Get commits of this project from a commit feed.
@@ -210,7 +210,7 @@ announcePaste ptype channel PasteSubmit{..} pid = do
-- | Is a nickname valid? Digit/letter or one of these: -_/\\;()[]{}?`'
validNick :: String -> Bool
validNick s = first && all ok s && length s > 0 where
- ok c = isDigit c || isLetter c || elem c "-_/\\;()[]{}?`'"
+ ok c = isDigit c || isLetter c || elem c ("-_/\\;()[]{}?`'" :: String)
first = all (\c -> isDigit c || isLetter c) $ take 1 s
-- | Get hints for a Haskell paste from hlint.
@@ -25,7 +25,6 @@ import Network.URI
import Network.URI.Params
import Prelude hiding ((++))
import Snap.App.Types
-import System.Locale
import Text.Blaze.Extra
import Text.Blaze.Html5 as H hiding (map)
import qualified Text.Blaze.Html5.Attributes as A
@@ -41,7 +41,7 @@ highlightPaste langs Paste{..} =
| languageName == "literatehaskell" ->
birdStyle pastePaste
| elem languageName ["haskell","agda","idris","elm"] ->
- preEscapedString $ hscolour False (unpack pastePaste)
+ preEscapedString $ hscolour False 1 (unpack pastePaste)
Just (Language{..}) ->
pre $ code ! A.class_ (toValue $ "language-" ++ lang) $
toHtml pastePaste
@@ -55,7 +55,7 @@ highlightPaste langs Paste{..} =
highlightHaskell :: Text -> Html
highlightHaskell paste =
H.table ! aClass "code" $
- td $ preEscapedString $ hscolour False (unpack paste)
+ td $ preEscapedString $ hscolour False 1 (unpack paste)
birdStyle :: Text -> Html
birdStyle = collect mempty (Right []) . map T.unpack . T.lines where
@@ -71,7 +71,7 @@ birdStyle = collect mempty (Right []) . map T.unpack . T.lines where
case acc of
Right hslines -> doc <> highlight hslines
Left text -> doc <> plaintext text
- highlight = preEscapedString . beaks . hscolour False
+ highlight = preEscapedString . beaks . hscolour False 1
plaintext = pre . toHtml
dropSpace (' ':xs) = xs
dropSpace xs = xs
@@ -148,6 +148,6 @@ navDirection uri Pagination{..} change caption = do
(show (pnCurrentPage + change))
uri
--- | Migration function.
-preEscapedString :: String -> Markup
-preEscapedString = preEscapedToMarkup
+-- -- | Migration function.
+-- preEscapedString :: String -> Markup
+-- preEscapedString = preEscapedToMarkup
View
@@ -0,0 +1,14 @@
+resolver: lts-3.15
+packages:
+- .
+- upstream/snap-app
+
+extra-deps:
+- HJScript-0.7.0
+- download-curl-0.1.4
+- named-formlet-0.2
+- HJavaScript-0.4.7
+- hsp-0.10.0
+- Diff-0.1.3
+flags: {}
+extra-package-dbs: []
@@ -0,0 +1,5 @@
+dist/*
+cabal-dev/*
+*.o
+*.hi
+TAGS
@@ -0,0 +1,30 @@
+Copyright (c) 2013, Chris Done
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+
+ * Neither the name of Chris Done nor the names of other
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
@@ -0,0 +1,41 @@
+name: snap-app
+version: 0.6.0
+synopsis: Simple modules for writing apps with Snap, abstracted from hpaste.
+homepage: https://github.com/chrisdone/snap-app
+license: BSD3
+license-file: LICENSE
+author: Chris Done
+maintainer: chrisdone@gmail.com
+category: Web
+build-type: Simple
+cabal-version: >=1.8
+
+library
+ ghc-options: -O2 -Wall -fno-warn-type-defaults
+ hs-source-dirs: src
+ exposed-modules: Snap.App, Snap.App.Types, Snap.App.Controller, Snap.App.Model, Snap.App.Migrate,
+ Snap.App.Cache, Snap.App.XML, Snap.App.RSS,
+ Data.Pagination, Text.Blaze.Extra, Text.Blaze.Pagination,
+ Control.Monad.Env, Data.Monoid.Operator,
+ Network.URI.Params
+ other-modules: Control.Monad.Catch
+ build-depends: base >= 4 && <5,
+ snap-core,
+ network-uri,
+ postgresql-simple,
+ mtl,
+ blaze-html >= 0.6,
+ blaze-markup >= 0.5,
+ safe,
+ text,
+ utf8-string,
+ bytestring,
+ MonadCatchIO-transformers,
+ cgi,
+ data-default,
+ filepath,
+ directory,
+ feed,
+ xml,
+ old-locale,
+ time
@@ -0,0 +1,5 @@
+{-# LANGUAGE PackageImports #-}
+
+module Control.Monad.Catch (module Control.Monad.CatchIO) where
+
+import "MonadCatchIO-transformers" Control.Monad.CatchIO
Oops, something went wrong.

0 comments on commit bad9087

Please sign in to comment.