From c05876cc605b26c8e8b13b9f4bdf06ec388e1e09 Mon Sep 17 00:00:00 2001
From: Julian Ospald <hasufell@posteo.de>
Date: Tue, 2 Nov 2021 19:53:22 +0100
Subject: [PATCH] Fix build with ghc-8.6.5

---
 app/ghcup/BrickMain.hs        | 3 +++
 ghcup.cabal                   | 6 +++---
 lib/GHCup/Platform.hs         | 4 ++++
 lib/GHCup/Utils/Version/QQ.hs | 3 +++
 4 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/app/ghcup/BrickMain.hs b/app/ghcup/BrickMain.hs
index 60ad3576..c6e870c4 100644
--- a/app/ghcup/BrickMain.hs
+++ b/app/ghcup/BrickMain.hs
@@ -27,6 +27,9 @@ import           Brick.Widgets.List             ( listSelectedFocusedAttr
                                                 )
 import           Codec.Archive
 import           Control.Exception.Safe
+#if !MIN_VERSION_base(4,13,0)
+import           Control.Monad.Fail             ( MonadFail )
+#endif
 import           Control.Monad.Reader
 import           Control.Monad.Trans.Except
 import           Control.Monad.Trans.Resource
diff --git a/ghcup.cabal b/ghcup.cabal
index 735b9f19..09d17784 100644
--- a/ghcup.cabal
+++ b/ghcup.cabal
@@ -96,7 +96,7 @@ library
   build-depends:
     , aeson                 >=1.4
     , async                 >=0.8        && <2.3
-    , base                  >=4.13       && <5
+    , base                  >=4.12       && <5
     , base16-bytestring     >=0.1.1.6    && <1.1
     , binary                ^>=0.8.6.0
     , bytestring            ^>=0.10
@@ -219,7 +219,7 @@ executable ghcup
     , aeson                 >=1.4
     , aeson-pretty          ^>=0.8.8
     , async                 ^>=2.2.3
-    , base                  >=4.13     && <5
+    , base                  >=4.12     && <5
     , bytestring            ^>=0.10
     , cabal-plan            ^>=0.7.2
     , containers            ^>=0.6
@@ -287,7 +287,7 @@ test-suite ghcup-test
     -fwarn-incomplete-record-updates
 
   build-depends:
-    , base                      >=4.13    && <5
+    , base                      >=4.12    && <5
     , bytestring                ^>=0.10
     , containers                ^>=0.6
     , generic-arbitrary         ^>=0.1.0
diff --git a/lib/GHCup/Platform.hs b/lib/GHCup/Platform.hs
index 99092bd9..146f0a18 100644
--- a/lib/GHCup/Platform.hs
+++ b/lib/GHCup/Platform.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP                   #-}
 {-# LANGUAGE DataKinds             #-}
 {-# LANGUAGE FlexibleContexts      #-}
 {-# LANGUAGE FlexibleInstances     #-}
@@ -27,6 +28,9 @@ import           GHCup.Utils.Logger
 import           GHCup.Utils.Prelude
 import           GHCup.Utils.String.QQ
 
+#if !MIN_VERSION_base(4,13,0)
+import           Control.Monad.Fail             ( MonadFail )
+#endif
 import           Control.Applicative
 import           Control.Exception.Safe
 import           Control.Monad
diff --git a/lib/GHCup/Utils/Version/QQ.hs b/lib/GHCup/Utils/Version/QQ.hs
index e16d9a8c..ddd6917f 100644
--- a/lib/GHCup/Utils/Version/QQ.hs
+++ b/lib/GHCup/Utils/Version/QQ.hs
@@ -53,6 +53,9 @@ deriving instance Data VUnit
 
 #if !MIN_VERSION_base(4,13,0)
 deriving instance Lift (NonEmpty Word)
+deriving instance Lift (NonEmpty VChunk)
+deriving instance Lift (NonEmpty MChunk)
+deriving instance Lift (NonEmpty VUnit)
 #endif
 
 qq :: (Text -> Q Exp) -> QuasiQuoter
-- 
GitLab