Skip to content

Commit

Permalink
GHC-8.6 compatibility changes
Browse files Browse the repository at this point in the history
this is based on 1.4.10, to allow upgrading without using depending
code.

alpheccar#23 contains more comprehensive
upgrades to the latest, never released version of HPDF on github.
  • Loading branch information
nomeata committed Mar 6, 2019
1 parent a8f7e6c commit 1062cf0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions Graphics/PDF/Draw.hs
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,10 @@ pdfDictMember k (PDFDictionary d) = M.member k d

-- | Get a new resource name
supplyName :: Draw String
supplyName = do
(x:xs) <- gets supplyNames
modifyStrict $ \s -> s {supplyNames = xs}
return x
supplyName =
gets supplyNames >>= \(x:xs) -> do
modifyStrict $ \s -> s {supplyNames = xs}
return x

emptyDrawState :: Int -> DrawState
emptyDrawState ref =
Expand Down
4 changes: 2 additions & 2 deletions Graphics/PDF/LowLevel/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ instance PdfObject PDFDictionary where
]

in
M.foldWithKey convertItem mempty a
M.foldrWithKey convertItem mempty a

instance PdfLengthInfo PDFDictionary where

Expand Down Expand Up @@ -295,4 +295,4 @@ modifyStrict f = do
put $! (f s)

-- | A monad where paths can be created
class MonadWriter Builder m => MonadPath m
class MonadWriter Builder m => MonadPath m
4 changes: 2 additions & 2 deletions Graphics/PDF/Typesetting/Breaking.hs
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ getNewActiveBreakpoints settings sndPass fmaxw actives z =
-- We keep only the best new break
(Map.insertWith updateBreak (position z,line+1,f') (b' {demerit = d',fitnessValue = f', ratio = r}) newbreak ,newmap)
in
let (breaks',actives') = Map.foldWithKey analyzeActive (Map.empty,actives) actives
let (breaks',actives') = Map.foldrWithKey analyzeActive (Map.empty,actives) actives
dmin = minimum . map demerit . Map.elems $ breaks'
nbreaks = Map.filter (\x -> demerit x < dmin + (fitness_demerit settings)) breaks'
in
Expand Down Expand Up @@ -644,4 +644,4 @@ hyphenPenalty :: BRState
hyphenPenalty settings s w = FlaggedPenalty w (hyphenPenaltyValue settings) s

kernBox :: s -> PDFFloat -> Letter s
kernBox s w = Kern w (Just s)
kernBox s w = Kern w (Just s)

0 comments on commit 1062cf0

Please sign in to comment.