diff --git a/Graphics/UI/Gtk/SourceView/Cast/TH.hs b/Graphics/UI/Gtk/SourceView/Cast/TH.hs
new file mode 100644
--- /dev/null
+++ b/Graphics/UI/Gtk/SourceView/Cast/TH.hs
@@ -0,0 +1,34 @@
+-- gtk2hs-cast-gtksourceview2 -- A type class for cast functions of Gtk2hs:
+-- gtksourceview2 package
+-- Copyright (c) 2009 Marco Túlio Gontijo e Silva <marcot@holoscopio.com>
+-- CC0 Waiver 1.0 Universal [Beta 3]
+-- See LICENSE
+
+module Graphics.UI.Gtk.SourceView.Cast.TH (instance_) where
+
+-- base
+import Data.Maybe
+
+-- hint
+import Language.Haskell.Interpreter
+
+-- template-haskell
+import Language.Haskell.TH.Syntax
+
+instance_ :: Q [Dec]
+instance_
+  = do
+    (Right (elements :: [ModuleElem]))
+      <- qRunIO $ runInterpreter $ getModuleExports "Graphics.UI.Gtk.SourceView"
+    return $ map makeInstance_ $ mapMaybe isCastTo elements
+
+isCastTo :: ModuleElem -> Maybe String
+isCastTo (Fun ('c' : 'a' : 's' : 't' : 'T' : 'o' : rest)) = Just rest
+isCastTo _others = Nothing
+
+makeInstance_ :: String -> Dec
+makeInstance_ type_
+  = InstanceD []
+  (AppT (ConT $ mkName "Cast") $ ConT $ mkName type_)
+  [ FunD (mkName "cast")
+    [ Clause [] (NormalB $ VarE $ mkName $ "castTo" ++ type_) []]]
diff --git a/gtk2hs-cast-gtksourceview2.cabal b/gtk2hs-cast-gtksourceview2.cabal
--- a/gtk2hs-cast-gtksourceview2.cabal
+++ b/gtk2hs-cast-gtksourceview2.cabal
@@ -1,5 +1,5 @@
 name: gtk2hs-cast-gtksourceview2
-version: 0.10.1.0
+version: 0.10.1.1
 cabal-version: >= 1.6
 build-type: Simple
 license: OtherLicense
@@ -20,7 +20,7 @@
 category: GUI
 tested-with: GHC == 6.10.1
 library
-  exposed-modules: Graphics.UI.Gtk.SourceView.Cast
+  exposed-modules: Graphics.UI.Gtk.SourceView.Cast, Graphics.UI.Gtk.SourceView.Cast.TH
   build-depends: base, hint, gtksourceview2, gtk2hs-cast-glib, template-haskell
   extensions: ScopedTypeVariables, TemplateHaskell
 source-repository head
