diff --git a/hasktorch-codegen.cabal b/hasktorch-codegen.cabal
--- a/hasktorch-codegen.cabal
+++ b/hasktorch-codegen.cabal
@@ -9,7 +9,7 @@
 -- 'dhall-to-cabal -- ffi/codegen/hasktorch-codegen.dhall > hasktorch-codegen.cabal'.
 -- * * * * * * * * * * * * WARNING * * * * * * * * * * * *
 name: hasktorch-codegen
-version: 0.0.1.0
+version: 0.0.1.1
 license: BSD-3-Clause
 maintainer: Sam Stites <fnz@fgvgrf.vb>, Austin Huang <nhfgvau@nyhz.zvg.rqh> - cipher:ROT13
 author: Hasktorch dev team
@@ -51,7 +51,7 @@
         containers ==0.5.10 || >0.5.10,
         directory ==1.3.0 || >1.3.0,
         hashable ==1.2.7 || >1.2.7,
-        megaparsec ==6.5.0 || >6.5.0,
+        megaparsec (==6.0.0 || >6.0.0) && <8.0.0,
         pretty-show ==1.7 || >1.7,
         text ==1.2.2 || >1.2.2,
         unordered-containers ==0.2.9 || >0.2.9
@@ -88,7 +88,7 @@
         hasktorch-codegen -any,
         hspec ==2.4.4 || >2.4.4,
         hspec-discover ==2.5.0 || >2.5.0,
-        megaparsec ==6.5.0 || >6.5.0,
+        megaparsec (==6.0.0 || >6.0.0) && <8.0.0,
         pretty-show ==1.7 || >1.7,
         text ==1.2.2 || >1.2.2
 
diff --git a/src/CodeGen/Parse.hs b/src/CodeGen/Parse.hs
--- a/src/CodeGen/Parse.hs
+++ b/src/CodeGen/Parse.hs
@@ -119,12 +119,12 @@
   endsInComma :: Parser ()
   endsInComma
     =   try (void (char ',' >> space >> eol))
-    <|> try (void (char ',' >> space >> string "//" >> some (notChar '\n') >> eol))
+    <|> try (void (char ',' >> space >> string "//" >> some (anySingleBut '\n') >> eol))
     <|> void (char ',')
 
   endsInParen :: Parser ()
   endsInParen
-    =   try (space >> string "//" >> some (notChar '\n') >> eol >> space >> lookAhead (void $ char ')'))
+    =   try (space >> string "//" >> some (anySingleBut '\n') >> eol >> space >> lookAhead (void $ char ')'))
     <|> lookAhead (void $ char ')')
 
 functionArgs :: Parser [Arg]
@@ -168,7 +168,7 @@
   space
   string "//"
   some (alphaNumChar <|> char '_' <|> char ' ')
-  void $ eol <|> (some (notChar '\n') >> eol)
+  void $ eol <|> (some (anySingleBut '\n') >> eol)
 
 -- | skip over a _single-line_ of block comment -- something which seems standard in the libTH.
 comment :: Parser ()
@@ -191,7 +191,7 @@
 skip :: Parser (Maybe Function)
 skip = do
   (not <$> atEnd) >>= guard
-  void $ many (notChar '\n') <* (void eol <|> eof)
+  void $ many (anySingleBut '\n') <* (void eol <|> eof)
   pure Nothing
 
 
diff --git a/src/CodeGen/Prelude.hs b/src/CodeGen/Prelude.hs
--- a/src/CodeGen/Prelude.hs
+++ b/src/CodeGen/Prelude.hs
@@ -1,8 +1,10 @@
+{-# LANGUAGE CPP #-}
 module CodeGen.Prelude
   ( module X
   , impossible
   , tshow
   , tputStrLn
+  , anySingleBut
   ) where
 
 import Prelude         as X
@@ -28,6 +30,10 @@
 
 import qualified Data.Text as T
 
+import Text.Megaparsec (Token, MonadParsec)
+import qualified Text.Megaparsec      as Compat.Megaparsec
+import qualified Text.Megaparsec.Char as Compat.Megaparsec
+
 impossible :: Show msg => msg -> a
 impossible x = error (show x)
 
@@ -36,3 +42,11 @@
 
 tputStrLn :: Text -> IO ()
 tputStrLn = putStrLn . T.unpack
+
+#if MIN_VERSION_megaparsec(7,0,0)
+anySingleBut ::  MonadParsec e s m => Token s -> m (Token s)
+anySingleBut = Compat.Megaparsec.anySingleBut
+#else
+anySingleBut ::  MonadParsec e s m => Token s -> m (Token s)
+anySingleBut = Compat.Megaparsec.notChar
+#endif
diff --git a/src/CodeGen/Render.hs b/src/CodeGen/Render.hs
--- a/src/CodeGen/Render.hs
+++ b/src/CodeGen/Render.hs
@@ -1,10 +1,10 @@
 {-# LANGUAGE NamedFieldPuns #-}
+{-# LANGUAGE CPP #-}
 module CodeGen.Render
   ( makeModule
   , writeHaskellModule
 
   , parseFile
-  , cleanList
 
   , renderFunctions
   ) where
@@ -23,6 +23,9 @@
 import CodeGen.Parse.Cases (checkFunction, type2hsreal)
 import qualified CodeGen.Parse as CG (parser)
 
+#if MIN_VERSION_megaparsec(7,0,0)
+import Text.Megaparsec.Error (ParseErrorBundle)
+#endif
 
 -- ----------------------------------------
 -- helper data and functions for templating
@@ -151,19 +154,26 @@
 -- Execution
 -- ----------------------------------------
 
--- | Remove if list was returned, extract non-Nothing values, o/w empty list
-cleanList :: Either (ParseError Char Void) [Maybe Function] -> [Function]
-cleanList = either (const []) catMaybes
-
 parseFile :: LibType -> CodeGenType -> String -> IO [Function]
 parseFile _ _ file = do
   putStrLn $ "\nParsing " ++ file ++ " ... "
   res <- parseFromFile CG.parser file
   pure $ cleanList res
  where
+  -- | Remove if list was returned, extract non-Nothing values, o/w empty list
+  cleanList :: Either s [Maybe Function] -> [Function]
+  cleanList = either (const []) catMaybes
+
+#if MIN_VERSION_megaparsec(7,0,0)
   parseFromFile
     :: Parser [Maybe Function]
     -> String
+    -> IO (Either (ParseErrorBundle String Void) [Maybe Function])
+#else
+  parseFromFile
+    :: Parser [Maybe Function]
+    -> String
     -> IO (Either (ParseError Char Void) [Maybe Function])
+#endif
   parseFromFile p file = runParser p file <$> readFile file
 
