on master help sign in
export "empty_image" from Graphics.Vty.Picture
f66f30bcoreyoconnor
src/Graphics/Vty/Image.hs+11−1
@@ -19,6 +19,7 @@ module Graphics.Vty.Image ( Image(..)
19 , utf8_string
19 , utf8_string
20 , utf8_bytestring
20 , utf8_bytestring
21 , char_fill
21 , char_fill
22+ , empty_image
22 -- | The possible display attributes used in constructing an `Image`.
23 -- | The possible display attributes used in constructing an `Image`.
23 , module Graphics.Vty.Attributes
24 , module Graphics.Vty.Attributes
24 )
25 )
@@ -91,7 +92,11 @@ data Image =
91 { output_width :: !Word -- >= 1
92 { output_width :: !Word -- >= 1
92 , output_height :: !Word -- >= 1
93 , output_height :: !Word -- >= 1
93 }
94 }
95+ -- The combining operators identity constant.
96+ -- IdImage <|> a = a
97+ -- IdImage <-> a = a
98+ --
94− -- Any image of zero size equals the id image
99+ -- Any image of zero size equals the identity image.
95 | IdImage
100 | IdImage
96 deriving Eq
101 deriving Eq
97
102
@@ -310,3 +315,8 @@ char_fill :: Enum d => Attr -> Char -> d -> d -> Image
310char_fill !a !c w h =
315char_fill !a !c w h =
311 vert_cat $ replicate (fromEnum h) $ horiz_cat $ replicate (fromEnum w) $ char a c
316 vert_cat $ replicate (fromEnum h) $ horiz_cat $ replicate (fromEnum w) $ char a c
312
317
318+-- | The empty image. Useful for fold combinators. These occupy no space nor define any display
319+-- attributes.
320+empty_image :: Image
321+empty_image = IdImage
322+
src/Graphics/Vty/Picture.hs+1
@@ -16,6 +16,7 @@ module Graphics.Vty.Picture ( module Graphics.Vty.Picture
16 , utf8_string
16 , utf8_string
17 , utf8_bytestring
17 , utf8_bytestring
18 , char_fill
18 , char_fill
19+ , empty_image
19 -- | The possible display attributes used in constructing an `Image`.
20 -- | The possible display attributes used in constructing an `Image`.
20 , module Graphics.Vty.Attributes
21 , module Graphics.Vty.Attributes
21 )
22 )
test/Makefile+1
@@ -4,6 +4,7 @@ verify_control_strings \
4verify_utf8_width \
4verify_utf8_width \
5verify_image_ops \
5verify_image_ops \
6verify_image_trans \
6verify_image_trans \
7+verify_empty_image_props \
7verify_picture_ops \
8verify_picture_ops \
8verify_span_ops \
9verify_span_ops \
9verify_debug_terminal
10verify_debug_terminal