Update for new GHC and vty

This commit is contained in:
Eric Mertens 2024-05-22 14:16:46 -07:00
parent e83bb7de4c
commit edcb8eb4f0
5 changed files with 13 additions and 5 deletions

View File

@ -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 = [" " ," " ," " ," " ," "]

View File

@ -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)

View File

@ -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)

View File

@ -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 =

View File

@ -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