on master help sign in
Update example programs to use new default values
commit1741b935c50d534eeb6d4cdad179cb0ef6aaee6d authorJonathan Daugherty <cygnus@foobox.com> dateTue 24 Jan 2017, 11:46 (10 years ago) parent564cd5c
8 files changed+9−20
test/BenchImageFuzz.hs+1−3 test/BenchNoDiffOpt.hs+1−2 test/BenchRenderChar.hs+2−4 test/BenchVerticalScroll.hs+1−2 test/EventEcho.hs+1−2 test/MinimalExample.hs+1−3 test/Rogue.hs+1−2 test/interactive_terminal_test.hs+1−2
test/BenchImageFuzz.hs+1−3
@@ -8,8 +8,6 @@ import Verify
88import Control.Applicative
99import Control.Monad
1010
11−import Data.Default (def)
12−
1311import System.Random
1412
1513rand :: Arbitrary a => IO a
@@ -21,7 +19,7 @@ randomImage = rand
2119randomPicture = picForImage <$> randomImage
2220
2321bench0 = do
24− vty <- mkVty def
22+ vty <- mkVty defaultConfig
2523 (w,h) <- displayBounds $ outputIface vty
2624 let pictures = replicateM 3000 randomPicture
2725 bench ps = do
test/BenchNoDiffOpt.hs+1−2
@@ -9,7 +9,6 @@ import Control.Concurrent( threadDelay )
99import Control.Monad( liftM2 )
1010
1111import qualified Data.ByteString.Char8 as B
12−import Data.Default (def)
1312import Data.List
1413
1514import System.Environment( getArgs )
@@ -19,7 +18,7 @@ import System.Random
1918bench0 = do
2019 let fixedGen = mkStdGen 0
2120 setStdGen fixedGen
22− vty <- mkVty def
21+ vty <- mkVty defaultConfig
2322 (w,h) <- displayBounds $ outputIface vty
2423 let images = return $ (image0, image1)
2524 image0 = charFill defAttr 'X' w h
test/BenchRenderChar.hs+2−4
@@ -9,10 +9,8 @@ import Verify
99
1010import Control.Monad ( forM_ )
1111
12−import Data.Default (def)
13−
1412bench0 = do
15− vty <- mkVty def
13+ vty <- mkVty defaultConfig
1614 (w,h) <- displayBounds $ outputIface vty
1715 let testChars = return $ take 500 $ cycle $ [ c | c <- ['a'..'z']]
1816 bench d = do
@@ -28,7 +26,7 @@ testImageUsingChar c w h
2826 $ horizCat $ map (char defAttr) (replicate (fromIntegral w) c)
2927
3028bench1 = do
31− vty <- mkVty def
29+ vty <- mkVty defaultConfig
3230 (w,h) <- displayBounds $ outputIface vty
3331 let testChars = return $ take 500 $ cycle $ [ c | c <- ['a'..'z']]
3432 bench d = do
test/BenchVerticalScroll.hs+1−2
@@ -6,7 +6,6 @@ import Verify
66import Control.Concurrent( threadDelay )
77import Control.Monad( liftM2 )
88
9−import Data.Default (def)
109import Data.List
1110import Data.Word
1211
@@ -17,7 +16,7 @@ import System.Random
1716bench0 = do
1817 let fixedGen = mkStdGen 0
1918 setStdGen fixedGen
20− return $ Bench (return ()) (\() -> mkVty def >>= liftM2 (>>) run shutdown)
19+ return $ Bench (return ()) (\() -> mkVty defaultConfig >>= liftM2 (>>) run shutdown)
2120
2221run vt = mapM_ (\p -> update vt p) . benchgen =<< displayBounds (outputIface vt)
2322
test/EventEcho.hs+1−2
@@ -6,7 +6,6 @@ import Control.Applicative
66import Control.Arrow
77import Control.Monad.RWS
88
9−import Data.Default (def)
109import Data.Sequence (Seq, (<|) )
1110import qualified Data.Sequence as Seq
1211import Data.Foldable
@@ -16,7 +15,7 @@ eventBufferSize = 1000
1615type App = RWST Vty () (Seq String) IO
1716
1817main = do
19− vty <- mkVty def
18+ vty <- mkVty defaultConfig
2019 _ <- execRWST (vtyInteract False) vty Seq.empty
2120 shutdown vty
2221
test/MinimalExample.hs+1−3
@@ -2,10 +2,8 @@ module Main where
22
33import Graphics.Vty
44
5−import Data.Default
6−
75main = do
8− vty <- mkVty def
6+ vty <- mkVty defaultConfig
97 let line0 = string (def `withForeColor` green) "first line"
108 line1 = string (def `withBackColor` blue) "second line"
119 img = line0 <-> line1
test/Rogue.hs+1−2
@@ -4,7 +4,6 @@ module Main where
44import Graphics.Vty
55
66import Data.Array
7−import Data.Default (def)
87
98import Control.Applicative
109import Control.Monad
@@ -43,7 +42,7 @@ type Coord = (Int, Int)
4342
4443main :: IO ()
4544main = do
46− vty <- mkVty def
45+ vty <- mkVty defaultConfig
4746 level0 <- mkLevel 1
4847 let world0 = World (Player (levelStart level0)) level0
4948 (_finalWorld, ()) <- execRWST play vty world0
test/interactive_terminal_test.hs+1−2
@@ -12,7 +12,6 @@ import Control.Concurrent (threadDelay)
1212import Control.Exception
1313import Control.Monad
1414
15−import Data.Default (def)
1615import Data.List ( lookup )
1716import Data.Maybe ( isJust, fromJust )
1817import Data.Monoid
@@ -938,7 +937,7 @@ cursorHideTest0 = Test
938937 { testName = "Verify the cursor is hid and re-shown. issue #7"
939938 , testID = "cursorHideTest0"
940939 , testAction = do
941− vty <- mkVty def
940+ vty <- mkVty defaultConfig
942941 showCursor $ outputIface vty
943942 setCursorPos (outputIface vty) 5 5
944943 nextEvent vty