mirror of
https://github.com/ilyakooo0/vty.git
synced 2024-10-04 03:07:07 +03:00
35 lines
911 B
Haskell
35 lines
911 B
Haskell
|
{-# LANGUAGE BangPatterns #-}
|
||
|
module BenchNoDiffOpt where
|
||
|
|
||
|
{-# LANGUAGE BangPatterns #-}
|
||
|
import Graphics.Vty
|
||
|
|
||
|
import Control.Concurrent( threadDelay )
|
||
|
import Control.Monad( liftM2 )
|
||
|
|
||
|
import qualified Data.ByteString.Char8 as B
|
||
|
import Data.List
|
||
|
|
||
|
import System.Environment( getArgs )
|
||
|
import System.IO
|
||
|
import System.Random
|
||
|
|
||
|
bench_0 = do
|
||
|
let fixed_gen = mkStdGen 0
|
||
|
setStdGen fixed_gen
|
||
|
vty <- mkVty
|
||
|
DisplayRegion w h <- display_bounds $ terminal vty
|
||
|
let image_0 = char_fill def_attr 'X' w h
|
||
|
let image_1 = char_fill def_attr '0' w h
|
||
|
flip_out vty 300 image_0 image_1
|
||
|
shutdown vty
|
||
|
|
||
|
flip_out vty n image_0 image_1 =
|
||
|
let !p_left = pic_for_image image_0
|
||
|
!p_right = pic_for_image image_1
|
||
|
w_left 0 = return ()
|
||
|
w_left n = update vty p_left >> w_right (n-1)
|
||
|
w_right 0 = return ()
|
||
|
w_right n = update vty p_right >> w_left (n-1)
|
||
|
in w_left n
|