jtdaugherty / vty

A high-level ncurses alternative written in Haskell
BSD 3-Clause "New" or "Revised" License
319 stars 57 forks source link

Examples have bitrotten #268

Closed RyanGlScott closed 7 months ago

RyanGlScott commented 10 months ago

I tried to run vty-interactive-terminal-test recently with GHC 9.2, but it fails to compile:

``` [1 of 1] Compiling Main ( interactive_terminal_test.hs, C:\\Users\winferno\Documents\Hacking\Haskell\vty\dist-newstyle\build\x86_64-windows\ghc-9.2.8\vty-examples -5.37\x\vty-interactive-terminal-test\build\vty-interactive-terminal-test\vty-interactive-terminal-test-tmp\Main.o ) interactive_terminal_test.hs:80:10: error: Variable not in scope: standardIOConfig :: IO a23 | 80 | t <- standardIOConfig >>= outputForConfig | ^^^^^^^^^^^^^^^^ interactive_terminal_test.hs:80:31: error: Variable not in scope: outputForConfig :: a23 -> IO Output | 80 | t <- standardIOConfig >>= outputForConfig | ^^^^^^^^^^^^^^^ interactive_terminal_test.hs:191:14: error: Variable not in scope: standardIOConfig :: IO a2 | 191 | t <- standardIOConfig >>= outputForConfig | ^^^^^^^^^^^^^^^^ interactive_terminal_test.hs:191:35: error: Variable not in scope: outputForConfig :: a2 -> IO Output | 191 | t <- standardIOConfig >>= outputForConfig | ^^^^^^^^^^^^^^^ interactive_terminal_test.hs:224:14: error: Variable not in scope: standardIOConfig :: IO a3 | 224 | t <- standardIOConfig >>= outputForConfig | ^^^^^^^^^^^^^^^^ interactive_terminal_test.hs:224:35: error: Variable not in scope: outputForConfig :: a3 -> IO Output | 224 | t <- standardIOConfig >>= outputForConfig | ^^^^^^^^^^^^^^^ interactive_terminal_test.hs:245:14: error: Variable not in scope: standardIOConfig :: IO a4 | 245 | t <- standardIOConfig >>= outputForConfig | ^^^^^^^^^^^^^^^^ interactive_terminal_test.hs:245:35: error: Variable not in scope: outputForConfig :: a4 -> IO Output | 245 | t <- standardIOConfig >>= outputForConfig | ^^^^^^^^^^^^^^^ interactive_terminal_test.hs:274:14: error: Variable not in scope: standardIOConfig :: IO a5 | 274 | t <- standardIOConfig >>= outputForConfig | ^^^^^^^^^^^^^^^^ interactive_terminal_test.hs:274:35: error: Variable not in scope: outputForConfig :: a5 -> IO Output | 274 | t <- standardIOConfig >>= outputForConfig | ^^^^^^^^^^^^^^^ interactive_terminal_test.hs:297:14: error: Variable not in scope: standardIOConfig :: IO a6 | 297 | t <- standardIOConfig >>= outputForConfig | ^^^^^^^^^^^^^^^^ interactive_terminal_test.hs:297:35: error: Variable not in scope: outputForConfig :: a6 -> IO Output | 297 | t <- standardIOConfig >>= outputForConfig | ^^^^^^^^^^^^^^^ interactive_terminal_test.hs:409:14: error: Variable not in scope: standardIOConfig :: IO a7 | 409 | t <- standardIOConfig >>= outputForConfig | ^^^^^^^^^^^^^^^^ interactive_terminal_test.hs:409:35: error: Variable not in scope: outputForConfig :: a7 -> IO Output | 409 | t <- standardIOConfig >>= outputForConfig | ^^^^^^^^^^^^^^^ interactive_terminal_test.hs:428:14: error: Variable not in scope: standardIOConfig :: IO a8 | 428 | t <- standardIOConfig >>= outputForConfig | ^^^^^^^^^^^^^^^^ interactive_terminal_test.hs:428:35: error: Variable not in scope: outputForConfig :: a8 -> IO Output | 428 | t <- standardIOConfig >>= outputForConfig | ^^^^^^^^^^^^^^^ interactive_terminal_test.hs:491:14: error: Variable not in scope: standardIOConfig :: IO a9 | 491 | t <- standardIOConfig >>= outputForConfig | ^^^^^^^^^^^^^^^^ interactive_terminal_test.hs:491:35: error: Variable not in scope: outputForConfig :: a9 -> IO Output | 491 | t <- standardIOConfig >>= outputForConfig | ^^^^^^^^^^^^^^^ interactive_terminal_test.hs:510:14: error: Variable not in scope: standardIOConfig :: IO a10 | 510 | t <- standardIOConfig >>= outputForConfig | ^^^^^^^^^^^^^^^^ interactive_terminal_test.hs:510:35: error: Variable not in scope: outputForConfig :: a10 -> IO Output | 510 | t <- standardIOConfig >>= outputForConfig | ^^^^^^^^^^^^^^^ interactive_terminal_test.hs:564:14: error: Variable not in scope: standardIOConfig :: IO a17 | 564 | t <- standardIOConfig >>= outputForConfig | ^^^^^^^^^^^^^^^^ interactive_terminal_test.hs:564:35: error: Variable not in scope: outputForConfig :: a17 -> IO Output | 564 | t <- standardIOConfig >>= outputForConfig | ^^^^^^^^^^^^^^^ interactive_terminal_test.hs:610:14: error: Variable not in scope: standardIOConfig :: IO a18 | 610 | t <- standardIOConfig >>= outputForConfig | ^^^^^^^^^^^^^^^^ interactive_terminal_test.hs:610:35: error: Variable not in scope: outputForConfig :: a18 -> IO Output | 610 | t <- standardIOConfig >>= outputForConfig | ^^^^^^^^^^^^^^^ interactive_terminal_test.hs:665:14: error: Variable not in scope: standardIOConfig :: IO a19 | 665 | t <- standardIOConfig >>= outputForConfig | ^^^^^^^^^^^^^^^^ interactive_terminal_test.hs:665:35: error: Variable not in scope: outputForConfig :: a19 -> IO Output | 665 | t <- standardIOConfig >>= outputForConfig | ^^^^^^^^^^^^^^^ interactive_terminal_test.hs:724:14: error: Variable not in scope: standardIOConfig :: IO a20 | 724 | t <- standardIOConfig >>= outputForConfig | ^^^^^^^^^^^^^^^^ interactive_terminal_test.hs:724:35: error: Variable not in scope: outputForConfig :: a20 -> IO Output | 724 | t <- standardIOConfig >>= outputForConfig | ^^^^^^^^^^^^^^^ interactive_terminal_test.hs:802:14: error: Variable not in scope: standardIOConfig :: IO a21 | 802 | t <- standardIOConfig >>= outputForConfig | ^^^^^^^^^^^^^^^^ interactive_terminal_test.hs:802:35: error: Variable not in scope: outputForConfig :: a21 -> IO Output | 802 | t <- standardIOConfig >>= outputForConfig | ^^^^^^^^^^^^^^^ interactive_terminal_test.hs:854:14: error: Variable not in scope: standardIOConfig :: IO a22 | 854 | t <- standardIOConfig >>= outputForConfig | ^^^^^^^^^^^^^^^^ interactive_terminal_test.hs:854:35: error: Variable not in scope: outputForConfig :: a22 -> IO Output | 854 | t <- standardIOConfig >>= outputForConfig | ^^^^^^^^^^^^^^^ interactive_terminal_test.hs:893:9: error: * Couldn't match expected type: IO a11 with actual type: InlineM () -> m0 () * Probable cause: `($)' is applied to too few arguments In a stmt of a 'do' block: putAttrChange_ $ backColor red >> applyStyle underline In the `testAction' field of a record In the expression: Test {testName = "Verify styled output can be performed without clearing the screen.", testID = "inlineTest0", testAction = do putStrLn "line 1." putAttrChange_ $ backColor red >> applyStyle underline putStrLn "line 2." ...., printSummary = putStr $ (Data.String.fromString "lines are in order. The second line "line 2" should have a red background and the text underline. The third line "line 3" should be drawn in the same style as the first line. "), confirmResults = genericOutputMatchConfirm} | 893 | putAttrChange_ $ backColor red >> applyStyle underline | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ interactive_terminal_test.hs:893:26: error: * Couldn't match expected type `Output' with actual type `transformers-0.5.6.2:Control.Monad.Trans.State.Strict.StateT InlineState Data.Functor.Identity.Identity ()' * In the second argument of `($)', namely `backColor red >> applyStyle underline' In a stmt of a 'do' block: putAttrChange_ $ backColor red >> applyStyle underline In the `testAction' field of a record | 893 | putAttrChange_ $ backColor red >> applyStyle underline | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ interactive_terminal_test.hs:895:9: error: * Couldn't match expected type: IO a12 with actual type: InlineM () -> m1 () * Probable cause: `($)' is applied to too few arguments In a stmt of a 'do' block: putAttrChange_ $ defaultAll In the `testAction' field of a record In the expression: Test {testName = "Verify styled output can be performed without clearing the screen.", testID = "inlineTest0", testAction = do putStrLn "line 1." putAttrChange_ $ backColor red >> applyStyle underline putStrLn "line 2." ...., printSummary = putStr $ (Data.String.fromString "lines are in order. The second line "line 2" should have a red background and the text underline. The third line "line 3" should be drawn in the same style as the first line. "), confirmResults = genericOutputMatchConfirm} | 895 | putAttrChange_ $ defaultAll | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ interactive_terminal_test.hs:895:26: error: * Couldn't match type `transformers-0.5.6.2:Control.Monad.Trans.State.Strict.StateT InlineState Data.Functor.Identity.Identity ()' with `Output' Expected: Output Actual: InlineM () * In the second argument of `($)', namely `defaultAll' In a stmt of a 'do' block: putAttrChange_ $ defaultAll In the `testAction' field of a record | 895 | putAttrChange_ $ defaultAll | ^^^^^^^^^^ interactive_terminal_test.hs:911:9: error: * Couldn't match expected type: IO a13 with actual type: InlineM () -> m2 () * Probable cause: `($)' is applied to too few arguments In a stmt of a 'do' block: putAttrChange_ $ backColor red >> applyStyle underline In the `testAction' field of a record In the expression: Test {testName = "Verify styled output can be performed without clearing the screen.", testID = "inlineTest1", testAction = do putStr "Not styled. " putAttrChange_ $ backColor red >> applyStyle underline putStr " Styled! " ...., printSummary = putStr $ (Data.String.fromString ""), confirmResults = genericOutputMatchConfirm} | 911 | putAttrChange_ $ backColor red >> applyStyle underline | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ interactive_terminal_test.hs:911:26: error: * Couldn't match expected type `Output' with actual type `transformers-0.5.6.2:Control.Monad.Trans.State.Strict.StateT InlineState Data.Functor.Identity.Identity ()' * In the second argument of `($)', namely `backColor red >> applyStyle underline' In a stmt of a 'do' block: putAttrChange_ $ backColor red >> applyStyle underline In the `testAction' field of a record | 911 | putAttrChange_ $ backColor red >> applyStyle underline | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ interactive_terminal_test.hs:913:9: error: * Couldn't match expected type: IO a14 with actual type: InlineM () -> m3 () * Probable cause: `($)' is applied to too few arguments In a stmt of a 'do' block: putAttrChange_ $ defaultAll In the `testAction' field of a record In the expression: Test {testName = "Verify styled output can be performed without clearing the screen.", testID = "inlineTest1", testAction = do putStr "Not styled. " putAttrChange_ $ backColor red >> applyStyle underline putStr " Styled! " ...., printSummary = putStr $ (Data.String.fromString ""), confirmResults = genericOutputMatchConfirm} | 913 | putAttrChange_ $ defaultAll | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ interactive_terminal_test.hs:913:26: error: * Couldn't match type `transformers-0.5.6.2:Control.Monad.Trans.State.Strict.StateT InlineState Data.Functor.Identity.Identity ()' with `Output' Expected: Output Actual: InlineM () * In the second argument of `($)', namely `defaultAll' In a stmt of a 'do' block: putAttrChange_ $ defaultAll In the `testAction' field of a record | 913 | putAttrChange_ $ defaultAll | ^^^^^^^^^^ interactive_terminal_test.hs:926:9: error: * Couldn't match expected type: IO a15 with actual type: InlineM () -> m4 () * Probable cause: `($)' is applied to too few arguments In a stmt of a 'do' block: putAttrChange_ $ backColor red >> applyStyle underline In the `testAction' field of a record In the expression: Test {testName = "Verify styled output can be performed without clearing the screen.", testID = "inlineTest1", testAction = do putStr "Not styled. " putAttrChange_ $ backColor red >> applyStyle underline putStr " Styled! " ...., printSummary = putStr $ (Data.String.fromString ""), confirmResults = genericOutputMatchConfirm} | 926 | putAttrChange_ $ backColor red >> applyStyle underline | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ interactive_terminal_test.hs:926:26: error: * Couldn't match expected type `Output' with actual type `transformers-0.5.6.2:Control.Monad.Trans.State.Strict.StateT InlineState Data.Functor.Identity.Identity ()' * In the second argument of `($)', namely `backColor red >> applyStyle underline' In a stmt of a 'do' block: putAttrChange_ $ backColor red >> applyStyle underline In the `testAction' field of a record | 926 | putAttrChange_ $ backColor red >> applyStyle underline | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ interactive_terminal_test.hs:928:9: error: * Couldn't match expected type: IO a16 with actual type: InlineM () -> m5 () * Probable cause: `($)' is applied to too few arguments In a stmt of a 'do' block: putAttrChange_ $ defaultAll In the `testAction' field of a record In the expression: Test {testName = "Verify styled output can be performed without clearing the screen.", testID = "inlineTest1", testAction = do putStr "Not styled. " putAttrChange_ $ backColor red >> applyStyle underline putStr " Styled! " ...., printSummary = putStr $ (Data.String.fromString ""), confirmResults = genericOutputMatchConfirm} | 928 | putAttrChange_ $ defaultAll | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ interactive_terminal_test.hs:928:26: error: * Couldn't match type `transformers-0.5.6.2:Control.Monad.Trans.State.Strict.StateT InlineState Data.Functor.Identity.Identity ()' with `Output' Expected: Output Actual: InlineM () * In the second argument of `($)', namely `defaultAll' In a stmt of a 'do' block: putAttrChange_ $ defaultAll In the `testAction' field of a record | 928 | putAttrChange_ $ defaultAll | ^^^^^^^^^^ interactive_terminal_test.hs:940:16: error: Variable not in scope: mkVty :: VtyUserConfig -> IO Vty | 940 | vty <- mkVty defaultConfig | ^^^^^ interactive_terminal_test.hs:965:10: error: Variable not in scope: standardIOConfig :: IO a25 | 965 | t <- standardIOConfig >>= outputForConfig | ^^^^^^^^^^^^^^^^ interactive_terminal_test.hs:965:31: error: Variable not in scope: outputForConfig :: a25 -> IO Output | 965 | t <- standardIOConfig >>= outputForConfig | ^^^^^^^^^^^^^^^ interactive_terminal_test.hs:1148:10: error: Variable not in scope: standardIOConfig :: IO a24 | 1148 | t <- standardIOConfig >>= outputForConfig | ^^^^^^^^^^^^^^^^ interactive_terminal_test.hs:1148:31: error: Variable not in scope: outputForConfig :: a24 -> IO Output | 1148 | t <- standardIOConfig >>= outputForConfig | ^^^^^^^^^^^^^^^ ```
RyanGlScott commented 10 months ago

