diff --git a/alex-meta.cabal b/alex-meta.cabal
--- a/alex-meta.cabal
+++ b/alex-meta.cabal
@@ -1,5 +1,5 @@
 Name:                alex-meta
-Version:             0.3.0.7
+Version:             0.3.0.8
 Synopsis:            Quasi-quoter for Alex lexers
 -- Description:         
 License:             BSD3
@@ -23,7 +23,7 @@
   
   -- Packages needed in order to build this package.
   Build-depends:
-      template-haskell >=2.5&&<2.10
+      template-haskell >=2.5&&<2.11
     , haskell-src-meta >=0.5.1.2&&<1.0
     , base >= 4.2 && < 5
     , array, containers
diff --git a/src/NFA.hs b/src/NFA.hs
--- a/src/NFA.hs
+++ b/src/NFA.hs
@@ -23,7 +23,8 @@
 import qualified Map hiding ( Map )
 import Util ( str, space )
 
-import Control.Monad ( forM_, zipWithM, zipWithM_, when )
+import Control.Applicative( Applicative(..) )
+import Control.Monad ( forM_, zipWithM, zipWithM_, when, ap )
 import Data.Array ( Array, (!), array, listArray, assocs, bounds )
 
 -- Each state of a nondeterministic automaton contains a list of `Accept'
@@ -167,6 +168,13 @@
 
   m >>= k  = N $ \s n e -> case unN m s n e of
                                  (s', n', a) -> unN (k a) s' n' e
+
+instance Functor NFAM where
+  fmap f a = a >>= (return . f)
+
+instance Applicative NFAM where
+  (<*>) = ap
+  pure = return
 
 runNFA :: Encoding -> NFAM () -> NFA
 runNFA e m = case unN m 0 Map.empty e of
diff --git a/src/ParseMonad.hs b/src/ParseMonad.hs
--- a/src/ParseMonad.hs
+++ b/src/ParseMonad.hs
@@ -20,6 +20,8 @@
 import qualified Map hiding ( Map )
 import UTF8
 import Data.Word (Word8)
+import Control.Monad ( ap )
+import Control.Applicative ( Applicative(..) )
 -- -----------------------------------------------------------------------------
 -- The input type
 --import Codec.Binary.UTF8.Light as UTF8
@@ -98,6 +100,13 @@
  where initial_state = 
  	  PState{ smac_env=senv, rmac_env=renv,
 	     startcode = 0, input=(alexStartPos,'\n',[],str) }
+
+instance Functor P where
+  fmap f a = a >>= (return . f)
+
+instance Applicative P where
+  (<*>) = ap
+  pure = return
 
 failP :: String -> P a
 failP str = P $ \PState{ input = (p,_,_,_) } -> Left (Just p,str)
