mirror of
https://github.com/ilyakooo0/vty.git
synced 2024-10-04 03:07:07 +03:00
Update example programs to use new default values
This commit is contained in:
parent
564cd5cc00
commit
1741b935c5
@ -8,8 +8,6 @@ import Verify
|
||||
import Control.Applicative
|
||||
import Control.Monad
|
||||
|
||||
import Data.Default (def)
|
||||
|
||||
import System.Random
|
||||
|
||||
rand :: Arbitrary a => IO a
|
||||
@ -21,7 +19,7 @@ randomImage = rand
|
||||
randomPicture = picForImage <$> randomImage
|
||||
|
||||
bench0 = do
|
||||
vty <- mkVty def
|
||||
vty <- mkVty defaultConfig
|
||||
(w,h) <- displayBounds $ outputIface vty
|
||||
let pictures = replicateM 3000 randomPicture
|
||||
bench ps = do
|
||||
|
@ -9,7 +9,6 @@ import Control.Concurrent( threadDelay )
|
||||
import Control.Monad( liftM2 )
|
||||
|
||||
import qualified Data.ByteString.Char8 as B
|
||||
import Data.Default (def)
|
||||
import Data.List
|
||||
|
||||
import System.Environment( getArgs )
|
||||
@ -19,7 +18,7 @@ import System.Random
|
||||
bench0 = do
|
||||
let fixedGen = mkStdGen 0
|
||||
setStdGen fixedGen
|
||||
vty <- mkVty def
|
||||
vty <- mkVty defaultConfig
|
||||
(w,h) <- displayBounds $ outputIface vty
|
||||
let images = return $ (image0, image1)
|
||||
image0 = charFill defAttr 'X' w h
|
||||
|
@ -9,10 +9,8 @@ import Verify
|
||||
|
||||
import Control.Monad ( forM_ )
|
||||
|
||||
import Data.Default (def)
|
||||
|
||||
bench0 = do
|
||||
vty <- mkVty def
|
||||
vty <- mkVty defaultConfig
|
||||
(w,h) <- displayBounds $ outputIface vty
|
||||
let testChars = return $ take 500 $ cycle $ [ c | c <- ['a'..'z']]
|
||||
bench d = do
|
||||
@ -28,7 +26,7 @@ testImageUsingChar c w h
|
||||
$ horizCat $ map (char defAttr) (replicate (fromIntegral w) c)
|
||||
|
||||
bench1 = do
|
||||
vty <- mkVty def
|
||||
vty <- mkVty defaultConfig
|
||||
(w,h) <- displayBounds $ outputIface vty
|
||||
let testChars = return $ take 500 $ cycle $ [ c | c <- ['a'..'z']]
|
||||
bench d = do
|
||||
|
@ -6,7 +6,6 @@ import Verify
|
||||
import Control.Concurrent( threadDelay )
|
||||
import Control.Monad( liftM2 )
|
||||
|
||||
import Data.Default (def)
|
||||
import Data.List
|
||||
import Data.Word
|
||||
|
||||
@ -17,7 +16,7 @@ import System.Random
|
||||
bench0 = do
|
||||
let fixedGen = mkStdGen 0
|
||||
setStdGen fixedGen
|
||||
return $ Bench (return ()) (\() -> mkVty def >>= liftM2 (>>) run shutdown)
|
||||
return $ Bench (return ()) (\() -> mkVty defaultConfig >>= liftM2 (>>) run shutdown)
|
||||
|
||||
run vt = mapM_ (\p -> update vt p) . benchgen =<< displayBounds (outputIface vt)
|
||||
|
||||
|
@ -6,7 +6,6 @@ import Control.Applicative
|
||||
import Control.Arrow
|
||||
import Control.Monad.RWS
|
||||
|
||||
import Data.Default (def)
|
||||
import Data.Sequence (Seq, (<|) )
|
||||
import qualified Data.Sequence as Seq
|
||||
import Data.Foldable
|
||||
@ -16,7 +15,7 @@ eventBufferSize = 1000
|
||||
type App = RWST Vty () (Seq String) IO
|
||||
|
||||
main = do
|
||||
vty <- mkVty def
|
||||
vty <- mkVty defaultConfig
|
||||
_ <- execRWST (vtyInteract False) vty Seq.empty
|
||||
shutdown vty
|
||||
|
||||
|
@ -2,10 +2,8 @@ module Main where
|
||||
|
||||
import Graphics.Vty
|
||||
|
||||
import Data.Default
|
||||
|
||||
main = do
|
||||
vty <- mkVty def
|
||||
vty <- mkVty defaultConfig
|
||||
let line0 = string (def `withForeColor` green) "first line"
|
||||
line1 = string (def `withBackColor` blue) "second line"
|
||||
img = line0 <-> line1
|
||||
|
@ -4,7 +4,6 @@ module Main where
|
||||
import Graphics.Vty
|
||||
|
||||
import Data.Array
|
||||
import Data.Default (def)
|
||||
|
||||
import Control.Applicative
|
||||
import Control.Monad
|
||||
@ -43,7 +42,7 @@ type Coord = (Int, Int)
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
vty <- mkVty def
|
||||
vty <- mkVty defaultConfig
|
||||
level0 <- mkLevel 1
|
||||
let world0 = World (Player (levelStart level0)) level0
|
||||
(_finalWorld, ()) <- execRWST play vty world0
|
||||
|
@ -12,7 +12,6 @@ import Control.Concurrent (threadDelay)
|
||||
import Control.Exception
|
||||
import Control.Monad
|
||||
|
||||
import Data.Default (def)
|
||||
import Data.List ( lookup )
|
||||
import Data.Maybe ( isJust, fromJust )
|
||||
import Data.Monoid
|
||||
@ -938,7 +937,7 @@ cursorHideTest0 = Test
|
||||
{ testName = "Verify the cursor is hid and re-shown. issue #7"
|
||||
, testID = "cursorHideTest0"
|
||||
, testAction = do
|
||||
vty <- mkVty def
|
||||
vty <- mkVty defaultConfig
|
||||
showCursor $ outputIface vty
|
||||
setCursorPos (outputIface vty) 5 5
|
||||
nextEvent vty
|
||||
|
Loading…
Reference in New Issue
Block a user