diff --git a/ghcitui.cabal b/ghcitui.cabal index feb1de5..e22afe2 100644 --- a/ghcitui.cabal +++ b/ghcitui.cabal @@ -21,9 +21,9 @@ description: bug-reports: https://github.com/CrystalSplitter/ghcitui license: BSD-3-Clause license-file: LICENSE -author: Jordan 'CrystalSplitter' R AW +author: Jordan 'Crystal' R AW maintainer: crystal@crystalwobsite.gay -copyright: Jordan R AW +copyright: Jordan 'Crystal' R AW category: Debug extra-source-files: LICENSE , assets/splash.txt @@ -39,11 +39,11 @@ source-repository head executable ghcitui main-is: Main.hs - build-depends: base + build-depends: base >= 4.16 && < 5 , ghcitui-brick - , optparse-applicative ^>= 0.18.1.0 + , optparse-applicative >= 0.17 && < 0.19 , ghcitui - , text + , text >= 2.0 && < 2.2 hs-source-dirs: app other-modules: Paths_ghcitui autogen-modules: Paths_ghcitui @@ -61,17 +61,20 @@ executable ghcitui library hs-source-dirs: lib/ghcitui-core - build-depends: base >= 4.17 && < 5 - , array ^>= 0.5.4.0 - , containers >= 0.6.7 && < 0.8 - , errors ^>= 2.3.0 - , ghcid ^>= 0.8.8 + build-depends: base >= 4.16 && < 5 + , array ^>= 0.5 + , containers >= 0.6.8 && < 0.8 + , errors >= 2.2 && < 2.4 + -- Needed to limit ghcid compat. + , extra >= 1.7.14 && < 1.8 + , ghcid >= 0.8.8 && < 0.9 , regex-base ^>= 0.94.0.2 - , regex-tdfa ^>= 1.3.2.1 - , safe ^>= 0.3.19 + , regex-tdfa >= 1.3.2 && < 1.4 , string-interpolate ^>= 0.3.2.1 - , text ^>= 2.0.2 + , text >= 2.0 && < 2.2 , transformers ^>= 0.6.1.0 + -- Needed to limit string-interpolate compat. + , utf8-string >= 1.0.2 && < 1.1 exposed-modules: Ghcitui.Ghcid.Daemon , Ghcitui.Ghcid.LogConfig , Ghcitui.Ghcid.ParseContext @@ -88,25 +91,23 @@ library default-extensions: DuplicateRecordFields MonoLocalBinds NamedFieldPuns - OverloadedRecordDot OverloadedStrings RecordWildCards TupleSections library ghcitui-brick hs-source-dirs: lib/ghcitui-brick - build-depends: base >= 4.17 && < 5 + build-depends: base >= 4.15 && < 5 , brick >= 2.2 && < 2.4 - , containers >= 0.6.7 && < 0.8 - , errors ^>= 2.3.0 + , containers >= 0.6.8 && < 0.8 + , errors >= 2.0 && < 2.4 , file-embed ^>= 0.0.15 , ghcitui - , microlens ^>= 0.4.13.1 - , microlens-th ^>= 0.4.3.14 - , safe ^>= 0.3.19 - , text ^>= 2.0.2 + , microlens >= 0.4.0.1 && < 0.5 + , microlens-th ^>= 0.4 + , text >= 2.0 && < 2.2 , text-zipper ^>= 0.13 - , vector ^>= 0.13.1.0 + , vector >= 0.10 && < 0.14 , vty >= 5.38 && < 6.1 , word-wrap ^>= 0.5 exposed-modules: Ghcitui.Brick @@ -130,7 +131,6 @@ library ghcitui-brick LambdaCase MonoLocalBinds NamedFieldPuns - OverloadedRecordDot OverloadedStrings RecordWildCards TupleSections @@ -140,7 +140,7 @@ test-suite spec hs-source-dirs: test main-is: Spec.hs type: exitcode-stdio-1.0 - build-depends: base >= 4.17 && < 5 + build-depends: base >= 4.16 && < 5 , ghcitui , hspec ^>= 2.11.5 other-modules: LocSpec diff --git a/lib/ghcitui-brick/Ghcitui/Brick/AppInterpState.hs b/lib/ghcitui-brick/Ghcitui/Brick/AppInterpState.hs index 245f91e..5f6e58b 100644 --- a/lib/ghcitui-brick/Ghcitui/Brick/AppInterpState.hs +++ b/lib/ghcitui-brick/Ghcitui/Brick/AppInterpState.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE OverloadedRecordDot #-} {-# LANGUAGE RecordWildCards #-} module Ghcitui.Brick.AppInterpState diff --git a/lib/ghcitui-brick/Ghcitui/Brick/AppState.hs b/lib/ghcitui-brick/Ghcitui/Brick/AppState.hs index 0d3f9ad..c128103 100644 --- a/lib/ghcitui-brick/Ghcitui/Brick/AppState.hs +++ b/lib/ghcitui-brick/Ghcitui/Brick/AppState.hs @@ -1,4 +1,5 @@ {-# LANGUAGE NamedFieldPuns #-} +{-# LANGUAGE OverloadedRecordDot #-} module Ghcitui.Brick.AppState ( ActiveWindow (..) diff --git a/lib/ghcitui-brick/Ghcitui/Brick/BrickUI.hs b/lib/ghcitui-brick/Ghcitui/Brick/BrickUI.hs index ed609cc..18be3ad 100644 --- a/lib/ghcitui-brick/Ghcitui/Brick/BrickUI.hs +++ b/lib/ghcitui-brick/Ghcitui/Brick/BrickUI.hs @@ -1,5 +1,7 @@ +{-# LANGUAGE OverloadedRecordDot #-} {-# LANGUAGE OverloadedStrings #-} + module Ghcitui.Brick.BrickUI ( launchBrick , AppState (..) @@ -133,7 +135,7 @@ drawBaseLayer s = lastCmdWidget = B.padRight B.Max - ( case headMay s.interpState.execHist of + ( case headMay (Daemon.execHist (AppState.interpState s)) of Just h -> B.txt h _ -> B.txt " " ) @@ -158,7 +160,7 @@ drawBaseLayer s = $ s.interpLogs promptLine :: B.Widget AppName promptLine = - B.txt s.appConfig.getInterpreterPrompt + B.txt (AppConfig.getInterpreterPrompt . AppState.appConfig $ s) <+> BE.renderEditor displayF enableCursor (s ^. liveEditor) where displayF :: [T.Text] -> B.Widget AppName diff --git a/lib/ghcitui-brick/Ghcitui/Brick/DrawSourceViewer.hs b/lib/ghcitui-brick/Ghcitui/Brick/DrawSourceViewer.hs index 3c9cbee..7fc7012 100644 --- a/lib/ghcitui-brick/Ghcitui/Brick/DrawSourceViewer.hs +++ b/lib/ghcitui-brick/Ghcitui/Brick/DrawSourceViewer.hs @@ -39,7 +39,7 @@ drawSourceViewer s B.padTop (B.Pad 3) . B.hCenter $ B.withAttr (B.attrName "styled") w - splashWidget = maybe (B.txt "No splash file loaded.") B.txt s.splashContents + splashWidget = B.txt $ fromMaybe "No splash file loaded." (AppState.splashContents s) -- ------------------------------------------------------------------------------------------------- -- Source Viewer Drawing Details @@ -143,7 +143,7 @@ drawSourceViewer' s sourceWindow = composedTogether gutterInfoForLine lineno = GutterInfo { isStoppedHere = - s.interpState.pauseLoc + Daemon.pauseLoc (AppState.interpState s) <&> Loc.sourceRange <&> (`Loc.isLineInside` lineno) & fromMaybe False @@ -162,7 +162,7 @@ drawSourceViewer' s sourceWindow = composedTogether originalLookupLineNo :: Int originalLookupLineNo = - s.interpState.pauseLoc + Daemon.pauseLoc (AppState.interpState s) >>= Loc.startLine . Loc.sourceRange & fromMaybe 0 diff --git a/lib/ghcitui-brick/Ghcitui/Brick/Events.hs b/lib/ghcitui-brick/Ghcitui/Brick/Events.hs index 3251316..421bb2a 100644 --- a/lib/ghcitui-brick/Ghcitui/Brick/Events.hs +++ b/lib/ghcitui-brick/Ghcitui/Brick/Events.hs @@ -1,5 +1,6 @@ {-# LANGUAGE BlockArguments #-} {-# LANGUAGE NamedFieldPuns #-} +{-# LANGUAGE OverloadedRecordDot #-} module Ghcitui.Brick.Events (handleEvent, handleCursorPosition) where diff --git a/lib/ghcitui-core/Ghcitui/Ghcid/Daemon.hs b/lib/ghcitui-core/Ghcitui/Ghcid/Daemon.hs index f0b194c..c905bb0 100644 --- a/lib/ghcitui-core/Ghcitui/Ghcid/Daemon.hs +++ b/lib/ghcitui-core/Ghcitui/Ghcid/Daemon.hs @@ -1,5 +1,6 @@ {-# LANGUAGE LambdaCase #-} {-# LANGUAGE NamedFieldPuns #-} +{-# LANGUAGE OverloadedRecordDot #-} {-# LANGUAGE QuasiQuotes #-} module Ghcitui.Ghcid.Daemon diff --git a/lib/ghcitui-core/Ghcitui/Ghcid/ParseContext.hs b/lib/ghcitui-core/Ghcitui/Ghcid/ParseContext.hs index 2177f33..6dddc25 100644 --- a/lib/ghcitui-core/Ghcitui/Ghcid/ParseContext.hs +++ b/lib/ghcitui-core/Ghcitui/Ghcid/ParseContext.hs @@ -1,4 +1,5 @@ {-# LANGUAGE NamedFieldPuns #-} +{-# LANGUAGE OverloadedRecordDot #-} {-# LANGUAGE QuasiQuotes #-} module Ghcitui.Ghcid.ParseContext @@ -23,7 +24,6 @@ import Control.Error import Data.Array ((!)) import Data.String.Interpolate (i) import qualified Data.Text as T -import Safe (readNote) import Text.Regex.TDFA (MatchResult (..), (=~~)) import qualified Text.Regex.TDFA as Regex @@ -182,7 +182,7 @@ parseShowBreaks t parseEach mr = let -- Don't need to use readMay because regex. - idx = readNote "Failed to read index" $ T.unpack $ mr.mrSubs ! 1 + eIdx = readErr "Failed to read index" $ T.unpack $ mr.mrSubs ! 1 module_ = mr.mrSubs ! 2 _filepath = Just $ mr.mrSubs ! 3 -- Not used currently but could be useful? sourceRange = parseSourceRange $ mr.mrSubs ! 4 @@ -191,12 +191,13 @@ parseShowBreaks t "disabled" -> Right False x -> Left ("Breakpoint neither enabled nor disabled: " <> x) in - case sourceRange of - _ + case (sourceRange, eIdx) of + (_, Right idx) | sourceRange == Loc.unknownSourceRange -> Left ("Could not parse source range for breakpoint " <> showT idx) | otherwise -> enabled >> Right (idx, Loc.ModuleLoc module_ sourceRange) + (_, Left e) -> Left e -- | Parse the output of ":show modules". parseShowModules :: T.Text -> Either ParseError [(T.Text, FilePath)] diff --git a/lib/ghcitui-core/Ghcitui/Loc.hs b/lib/ghcitui-core/Ghcitui/Loc.hs index 08fd334..e88adb1 100644 --- a/lib/ghcitui-core/Ghcitui/Loc.hs +++ b/lib/ghcitui-core/Ghcitui/Loc.hs @@ -1,3 +1,5 @@ +{-# LANGUAGE OverloadedRecordDot #-} + module Ghcitui.Loc ( -- * Code locations within a file @@ -28,7 +30,7 @@ module Ghcitui.Loc import Data.Map.Strict as Map import Data.Maybe (isNothing) import qualified Data.Text as T -import Safe (headMay) +import Control.Error (headMay) -- ------------------------------------------------------------------------------------------------