on master help sign in
Clean-up after dependency changes. Replace foldl with foldl' in some places.
ae6984cevancz
src/Elm.hs+1−1
@@ -5,7 +5,7 @@ import System.Environment
5import CompileToJS
5import CompileToJS
6import Data.List (isPrefixOf)
6import Data.List (isPrefixOf)
7import GenerateHtml
7import GenerateHtml
8−import Text.Blaze.Renderer.String
8+import Text.Blaze.Html.Renderer.String (renderHtml)
9
9
10main = getArgs >>= parse
10main = getArgs >>= parse
11
11
src/GenerateHtml.hs+21−20
@@ -1,32 +1,33 @@
1{-# LANGUAGE OverloadedStrings #-}
1{-# LANGUAGE OverloadedStrings #-}
2module GenerateHtml (generateHtml) where
2module GenerateHtml (generateHtml) where
3
3
4−import Text.Blaze.Html5 hiding (map)
4+import Text.Blaze (preEscapedToMarkup)
5import qualified Text.Blaze.Html5 as H
5import qualified Text.Blaze.Html5 as H
6−import Text.Blaze.Html5.Attributes
6+import Text.Blaze.Html5 ((!))
7import qualified Text.Blaze.Html5.Attributes as A
7import qualified Text.Blaze.Html5.Attributes as A
8
8
9+css = preEscapedToMarkup $
9−css = preEscapedString "* { padding:0; margin:0; \
10+ ("* { padding:0; margin:0; \
10− \hyphens: auto; -moz-hyphens: auto;\
11+ \hyphens: auto; -moz-hyphens: auto;\
11− \ -webkit-hyphens: auto; -ms-hyphens: auto; }\
12+ \ -webkit-hyphens: auto; -ms-hyphens: auto; }\
12− \body { font-family: Arial; }\
13+ \body { font-family: Arial; }\
13− \a:link {text-decoration: none}\
14+ \a:link {text-decoration: none}\
14− \a:visited {text-decoration: none}\
15+ \a:visited {text-decoration: none}\
15− \a:active {text-decoration: none}\
16+ \a:active {text-decoration: none}\
16− \a:hover {text-decoration: underline; color: #ff8f12;}"
17+ \a:hover {text-decoration: underline; color: #ff8f12;}" :: String)
17−
18+
18−makeScript :: String -> Html
19+makeScript :: String -> H.Html
19−makeScript s = script ! type_ "text/javascript" ! src (toValue s) $ ""
20+makeScript s = H.script ! A.type_ "text/javascript" ! A.src (H.toValue s) $ ""
20
21
21generateHtml libLoc title source =
22generateHtml libLoc title source =
22− docTypeHtml $ do
23+ H.docTypeHtml $ do
23 H.head $ do
24 H.head $ do
24− meta ! charset "UTF-8"
25+ H.meta ! A.charset "UTF-8"
25− H.title . toHtml $ title
26+ H.title . H.toHtml $ title
26 makeScript libLoc
27 makeScript libLoc
27− (script ! type_ "text/javascript") . preEscapedString $ source
28+ (H.script ! A.type_ "text/javascript") . preEscapedToMarkup $ source
28− H.style ! type_ "text/css" $ css
29+ H.style ! A.type_ "text/css" $ css
29− body $ do
30+ H.body $ do
30 H.div ! A.id "widthChecker" ! A.style "width:100%; height:1px; position:absolute; top:-1px;" $ ""
31 H.div ! A.id "widthChecker" ! A.style "width:100%; height:1px; position:absolute; top:-1px;" $ ""
31 H.span ! A.id "content" $ ""
32 H.span ! A.id "content" $ ""
32− script ! type_ "text/javascript" $ "Dispatcher.initialize()"
33+ H.script ! A.type_ "text/javascript" $ "Dispatcher.initialize()"
src/Parse/Binop.hs+1−1
@@ -39,7 +39,7 @@ binopSplit seen opTable i ops es =
39
39
40binopOf _ _ _ [e] = return e
40binopOf _ _ _ [e] = return e
41binopOf _ [] ops es =
41binopOf _ [] ops es =
42− return $ foldl (flip ($)) (head es) $ zipWith Binop ops (tail es)
42+ return $ foldl' (flip ($)) (head es) $ zipWith Binop ops (tail es)
43
43
44binopOf seen (tbl@((lvl, L, op):rest)) ops es =
44binopOf seen (tbl@((lvl, L, op):rest)) ops es =
45 case elemIndices op ops of
45 case elemIndices op ops of
src/Parse/Combinators.hs+3−3
@@ -1,7 +1,7 @@
1module Combinators where
1module Combinators where
2import Control.Monad
2import Control.Monad
3import Data.Char
3import Data.Char
4−import Data.List (sortBy)
4+import Data.List (sortBy,foldl',foldl1')
5
5
6newtype Parser from to = Parser ([from] -> [(to,[from])])
6newtype Parser from to = Parser ([from] -> [(to,[from])])
7--newtype Parser a = Parser (String -> [(a,String)])
7--newtype Parser a = Parser (String -> [(a,String)])
@@ -52,7 +52,7 @@ newline = do
52 return ""
52 return ""
53
53
54digit = do {x <- sat isDigit; return (ord x - ord '0')}
54digit = do {x <- sat isDigit; return (ord x - ord '0')}
55−integer = do {i <- plus digit; return $ foldl (\a d -> 10 * a + d) 0 i}
55+integer = do {i <- plus digit; return $ foldl' (\a d -> 10 * a + d) 0 i}
56
56
57variable = do
57variable = do
58 shd <- sat isLower;
58 shd <- sat isLower;
@@ -66,7 +66,7 @@ sepBy1 sep p = do
66 xs <- star (sep >> p)
66 xs <- star (sep >> p)
67 return $ x:xs
67 return $ x:xs
68
68
69−select = foldl1 (+|+)
69+select = foldl1' (+|+)
70
70
71chainl p op a = chainl1 p op +++ return a
71chainl p op a = chainl1 p op +++ return a
72chainl1 p op = do {a <- p; rest a}
72chainl1 p op = do {a <- p; rest a}
src/Server.hs+2−6
@@ -1,16 +1,12 @@
1−{-# LANGUAGE OverloadedStrings #-}
1+
2module Main where
2module Main where
3
3
4−import Prelude hiding (head,span,id)
5import Control.Monad (msum,guard)
4import Control.Monad (msum,guard)
6import Control.Monad.Trans (MonadIO(liftIO))
5import Control.Monad.Trans (MonadIO(liftIO))
7import Data.List (isPrefixOf, isSuffixOf)
6import Data.List (isPrefixOf, isSuffixOf)
8−import Happstack.Server hiding (body)
7+import Happstack.Server
9import Happstack.Server.Compression
8import Happstack.Server.Compression
10import System.Environment
9import System.Environment
11−import Text.Blaze.Html5 hiding (map)
12−import Text.Blaze.Html5.Attributes hiding (title,span,dir,style)
13−import Text.Blaze.Internal
14import ToHtml
10import ToHtml
15
11
16serve :: String -> IO ()
12serve :: String -> IO ()
src/ToHtml.hs+1−6
@@ -2,18 +2,13 @@
2module ToHtml (compileToHtml) where
2module ToHtml (compileToHtml) where
3
3
4import CompileToJS
4import CompileToJS
5−import Data.Monoid (mempty)
6import GenerateHtml
5import GenerateHtml
7−import Network.HTTP.Base (urlEncode)
8−import Text.Blaze.Html5 hiding (map)
9import qualified Text.Blaze.Html5 as H
6import qualified Text.Blaze.Html5 as H
10−import Text.Blaze.Html5.Attributes
11import qualified Text.Blaze.Html5.Attributes as A
7import qualified Text.Blaze.Html5.Attributes as A
12
8
13pageTitle fp =
9pageTitle fp =
14 reverse . takeWhile (/='/') . drop 1 . dropWhile (/='.') $ reverse fp
10 reverse . takeWhile (/='/') . drop 1 . dropWhile (/='.') $ reverse fp
15
11
16−
17−compileToHtml :: String -> String -> String -> Html
12+compileToHtml :: String -> String -> String -> H.Html
18compileToHtml libLoc fileName source =
13compileToHtml libLoc fileName source =
19 generateHtml libLoc (pageTitle fileName) (compileToJS source)
14 generateHtml libLoc (pageTitle fileName) (compileToJS source)