Skip to content

Commit

Permalink
doctest fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyday567 committed Dec 30, 2023
1 parent 32611c2 commit e18adcd
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 28 deletions.
27 changes: 14 additions & 13 deletions checklist.org
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

#+RESULTS:

- [ ] version check&bump
- [X] version check&bump
0.1.0.0

- [ ] ghcup upgrades
- [X] ghcup upgrades

#+begin_src sh :results output
ghcup list -c set -r
Expand All @@ -24,7 +24,7 @@
: hls 2.5.0.0 latest
: stack 2.13.1 latest
: ghcup 0.1.20.0 latest,recommended
- [ ] cabal.project check
- [X] cabal.project check

#+begin_src sh :results output
cat cabal.project
Expand All @@ -33,7 +33,7 @@
#+RESULTS:
: packages:
: mealy.cabal
- [ ] upstream publishings
- [X] upstream publishings
- [ ] cabal update

#+begin_src sh :results output
Expand All @@ -46,7 +46,7 @@
: The index-state is set to 2023-12-19T03:05:53Z.
: To revert to previous state run:
: cabal v2-update 'hackage.haskell.org,2023-12-18T22:41:30Z'
- [ ] cabal outdated
- [X] cabal outdated
#+begin_src sh :results output
cabal outdated
#+end_src
Expand All @@ -62,14 +62,14 @@
#+RESULTS:
: Resolving dependencies...
: Congratulations, all your dependencies have upper bounds!
- [ ] cabal build --ghc-options=-Wunused-packages
- [X] cabal build --ghc-options=-Wunused-packages
#+begin_src sh :results output
cabal clean && cabal build --ghc-options=-Wunused-packages
#+end_src

#+RESULTS:
: Up to date
- [ ] cabal-fix
- [X] cabal-fix

#+begin_src sh :results output
cabal-fix --gen
Expand All @@ -92,9 +92,9 @@
#+begin_src sh :results output
cabal build --prefer-oldest
#+end_src
- [ ] FIXMEs & TODOs
- [X] FIXMEs & TODOs
- [ ] pragma cleanup
- [ ] cabal-docspec
- [X] cabal-docspec

#+begin_src sh :results output
cabal-docspec
Expand All @@ -114,7 +114,7 @@
cabal bench
#+end_src

- [ ] ormolu
- [X] ormolu

#+begin_src sh :results output
ormolu --mode check $(git ls-files '*.hs')
Expand All @@ -127,17 +127,18 @@
#+end_src

#+RESULTS:
- [ ] hlint
- [X] hlint
#+begin_src sh :results output
hlint .
#+end_src

#+RESULTS:
: No hints
- [ ] CI upgrade
- [X] CI upgrade

- check tested-with line in cabal file
- [ ] exact version bump
- [X] exact version bump
0.1.0.0
- [ ] branch, push & check CI
- [ ] haddock

Expand Down
6 changes: 3 additions & 3 deletions src/DotParse/Examples.hs
Original file line number Diff line number Diff line change
Expand Up @@ -514,9 +514,9 @@ svgAll =

-- | algebraic graph example
--
-- >>> exGraph = defaultGraph & addStatements (toStatements Directed (Char8.pack . show <$> exAGraph))
-- >>> exGraphAugmented <- processGraph exGraph
-- >>> writeChartOptions "other/exga.svg" (graphToChart exGraphAugmented)
-- > exGraph = defaultGraph & addStatements (toStatements Directed (Char8.pack . show <$> exAGraph))
-- > exGraphAugmented <- processGraph exGraph
-- > writeChartOptions "other/exga.svg" (graphToChart exGraphAugmented)
--
-- ![augmentation example](other/exga.svg)
exAGraph :: G.Graph Int
Expand Down
22 changes: 10 additions & 12 deletions src/DotParse/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ module DotParse.Types
gattL,
attL,
defaultGraph,
balancedGraph,
processDotWith,
processDot,
processGraph,
Expand Down Expand Up @@ -310,6 +309,16 @@ instance DotParse Statement where
--
-- >>> runDotParser "<The <font color='red'><b>foo</b></font>,<br/> the <font point-size='20'>bar</font> and<br/> the <i>baz</i>>" :: ID
-- IDHtml "<The <font color='red'><b>foo</b></font>,<br/> the <font point-size='20'>bar</font> and<br/> the <i>baz</i>>"
--
-- >>> runDotParser "shape=diamond" :: (ID,ID)
-- (ID "shape",ID "diamond")
--
-- >>> runDotParser "fontname=\"Arial\"" :: (ID,ID)
-- (ID "fontname",IDQuoted "Arial")
--
-- >>> runDotParser "[shape=diamond; color=blue] [label=label]" :: Map.Map ID ID
-- fromList [(ID "color",ID "blue"),(ID "label",ID "label"),(ID "shape",ID "diamond")]
--
data ID = ID ByteString | IDInt Int | IDDouble Double | IDQuoted ByteString | IDHtml ByteString deriving (Eq, Show, Generic, Ord)

instance DotParse ID where
Expand Down Expand Up @@ -342,11 +351,6 @@ label (IDHtml h) = utf8ToStr h

-- | Attribute key-value pair of identifiers
--
-- >>> runDotParser "shape=diamond" :: (ID,ID)
-- (ID "shape",ID "diamond")
--
-- >>> runDotParser "fontname=\"Arial\"" :: (ID,ID)
-- (ID "fontname",IDQuoted "Arial")
instance DotParse (ID, ID) where
dotPrint cfg (x0, x1) = dotPrint cfg x0 <> "=" <> dotPrint cfg x1

Expand All @@ -359,9 +363,6 @@ instance DotParse (ID, ID) where

-- | Attribute collections
--
-- >>> runDotParser "[shape=diamond; color=blue] [label=label]" :: Map.Map ID ID
-- fromList [(ID "color",ID "blue"),(ID "label",ID "label"),(ID "shape",ID "diamond")]
--
-- A given entity can have multiple attribute lists. For simplicity, these are mconcat'ed on parsing.
instance DotParse (Map.Map ID ID) where
dotPrint cfg as =
Expand Down Expand Up @@ -591,9 +592,6 @@ addStatement (StatementGlobalAttribute (GlobalAttributeStatement s)) g = g & #gl
addStatements :: [Statement] -> Graph -> Graph
addStatements ss g = Prelude.foldr addStatement g ss

balancedGraph :: Graph
balancedGraph = defaultGraph & attL GraphType (ID "center") .~ Just (ID "true")

-- | run a dot string through graphviz, supplying arguments and collecting stdout
processDotWith :: Directed -> [String] -> ByteString -> IO ByteString
processDotWith d args i = do
Expand Down

0 comments on commit e18adcd

Please sign in to comment.