From edcb8eb4f0b4bf19fd9a7f6748dde44ea728c721 Mon Sep 17 00:00:00 2001 From: Eric Mertens Date: Wed, 22 May 2024 14:16:46 -0700 Subject: [PATCH] Update for new GHC and vty --- app/BigFont.hs | 2 +- app/Main.hs | 1 + app/Model.hs | 2 +- app/Parser.hs | 4 ++-- parabox.cabal | 9 ++++++++- 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/app/BigFont.hs b/app/BigFont.hs index 44a6326..25848d5 100644 --- a/app/BigFont.hs +++ b/app/BigFont.hs @@ -6,7 +6,7 @@ import Data.Maybe import Data.List (intersperse, transpose) bigText :: String -> [String] -bigText = map concat . transpose . intersperse sep . mapMaybe \x -> Map.lookup x letters +bigText = map concat . transpose . intersperse sep . mapMaybe (`Map.lookup` letters) sep :: [String] sep = [" " ," " ," " ," " ," "] diff --git a/app/Main.hs b/app/Main.hs index 01dcab2..82c4f44 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -8,6 +8,7 @@ import Data.List.NonEmpty qualified as NonEmpty import Data.Map (Map) import Data.Map qualified as Map import Graphics.Vty +import Graphics.Vty.CrossPlatform import Data.Ord (clamp) import System.Directory (listDirectory) import System.Environment (getArgs) diff --git a/app/Model.hs b/app/Model.hs index 305b217..32d3b9f 100644 --- a/app/Model.hs +++ b/app/Model.hs @@ -172,7 +172,7 @@ enterLoc world name box dir@(dy,dx) offset = go y x = Just (Location name' y x, fromIntegral faceSize * offset - - fromIntegral ((abs dy *x + abs dx*y))) + - fromIntegral (abs dy *x + abs dx*y)) ((ylo,xlo),(yhi,xhi)) = bounds (boxWalls world box) diff --git a/app/Parser.hs b/app/Parser.hs index 8b57754..483ecff 100644 --- a/app/Parser.hs +++ b/app/Parser.hs @@ -126,7 +126,7 @@ parseColor = walls :: [String] -> UArray Coord Bool walls rows = listArray ((ylo,xlo),(yhi,xhi)) (map ('▓'==) (concat rows)) where - width = length (head rows) + width = case rows of x:_ -> length x; [] -> 0 height = length rows ylo = - ((height - 1) `div` 2) yhi = height `div` 2 @@ -134,7 +134,7 @@ walls rows = listArray ((ylo,xlo),(yhi,xhi)) (map ('▓'==) (concat rows)) xhi = width `div` 2 mkRange :: Int -> (Int, Int) -mkRange n = (-(n-1)`div`2, n`div`2) +mkRange n = (-((n-1)`div`2), n`div`2) findLocs :: Char -> [[Char]] -> [(Char, Location)] findLocs name xs = diff --git a/parabox.cabal b/parabox.cabal index 5084f74..4e9aa13 100644 --- a/parabox.cabal +++ b/parabox.cabal @@ -24,6 +24,13 @@ executable parabox default-extensions: ImportQualifiedPost, BlockArguments, LambdaCase ghc-options: -threaded - build-depends: base ^>=4.17.0.0, array, containers, vty, directory, filepath + build-depends: + array, + base ^>={4.17, 4.18, 4.19, 4.20}, + containers, + directory, + filepath, + vty-crossplatform, + vty ^>= 6.2, hs-source-dirs: app default-language: Haskell2010