Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge remote-tracking branch 'thoughtpolice/fixups'

Conflicts:
	src/Text/Trifecta/Delta.hs
	src/Text/Trifecta/Rendering.hs
	src/Text/Trifecta/Rope.hs
	trifecta.cabal
  • Loading branch information...
commit 6fc550659ef6eb48e565447e7485c6feb0d65634 2 parents feff7fc + 3b77073
@ekmett authored
View
12 examples/RFC2616.hs
@@ -33,15 +33,15 @@ data Request = Request {
, requestProtocol :: String
} deriving (Eq, Ord, Show)
-requestLine :: TokenParsing m => m Request
+requestLine :: (Monad m, TokenParsing m) => m Request
requestLine = Request <$!> (highlight ReservedIdentifier (some token) <?> "request method")
<* skipHSpaces
<*> (highlight Identifier (some (satisfy (not . isHSpace))) <?> "url")
<* skipHSpaces
- -- <*> try (highlight ReservedIdentifier (string "HTTP/" *> many httpVersion <* endOfLine) <?> "protocol")
<*> (try (highlight ReservedIdentifier (string "HTTP/" *> many httpVersion <* endOfLine)) <?> "protocol")
- where
- httpVersion = satisfy $ \c -> c == '1' || c == '0' || c == '.' || c == '9'
+ where
+ httpVersion :: (Monad m, CharParsing m) => m Char
+ httpVersion = satisfy $ \c -> c == '1' || c == '0' || c == '.' || c == '9'
endOfLine :: CharParsing m => m ()
endOfLine = (string "\r\n" *> pure ()) <|> (char '\n' *> pure ())
@@ -51,14 +51,14 @@ data Header = Header {
, headerValue :: [String]
} deriving (Eq, Ord, Show)
-messageHeader :: TokenParsing m => m Header
+messageHeader :: (Monad m, TokenParsing m) => m Header
messageHeader = (\h b c -> Header h (b : c))
<$!> (highlight ReservedIdentifier (some token) <?> "header name")
<* highlight Operator (char ':') <* skipHSpaces
<*> (highlight Identifier (manyTill anyChar endOfLine) <?> "header value")
<*> (many (skipHSpaces *> manyTill anyChar endOfLine) <?> "blank line")
-request :: TokenParsing m => m (Request, [Header])
+request :: (Monad m, TokenParsing m) => m (Request, [Header])
request = (,) <$> requestLine <*> many messageHeader <* endOfLine
lumpy arg = do
View
2  examples/RFC2616.txt
@@ -1,4 +1,4 @@
-GET http://slashdot.org/ HTTP/lolwut
+GET http://slashdot.org/ HTTP/1.1
foo: this is a test
GET http://slashdot.org/ HTTP/1.0
View
8 src/Text/Trifecta/Highlight.hs
@@ -96,8 +96,8 @@ instance Eq (Located a) where
instance Ord (Located a) where
compare (_ :@ m) (_ :@ n) = compare m n
-instance ToHtml HighlightedRope where
- toHtml (HighlightedRope intervals r) = pre $ go 0 lbs effects where
+instance ToMarkup HighlightedRope where
+ toMarkup (HighlightedRope intervals r) = pre $ go 0 lbs effects where
lbs = L.fromChunks [bs | Strand bs _ <- F.toList (strands r)]
ln no = Html5.a ! name (toValue $ "line-" ++ show no) $ Empty
effects = sort $ [ i | (Interval lo hi, tok) <- intersections mempty (delta r) intervals
@@ -140,8 +140,8 @@ makeClassy ''HighlightDoc
doc :: String -> HighlightedRope -> HighlightDoc
doc t r = HighlightDoc t "trifecta.css" r
-instance ToHtml HighlightDoc where
- toHtml (HighlightDoc t css cs) = docTypeHtml $ do
+instance ToMarkup HighlightDoc where
+ toMarkup (HighlightDoc t css cs) = docTypeHtml $ do
head $ do
preEscapedString "<!-- Generated by trifecta, http://github.com/ekmett/trifecta/ -->\n"
title $ toHtml t
View
3  trifecta.cabal
@@ -46,7 +46,8 @@ library
array >= 0.3.0.2 && < 0.5,
base >= 4.4 && < 5,
blaze-builder >= 0.3.0.1 && < 0.4,
- blaze-html >= 0.4.1.6 && < 0.5,
+ blaze-html >= 0.5 && < 0.6,
+ blaze-markup >= 0.5 && < 0.6,
bytestring >= 0.9.1 && < 0.11,
charset >= 0.3.2.1,
comonad == 3.0.*,
Please sign in to comment.
Something went wrong with that request. Please try again.