on master help sign in
Graphics.Vty.Inline: haddock pass
7342cffJonathan Daugherty
src/Graphics/Vty/Inline.hs+14−15
@@ -5,10 +5,10 @@
5-- used inline with other output systems.
5-- used inline with other output systems.
6--
6--
7-- The changes specified by the InlineM monad are applied to the
7-- The changes specified by the InlineM monad are applied to the
8−-- terminals display attributes. These display attributes effect the
8+-- terminal's display attributes. These display attributes affect the
9-- display of all following text output to the terminal file descriptor.
9-- display of all following text output to the terminal file descriptor.
10--
10--
11−-- For example, in an IO monad the following code with print the text
11+-- For example, in an IO monad the following code will print the text
12-- \"Not styled. \" Followed by the text \" Styled! \" drawn over a red
12-- \"Not styled. \" Followed by the text \" Styled! \" drawn over a red
13-- background and underlined.
13-- background and underlined.
14--
14--
@@ -22,11 +22,11 @@
22-- putStrLn \"Not styled.\"
22-- putStrLn \"Not styled.\"
23-- @
23-- @
24--
24--
25−-- 'putAttrChange' outputs the control codes to the terminal device
25+-- 'putAttrChange' emits the control codes to the terminal device
26−-- 'Handle'. This is a duplicate of the 'stdout' handle when the
26+-- attached to 'Handle'. This is a duplicate of the 'stdout' handle when
27−-- 'terminalHandle' was (first) acquired. If 'stdout' has since been
27+-- the 'terminalHandle' was (first) acquired. If 'stdout' has since been
28−-- changed then 'putStr', 'putStrLn', 'print' etc.. will output to a
28+-- changed then 'putStr', 'putStrLn', 'print' etc. will output to a
29−-- different 'Handle' than 'putAttrChange'
29+-- different 'Handle' than 'putAttrChange'.
30--
30--
31-- Copyright 2009-2010 Corey O'Connor
31-- Copyright 2009-2010 Corey O'Connor
32module Graphics.Vty.Inline
32module Graphics.Vty.Inline
@@ -50,17 +50,17 @@ import System.IO
50
50
51type InlineM v = State Attr v
51type InlineM v = State Attr v
52
52
53−-- | Set the background color to the provided 'Color'
53+-- | Set the background color to the provided 'Color'.
54backColor :: Color -> InlineM ()
54backColor :: Color -> InlineM ()
55backColor c = modify $ flip mappend ( currentAttr `withBackColor` c )
55backColor c = modify $ flip mappend ( currentAttr `withBackColor` c )
56
56
57−-- | Set the foreground color to the provided 'Color'
57+-- | Set the foreground color to the provided 'Color'.
58foreColor :: Color -> InlineM ()
58foreColor :: Color -> InlineM ()
59foreColor c = modify $ flip mappend ( currentAttr `withForeColor` c )
59foreColor c = modify $ flip mappend ( currentAttr `withForeColor` c )
60
60
61−-- | Attempt to change the 'Style' of the following text.
61+-- | Attempt to change the 'Style' of the following text..
62--
62--
63−-- If the terminal does not support the style change no error is
63+-- If the terminal does not support the style change then no error is
64-- produced. The style can still be removed.
64-- produced. The style can still be removed.
65applyStyle :: Style -> InlineM ()
65applyStyle :: Style -> InlineM ()
66applyStyle s = modify $ flip mappend ( currentAttr `withStyle` s )
66applyStyle s = modify $ flip mappend ( currentAttr `withStyle` s )
@@ -68,7 +68,7 @@ applyStyle s = modify $ flip mappend ( currentAttr `withStyle` s )
68-- | Attempt to remove the specified 'Style' from the display of the
68-- | Attempt to remove the specified 'Style' from the display of the
69-- following text.
69-- following text.
70--
70--
71−-- This will fail if applyStyle for the given style has not been
71+-- This will fail if 'applyStyle' for the given style has not been
72-- previously called.
72-- previously called.
73removeStyle :: Style -> InlineM ()
73removeStyle :: Style -> InlineM ()
74removeStyle sMask = modify $ \attr ->
74removeStyle sMask = modify $ \attr ->
@@ -78,7 +78,7 @@ removeStyle sMask = modify $ \attr ->
78 SetTo s -> s .&. complement sMask
78 SetTo s -> s .&. complement sMask
79 in attr { attrStyle = SetTo style' }
79 in attr { attrStyle = SetTo style' }
80
80
81−-- | Reset the display attributes
81+-- | Reset the display attributes.
82defaultAll :: InlineM ()
82defaultAll :: InlineM ()
83defaultAll = put defAttr
83defaultAll = put defAttr
84
84
@@ -105,8 +105,7 @@ putAttrChange out c = liftIO $ do
105 inlineHack dc
105 inlineHack dc
106
106
107-- | Apply the provided display attributes changes to the terminal
107-- | Apply the provided display attributes changes to the terminal
108−-- output device that was current at the time this was first used.
108+-- output device.
109−-- Which, for most use cases, is the current terminal.
110--
109--
111-- This will flush the terminal output.
110-- This will flush the terminal output.
112putAttrChange_ :: ( Applicative m, MonadIO m ) => InlineM () -> m ()
111putAttrChange_ :: ( Applicative m, MonadIO m ) => InlineM () -> m ()