diff --git a/alex.cabal b/alex.cabal
--- a/alex.cabal
+++ b/alex.cabal
@@ -1,5 +1,5 @@
 name: alex
-version: 3.0.4
+version: 3.0.5
 license: BSD3
 license-file: LICENSE
 copyright: (c) Chis Dornan, Simon Marlow
diff --git a/templates/wrappers.hs b/templates/wrappers.hs
--- a/templates/wrappers.hs
+++ b/templates/wrappers.hs
@@ -325,8 +325,8 @@
 #ifdef ALEX_BASIC
 type AlexInput = (Char,[Byte],String)
 
-
-alexInputPrevChar (c,_) = c
+alexInputPrevChar :: AlexInput -> Char
+alexInputPrevChar (c,_,_) = c
 
 -- alexScanTokens :: String -> [token]
 alexScanTokens str = go ('\n',[],str)
diff --git a/tests/tokens.x b/tests/tokens.x
--- a/tests/tokens.x
+++ b/tests/tokens.x
@@ -18,6 +18,9 @@
   [\=\+\-\*\/\(\)]			{ \s -> Sym (head s) }
   $alpha [$alpha $digit \_ \']*		{ \s -> Var s }
 
+  -- a left-context pattern for testing
+  ^ \#                                  ;
+
 {
 -- Each right-hand side has type :: String -> Token
 
