From 83c2203df8bac04bb96c06c4a7daaa2c7da34ff4 Mon Sep 17 00:00:00 2001 From: Eric Mertens Date: Mon, 23 Mar 2015 14:16:24 -0700 Subject: [PATCH] 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. --- src/Graphics/Vty.hs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Graphics/Vty.hs b/src/Graphics/Vty.hs index d45ab81..e09a35b 100644 --- a/src/Graphics/Vty.hs +++ b/src/Graphics/Vty.hs @@ -14,16 +14,19 @@ -- See the vty-examples package for a number of examples. -- -- @ +-- import "Graphics.Vty" +-- -- main = do --- vty <- 'mkVty' def --- let line0 = 'string' (def `withForeColor` 'green') \"first line\" --- line1 = 'string' (def `withBackColor` 'blue') \"second line\" +-- cfg <- 'standardIOConfig' +-- vty <- 'mkVty' cfg +-- let line0 = 'string' ('defAttr' ` 'withForeColor' ` 'green') \"first line\" +-- line1 = 'string' ('defAttr' ` 'withBackColor' ` 'blue') \"second line\" -- img = line0 '<->' line1 -- pic = 'picForImage' img -- 'update' vty pic --- e :: 'Event' <- 'nextEvent' vty +-- e <- 'nextEvent' vty -- 'shutdown' vty --- print $ \"Last event was: \" ++ show e +-- 'print' (\"Last event was: \" '++' 'show' e) -- @ -- -- Good sources of documentation for terminal programming are: