on master help sign in
Adding Monoid instance for Image. Incorrect, but sufficient for now
7414e11coreyoconnor
src/Graphics/Vty/Image.hs+7
@@ -32,6 +32,7 @@ import Codec.Binary.UTF8.Width
32import Codec.Binary.UTF8.String ( decode )
32import Codec.Binary.UTF8.String ( decode )
33
33
34import qualified Data.ByteString as BS
34import qualified Data.ByteString as BS
35+import Data.Monoid
35import qualified Data.Sequence as Seq
36import qualified Data.Sequence as Seq
36import qualified Data.String.UTF8 as UTF8
37import qualified Data.String.UTF8 as UTF8
37import Data.Word
38import Data.Word
@@ -111,6 +112,12 @@ instance Show Image where
111 = "VertJoin (" ++ show c ++ ", " ++ show r ++ ") ( " ++ show t ++ " ) <-> ( " ++ show b ++ " )"
112 = "VertJoin (" ++ show c ++ ", " ++ show r ++ ") ( " ++ show t ++ " ) <-> ( " ++ show b ++ " )"
112 show ( IdImage ) = "IdImage"
113 show ( IdImage ) = "IdImage"
113
114
115+-- | Currently append in the Monoid instance is equivalent to <->. Future versions will just stack
116+-- the images.
117+instance Monoid Image where
118+ mempty = empty_image
119+ mappend = (<->)
120+
114-- A horizontal text image of 0 characters in width simplifies to the IdImage
121-- A horizontal text image of 0 characters in width simplifies to the IdImage
115horiz_text :: Attr -> StringSeq -> Word -> Image
122horiz_text :: Attr -> StringSeq -> Word -> Image
116horiz_text a txt ow
123horiz_text a txt ow
vty.cabal+37−5
@@ -32,8 +32,6 @@ Build-Depends: array
32Build-Depends: parsec >= 3 && < 4
32Build-Depends: parsec >= 3 && < 4
33Build-Type: Simple
33Build-Type: Simple
34Data-Files: README, TODO
34Data-Files: README, TODO
35−Extra-Source-Files: test/Test.hs, cbits/gwinsz.h, test/Bench.hs
36−
37Exposed-Modules: Graphics.Vty
35Exposed-Modules: Graphics.Vty
38 Graphics.Vty.Terminal
36 Graphics.Vty.Terminal
39 Graphics.Vty.LLInput
37 Graphics.Vty.LLInput
@@ -56,8 +54,42 @@ C-Sources: cbits/gwinsz.c
56 cbits/mk_wcwidth.c
54 cbits/mk_wcwidth.c
57Include-Dirs: cbits
55Include-Dirs: cbits
58hs-source-dirs: src
56hs-source-dirs: src
57+Extra-Source-Files: test/Makefile
58+ test/Bench2.hs
59+ test/Bench.hs
60+ test/BenchRenderChar.hs
61+ test/ControlTable.hs
62+ test/HereDoc.hs
63+ test/interactive_terminal_test.hs
64+ test/Test2.hs
65+ test/Test.hs
66+ test/verify_attribute_ops.hs
67+ test/verify_debug_terminal.hs
68+ test/verify_eval_terminfo_caps.hs
69+ test/Verify.hs
70+ test/verify_image_ops.hs
71+ test/verify_image_trans.hs
72+ test/verify_parse_terminfo_caps.hs
73+ test/verify_picture_ops.hs
74+ test/verify_picture_to_span.hs
75+ test/verify_span_ops.hs
76+ test/verify_utf8_width.hs
77+ test/vty_issue_18.hs
78+ test/yi_issue_264.hs
79+ test/Verify/Graphics/Vty/Attributes.hs
80+ test/Verify/Graphics/Vty/Picture.hs
81+ test/Verify/Graphics/Vty/Span.hs
82+ test/Verify/Graphics/Vty/DisplayRegion.hs
83+ test/Verify/Graphics/Vty/Image.hs
84+ test/Verify/Data/Terminfo/Parse.hs
85+ src/Codec/Binary/UTF8/Debug.hs
86+ src/Graphics/Vty/Terminal/Debug.hs
87+ src/Graphics/Vty/Debug.hs
88+ cbits/gwinsz.c
89+ cbits/mk_wcwidth.c
90+ cbits/set_term_timing.c
59−Install-Includes: gwinsz.h
91+ cbits/gwinsz.h
60
92
61−ghc-options: -funbox-strict-fields -Wall -threaded
93+ghc-options: -funbox-strict-fields -Wall -fno-full-laziness -fspec-constr
62−ghc-prof-options: -funbox-strict-fields -auto-all -Wall -threaded
94+ghc-prof-options: -funbox-strict-fields -caf-all -Wall -fno-full-laziness -fspec-constr
63
95