Similarly, vty-benchmark fails to build with GHC 9.2:

$ cabal run vty-benchmark -w ghc-9.2
Build profile: -w ghc-9.2.8 -O1
In order, the following will be built (use -v for more details):
 - vty-examples-5.37 (exe:vty-benchmark) (first run)
Preprocessing executable 'vty-benchmark' for vty-examples-5.37..
Building executable 'vty-benchmark' for vty-examples-5.37..
[1 of 5] Compiling BenchImageFuzz   ( BenchImageFuzz.hs, /home/ryanscott/Documents/Hacking/Haskell/vty/dist-newstyle/build/x86_64-linux/ghc-9.2.8/vty-examples-5.37/x/vty-benchmark/build/vty-benchmark/vty-benchmark-tmp/BenchImageFuzz.o, /home/ryanscott/Documents/Hacking/Haskell/vty/dist-newstyle/build/x86_64-linux/ghc-9.2.8/vty-examples-5.37/x/vty-benchmark/build/vty-benchmark/vty-benchmark-tmp/BenchImageFuzz.dyn_o )

BenchImageFuzz.hs:22:12: error:
    Variable not in scope: mkVty :: VtyUserConfig -> IO Vty
   |
22 |     vty <- mkVty defaultConfig
   |            ^^^^^
jtdaugherty commented 10 months ago

vty-interactive-terminal-test was actually moved to vty-crossplatform and I just forgot to remove it from vty. I definitely haven't maintained the benchmark program, but either way, it needs to be moved elsewhere to a package that provides mkVty. I'm inclined to just remove it, but I'll keep this open as a reminder to take a look.

jmtd commented 7 months ago

I'm just exploring Vty for the first time and the broken examples/ have caused a fair amount of confusion! I'd definitely encourage you to remove them if there's no prospect of them being fixed in the near future. Thye could always be re-introduced later on.

jtdaugherty commented 7 months ago

I went ahead and removed examples and updated the package description to point to the ones in vty-crossplatform. Sorry for the confusion!