packages feed

wumpus-core 0.42.0 → 0.42.1

raw patch · 4 files changed

+50/−26 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Wumpus.Core.Text.Base: instance Monoid EscapedText

Files

src/Wumpus/Core/Picture.hs view
@@ -284,7 +284,7 @@   where     step p (a:b:c:ys) = let v1 = a .-. p                              v2 = b .-. a-                            v3 = c .-. a+                            v3 = c .-. b                         in RelCurveTo v1 v2 v3 : step c ys     step _ _          = [] 
src/Wumpus/Core/Text/Base.hs view
@@ -79,10 +79,11 @@   ) where  import Wumpus.Core.Utils.FormatCombinators+import Wumpus.Core.Utils.HList  import Data.Char import qualified Data.IntMap as IntMap-+import Data.Monoid  -- | Internal string representation for Wumpus-Core. -- @@ -90,11 +91,11 @@ -- may be either a regular character, an integer representing a  -- Unicode code-point or a PostScript glyph name. -- -newtype EscapedText = EscapedText { getEscapedText :: [EscapedChar] }-  deriving (Eq,Show)+newtype EscapedText = EscapedText { getEscapedText :: H EscapedChar }   + -- | Internal character representation for Wumpus-Core. --  -- An 'EscapedChar' may be either a regular character, an integer@@ -115,8 +116,18 @@  -------------------------------------------------------------------------------- +escapedTextList :: EscapedText -> [EscapedChar]+escapedTextList = toListH . getEscapedText++instance Eq EscapedText where+  (==) a b = escapedTextList a == escapedTextList b++instance Show EscapedText where+  show = show . escapedTextList+  + instance Format EscapedText where-  format = hcat . map format . getEscapedText+  format = hcat . map format . escapedTextList   instance Format EscapedChar where@@ -125,6 +136,10 @@   format (CharEscName s) = text "&" <> text s <> semicolon  +instance Monoid EscapedText where+  mempty        = EscapedText emptyH+  a `mappend` b = EscapedText $ getEscapedText a `appendH` getEscapedText b+ --------------------------------------------------------------------------------  @@ -156,12 +171,12 @@ -- | Build an 'EscapedText' from a single 'EscChar'. -- wrapEscChar :: EscapedChar -> EscapedText-wrapEscChar ec = EscapedText [ec]+wrapEscChar ec = EscapedText $ wrapH ec  -- | /Destructor/ for 'EscapedText'. -- destrEscapedText :: ([EscapedChar] -> a) -> EscapedText -> a-destrEscapedText f = f . getEscapedText+destrEscapedText f = f . escapedTextList   -- | Get the character count of an 'EscapedText' string.@@ -178,15 +193,15 @@ --   -lexer :: String -> [EscapedChar]-lexer []            = []+lexer :: String -> H EscapedChar+lexer []            = emptyH lexer ('&':'#':cs)  = escNumStart cs lexer ('&':cs)      = escName cs-lexer (c:cs)        = CharLiteral c : lexer cs+lexer (c:cs)        = CharLiteral c `consH` lexer cs  -- Input is malformed if this reaches the @rest@ case. -- -escNumStart :: String -> [EscapedChar]+escNumStart :: String -> H EscapedChar escNumStart ('0':'o':cs)           = escOct cs escNumStart ('0':'O':cs)           = escOct cs escNumStart ('0':'x':cs)           = escHex cs@@ -194,32 +209,32 @@ escNumStart (c:cs) | isDigit c     = escDec (digitToInt c) cs escNumStart rest                   = chompToSemi rest       -escName :: String -> [EscapedChar]-escName (c:cs)                     = let (ss,rest) = span isAlphaNum cs -                                     in specialEscape (c:ss) : chompToSemi rest-escName []                         = [] +escName :: String -> H EscapedChar+escName (c:cs) = let (ss,rest) = span isAlphaNum cs +                 in specialEscape (c:ss) `consH` chompToSemi rest+escName []     = emptyH   -- | One digit consumed already... ---escDec :: Int -> String -> [EscapedChar]+escDec :: Int -> String -> H EscapedChar escDec n (c:cs) | isDigit c = escDec (n*10 + digitToInt c) cs-escDec n cs     | n > 0     = CharEscInt n : chompToSemi cs+escDec n cs     | n > 0     = CharEscInt n `consH` chompToSemi cs                 | otherwise = chompToSemi cs -escHex :: String -> [EscapedChar]+escHex :: String -> H EscapedChar escHex = step 0   where     step n (c:cs) | isHexDigit c = step (n*16 + digitToInt c) cs-    step n cs     | n > 0        = CharEscInt n : chompToSemi cs+    step n cs     | n > 0        = CharEscInt n `consH` chompToSemi cs                   | otherwise    = chompToSemi cs   -escOct :: String -> [EscapedChar]+escOct :: String -> H EscapedChar escOct = step 0   where     step n (c:cs) | isHexDigit c = step (n*8 + digitToInt c) cs-    step n cs     | n > 0        = CharEscInt n : chompToSemi cs+    step n cs     | n > 0        = CharEscInt n `consH` chompToSemi cs                   | otherwise    = chompToSemi cs   @@ -227,10 +242,10 @@ -- The last two conditions both indicate ill-formed input, but it -- is /best/ if the lexer does not throw errors. -- -chompToSemi :: String -> [EscapedChar]+chompToSemi :: String -> H EscapedChar chompToSemi (';':cs) = lexer cs chompToSemi (_:cs)   = chompToSemi cs           -chompToSemi []       = []+chompToSemi []       = emptyH   -- | Special processing for @amp@ because it is so common.
src/Wumpus/Core/VersionNumber.hs view
@@ -22,7 +22,7 @@  -- | Version number. ----- > (0,42,0)+-- > (0,42,1) -- wumpus_core_version :: (Int,Int,Int)-wumpus_core_version = (0,42,0)+wumpus_core_version = (0,42,1)
wumpus-core.cabal view
@@ -1,5 +1,5 @@ name:             wumpus-core-version:          0.42.0+version:          0.42.1 license:          BSD3 license-file:     LICENSE copyright:        Stephen Tetley <stephen.tetley@gmail.com>@@ -47,6 +47,15 @@   .     .   Changelog:+  .+  v0.42.0 to v0.42.1:+  .+  * Fixed bug in the @curvedPath@ function in @Core.Picture@+    where the wrong relative point was being calculated for the +    second control point.+  .+  * Changed internals of the @EscapedText@ type so it supports +    efficient concatenation, and now has a Monoid instance.   .    v0.41.0 to v0.42.0:   .