on master help sign in
Update the example in Graphics.Vty

Previously this example had two problems which prevented a new user copying the example out of haddock. 1) It unnecessarily relied on 'def', which comes from an external package which the user might not know about, and doesn't need to worry about. 2) Haddock wasn't rendering the back-ticks correctly, so withForeColor appeared without the back-tick 3) It used the ScopedTypeVariables extension.

commit83c2203df8bac04bb96c06c4a7daaa2c7da34ff4 authorEric Mertens <emertens@gmail.com> dateMon 23 Mar 2015, 14:16 (12 years ago) parent475c45d
1 file changed+8−5
src/Graphics/Vty.hs+8−5
src/Graphics/Vty.hs+8−5
@@ -14,16 +14,19 @@
1414-- See the vty-examples package for a number of examples.
1515--
1616-- @
17+-- import "Graphics.Vty"
18+--
1719-- main = do
18−-- vty <- 'mkVty' def
19−-- let line0 = 'string' (def `withForeColor` 'green') \"first line\"
20−-- line1 = 'string' (def `withBackColor` 'blue') \"second line\"
20+-- cfg <- 'standardIOConfig'
21+-- vty <- 'mkVty' cfg
22+-- let line0 = 'string' ('defAttr' ` 'withForeColor' ` 'green') \"first line\"
23+-- line1 = 'string' ('defAttr' ` 'withBackColor' ` 'blue') \"second line\"
2124-- img = line0 '<->' line1
2225-- pic = 'picForImage' img
2326-- 'update' vty pic
24−-- e :: 'Event' <- 'nextEvent' vty
27+-- e <- 'nextEvent' vty
2528-- 'shutdown' vty
26−-- print $ \"Last event was: \" ++ show e
29+-- 'print' (\"Last event was: \" '++' 'show' e)
2730-- @
2831--
2932-- Good sources of documentation for terminal programming are: