diff --git a/BSD3.txt b/BSD3.txt
--- a/BSD3.txt
+++ b/BSD3.txt
@@ -1,5 +1,5 @@
 Copyright (c) 2010, Oscar Finnsson
-Copyright (c) 2013-2016, Benno Fünfstück
+Copyright (c) 2013-2017, Benno Fünfstück
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
diff --git a/src/Test/Tasty/TH.hs b/src/Test/Tasty/TH.hs
--- a/src/Test/Tasty/TH.hs
+++ b/src/Test/Tasty/TH.hs
@@ -29,6 +29,9 @@
 
 import Control.Monad (join)
 import Control.Applicative
+import Language.Haskell.Exts (parseFileContents)
+import Language.Haskell.Exts.Parser (ParseResult(..))
+import qualified Language.Haskell.Exts.Syntax as S
 import Language.Haskell.TH
 import Data.List
 import Data.Maybe
@@ -78,9 +81,23 @@
 extractTestFunctions :: FilePath -> IO [String]
 extractTestFunctions filePath = do
   file <- readFile filePath
-  let functions = map fst . concatMap lex . lines $ file
+  -- we first try to parse the file using haskell-src-exts
+  -- if that fails, we fallback to lexing each line, which is less
+  -- accurate but is more reliable (haskell-src-exts sometimes struggles
+  -- with less-common GHC extensions).
+  let functions = fromMaybe (lexed file) (parsed file)
       filtered pat = filter (pat `isPrefixOf`) functions
   return . nub $ concat [filtered "prop_", filtered "case_", filtered "test_"]
+ where
+  lexed = map fst . concatMap lex . lines
+  
+  parsed file = case parseFileContents file of
+    ParseOk parsedModule -> Just (declarations parsedModule)
+    ParseFailed _ _ -> Nothing
+  declarations (S.Module _ _ _ _ decls) = mapMaybe testFunName decls
+  declarations _ = []
+  testFunName (S.PatBind _ (S.PVar _ (S.Ident _ n)) _ _) = Just n
+  testFunName _ = Nothing
 
 -- | Extract the name of the current module.
 locationModule :: ExpQ
diff --git a/tasty-th.cabal b/tasty-th.cabal
--- a/tasty-th.cabal
+++ b/tasty-th.cabal
@@ -1,5 +1,5 @@
 name: tasty-th
-version: 0.1.4
+version: 0.1.5
 cabal-version: >= 1.6
 build-type: Simple
 license: BSD3
@@ -14,7 +14,7 @@
 
 library
   exposed-modules: Test.Tasty.TH
-  build-depends: base >= 4 && < 5, tasty, template-haskell
+  build-depends: base >= 4 && < 5, haskell-src-exts >= 1.18.0, tasty, template-haskell
   hs-source-dirs: src
   other-extensions: TemplateHaskell
 
