diff --git a/README.md b/README.md
--- a/README.md
+++ b/README.md
@@ -75,7 +75,7 @@
 - .
 
 extra-deps:
-- nvim-hs-0.2.0
+- nvim-hs-0.2.2
 ```
 
 Now, you have to compile everything.
@@ -132,7 +132,7 @@
 
 ```yaml
 extra-deps:
-- nvim-hs-0.2.0
+- nvim-hs-0.2.2
 - nvim-hs-contrib-0.2.0
 - nvim-hs-ghcid-0.2.0
 ```
@@ -206,7 +206,7 @@
 
 ```yaml
 extra-deps:
-- nvim-hs-0.2.0
+- nvim-hs-0.2.2
 - nvim-hs-contrib-0.2.0
 ```
 
diff --git a/library/Neovim/API/TH.hs b/library/Neovim/API/TH.hs
--- a/library/Neovim/API/TH.hs
+++ b/library/Neovim/API/TH.hs
@@ -64,9 +64,12 @@
 dataD' :: CxtQ -> Name -> [TyVarBndr] -> [ConQ] -> [Name] -> DecQ
 #if __GLASGOW_HASKELL__ < 800
 dataD' = dataD
-#else
+#elif __GLASGOW_HASKELL__ < 802
 dataD' cxtQ n tyvarbndrs conq ns =
     dataD cxtQ n tyvarbndrs Nothing conq (mapM conT ns)
+#else
+dataD' cxtQ n tyvarbndrs conq ns =
+    dataD cxtQ n tyvarbndrs Nothing conq ((return . return . DerivClause Nothing . map ConT) ns)
 #endif
 
 -- | Generate the API types and functions provided by @nvim --api-info@.
diff --git a/nvim-hs.cabal b/nvim-hs.cabal
--- a/nvim-hs.cabal
+++ b/nvim-hs.cabal
@@ -1,5 +1,5 @@
 name:                nvim-hs
-version:             0.2.2
+version:             0.2.3
 synopsis:            Haskell plugin backend for neovim
 description:
   This package provides a plugin provider for neovim. It allows you to write
@@ -115,7 +115,7 @@
                       , mtl >= 2.2.1 && < 2.3
                       , optparse-applicative
                       , time-locale-compat
-                      , megaparsec
+                      , megaparsec < 6
                       , process
                       , resourcet
                       , setenv >= 0.1.1.3
diff --git a/test-suite/Neovim/API/THSpec.hs b/test-suite/Neovim/API/THSpec.hs
--- a/test-suite/Neovim/API/THSpec.hs
+++ b/test-suite/Neovim/API/THSpec.hs
@@ -5,7 +5,8 @@
 
 import           Neovim.API.THSpecFunctions
 
-import           Neovim.API.TH
+import           Neovim.API.TH              hiding (function)
+import qualified Neovim.API.TH              as TH
 import           Neovim.Context
 import qualified Neovim.Context.Internal    as Internal
 import           Neovim.Plugin.Classes
@@ -36,7 +37,7 @@
 spec :: Spec
 spec = do
   describe "calling function without an argument" $ do
-    let EF (Function fname _, testFun) = $(function  "TestFunction0" 'testFunction0) Sync
+    let EF (Function fname _, testFun) = $(TH.function  "TestFunction0" 'testFunction0) Sync
     it "should have a capitalized prefix" $
         fname `shouldBe` (F "TestFunction0")
 
@@ -85,7 +86,7 @@
           \x -> call testFun [ObjectInt x] `shouldReturn` ObjectInt (x+1)
 
   describe "calling test function with a map argument" $ do
-      let EF (Function fname _, testFun) = $(function "TestFunctionMap" 'testFunctionMap) Sync
+      let EF (Function fname _, testFun) = $(TH.function "TestFunctionMap" 'testFunctionMap) Sync
       it "should capitalize the first letter" $
           fname `shouldBe` (F "TestFunctionMap")
 
diff --git a/test-suite/Neovim/Plugin/ConfigHelperSpec.hs b/test-suite/Neovim/Plugin/ConfigHelperSpec.hs
--- a/test-suite/Neovim/Plugin/ConfigHelperSpec.hs
+++ b/test-suite/Neovim/Plugin/ConfigHelperSpec.hs
@@ -9,6 +9,9 @@
 
 import           Text.Megaparsec
 
+import qualified Data.ByteString as BS
+import qualified Data.ByteString.UTF8 as BS
+
 isLeft :: Either a b -> Bool
 isLeft (Left _) = True
 isLeft _        = False
@@ -16,11 +19,15 @@
 isRight :: Either a b -> Bool
 isRight = not . isLeft
 
+
+readFileUTF8 :: FilePath -> IO String
+readFileUTF8 = fmap BS.toString . BS.readFile
+
 spec :: Spec
 spec = do
   describe "parseQuickFfixItems" $ do
     it "should match this test file 1" $ do
-      e <- readFile "./test-files/compile-error-for-quickfix-test1"
+      e <- readFileUTF8 "./test-files/compile-error-for-quickfix-test1"
       let [qs] = parseQuickfixItems e
       bufOrFile qs `shouldBe` Right "/.config/nvim/nvim.hs"
       lnumOrPattern qs `shouldBe` Left 25
@@ -29,7 +36,7 @@
       errorType qs `shouldBe` Error
 
     it "should match this test file 2" $ do
-      e <- readFile "./test-files/compile-error-for-quickfix-test2"
+      e <- readFileUTF8 "./test-files/compile-error-for-quickfix-test2"
       let [qs] = parseQuickfixItems e
       bufOrFile qs `shouldBe` Right "/.config/nvim/lib/TestPlugins.hs"
       lnumOrPattern qs `shouldBe` Left 11
@@ -38,7 +45,7 @@
       errorType qs `shouldBe` Error
 
     it "should match this test file 3" $ do
-      e <- readFile "./test-files/compile-error-for-quickfix-test3"
+      e <- readFileUTF8 "./test-files/compile-error-for-quickfix-test3"
       let [qs] = parseQuickfixItems e
       bufOrFile qs `shouldBe` Right "/.config/nvim/nvim.hs"
       lnumOrPattern qs `shouldBe` Left 25
@@ -47,7 +54,7 @@
       errorType qs `shouldBe` Error
 
     it "should match this test file 4" $ do
-      e <- readFile "./test-files/compile-error-for-quickfix-test4"
+      e <- readFileUTF8 "./test-files/compile-error-for-quickfix-test4"
       let [qs] = parseQuickfixItems e
       bufOrFile qs `shouldBe` Right "/.config/nvim/lib/TestPlugins.hs"
       lnumOrPattern qs `shouldBe` Left 23
@@ -56,7 +63,7 @@
       errorType qs `shouldBe` Error
 
     it "should match this test file 5" $ do
-      e <- readFile "./test-files/compile-error-for-quickfix-test5"
+      e <- readFileUTF8 "./test-files/compile-error-for-quickfix-test5"
       let [q1,q2] = parseQuickfixItems e
       bufOrFile q1 `shouldBe` Right "/.config/nvim/lib/TestPlugins.hs"
       bufOrFile q2 `shouldBe` Right "/.config/nvim/lib/TestPlugins.hs"
@@ -70,7 +77,7 @@
       errorType q2 `shouldBe` Warning
 
     it "should match this test file 6" $ do
-      e <- readFile "./test-files/compile-error-for-quickfix-test6"
+      e <- readFileUTF8 "./test-files/compile-error-for-quickfix-test6"
       let [q1] = parseQuickfixItems e
       bufOrFile q1 `shouldBe` Right "/home/test/.config/nvim/nvim.hs"
       lnumOrPattern q1 `shouldBe` Left 8
@@ -79,9 +86,9 @@
       errorType q1 `shouldBe` Error
 
     it "should parse all files concatenated" $ do
-      e1 <- readFile "./test-files/compile-error-for-quickfix-test1"
-      e2 <- readFile "./test-files/compile-error-for-quickfix-test2"
-      e3 <- readFile "./test-files/compile-error-for-quickfix-test3"
+      e1 <- readFileUTF8 "./test-files/compile-error-for-quickfix-test1"
+      e2 <- readFileUTF8 "./test-files/compile-error-for-quickfix-test2"
+      e3 <- readFileUTF8 "./test-files/compile-error-for-quickfix-test3"
       let qs = parseQuickfixItems $ unlines [e1,e2,e3]
       length qs `shouldBe` 3
       case qs of
