diff --git a/src/Yi/Lexer/Alex.hs b/src/Yi/Lexer/Alex.hs
--- a/src/Yi/Lexer/Alex.hs
+++ b/src/Yi/Lexer/Alex.hs
@@ -212,7 +212,7 @@
 -- | unfold lexer into a function that returns a stream of (state, token)
 unfoldLexer :: ((state, input) -> Maybe (token, (state, input)))
             -> (state, input) -> [(state, token)]
-unfoldLexer f b = case f b of
+unfoldLexer f b = fst b `seq` case f b of
              Nothing -> []
              Just (t, b') -> (fst b, t) : unfoldLexer f b'
 
diff --git a/src/Yi/Lexer/Compilation.x b/src/Yi/Lexer/Compilation.x
--- a/src/Yi/Lexer/Compilation.x
+++ b/src/Yi/Lexer/Compilation.x
@@ -8,7 +8,7 @@
 {-# OPTIONS -w  #-}
 module Yi.Lexer.Compilation (lexer, Token(..)) where
 import Yi.Lexer.Alex hiding (tokenToStyle)
-import Yi.Regex
+import Yi.Regex (matchOnceText, Regex, makeRegex)
 import Yi.Style (commentStyle)
 }
 
diff --git a/src/Yi/Regex.hs b/src/Yi/Regex.hs
--- a/src/Yi/Regex.hs
+++ b/src/Yi/Regex.hs
@@ -14,15 +14,18 @@
   , module Text.Regex.TDFA
   ) where
 
+import Data.Bifunctor (first)
 import Data.Binary
 import GHC.Generics (Generic)
-import Text.Regex.TDFA
-import Text.Regex.TDFA.Pattern
-import Control.Applicative
-import Lens.Micro.Platform
+import Yi.Buffer.Basic (Direction(..))
+
+import Text.Regex.TDFA ( Regex, CompOption(..), caseSensitive, multiline
+                       , defaultCompOpt, defaultExecOpt, makeRegexOptsM
+                       , matchOnceText, makeRegex, RegexLike(matchAll)
+                       , AllTextSubmatches(..), (=~))
+import Text.Regex.TDFA.Pattern (Pattern(..), DoPa(..), showPattern)
 import Text.Regex.TDFA.ReadRegex(parseRegex)
 import Text.Regex.TDFA.TDFA(patternToRegex)
-import Yi.Buffer.Basic (Direction(..))
 
 -- input string, regexexp, backward regex.
 data SearchExp = SearchExp
@@ -69,7 +72,7 @@
           compile source = patternToRegex source (searchOpts opts defaultCompOpt) defaultExecOpt
           pattern = if QuoteRegex `elem` opts
                           then Right (literalPattern re)
-                          else mapLeft show (parseRegex re)
+                          else first show (parseRegex re)
 
 instance Binary SearchExp where
   get = do re   <- get
@@ -80,10 +83,6 @@
   put (SearchExp { seInput   = re,
                    seOptions = opts, .. }) = do put re
                                                 put opts
-
-mapLeft :: (t1 -> a) -> Either t1 t -> Either a t
-mapLeft _ (Right a) = Right a
-mapLeft f (Left a) = Left (f a)
 
 -- | Return an escaped (for parseRegex use) version of the string.
 regexEscapeString :: String -> String
diff --git a/yi-language.cabal b/yi-language.cabal
--- a/yi-language.cabal
+++ b/yi-language.cabal
@@ -1,9 +1,9 @@
--- This file has been generated from package.yaml by hpack version 0.14.0.
+-- This file has been generated from package.yaml by hpack version 0.17.0.
 --
 -- see: https://github.com/sol/hpack
 
 name:           yi-language
-version:        0.13.5
+version:        0.13.6
 synopsis:       Collection of language-related Yi libraries.
 category:       Yi
 homepage:       https://github.com/yi-editor/yi#readme
