diff --git a/Data/Generics/Geniplate.hs b/Data/Generics/Geniplate.hs
--- a/Data/Generics/Geniplate.hs
+++ b/Data/Generics/Geniplate.hs
@@ -44,8 +44,15 @@
     (ds, f) <- uniBiQ stops from to
     x <- newName "_x"
     let e = LamE [VarP x] $ LetE ds $ AppE (AppE f (VarE x)) (ListE [])
-    [d|instance UniverseBi $fromq $toq where universeBi = $(return e) |]
+    return $ instDef ''UniverseBi [from, to] 'universeBi e
+--    [d|instance UniverseBi $fromq $toq where universeBi = $(return e) |]
 
+funDef :: Name -> Exp -> [Dec]
+funDef f e = [FunD f [Clause [] (NormalB e) []]]
+
+instDef :: Name -> [Type] -> Name -> Exp -> [Dec]
+instDef cls ts met e = [InstanceD [] (foldl AppT (ConT cls) ts) (funDef met e)]
+
 instanceTransformBi :: TypeQ -> TypeQ -> Q [Dec]
 instanceTransformBi = instanceTransformBiT []
 
@@ -59,13 +66,15 @@
     (ds, tr) <- trBiQ raNormal stops f ft st
     let e = LamE [VarP f, VarP x] $ LetE ds $ AppE tr (VarE x)
 
-    [d|instance TransformBi $ftq $stq where transformBi = $(return e) |]
+    return $ instDef ''TransformBi [ft, st] 'transformBi e
+--    [d|instance TransformBi $ftq $stq where transformBi = $(return e) |]
 
 instanceTransformBiM :: TypeQ -> TypeQ -> TypeQ -> Q [Dec]
 instanceTransformBiM = instanceTransformBiMT []
 
 instanceTransformBiMT :: [TypeQ] -> TypeQ -> TypeQ -> TypeQ -> Q [Dec]
 instanceTransformBiMT stops mndq ftq stq = do
+    mnd <- mndq
     ft <- ftq
     st <- stq
 
@@ -74,7 +83,8 @@
     (ds, tr) <- trBiQ raMonad stops f ft st
     let e = LamE [VarP f, VarP x] $ LetE ds $ AppE tr (VarE x)
 
-    [d|instance TransformBiM $mndq $ftq $stq where transformBiM = $(return e) |]
+    return $ instDef ''TransformBiM [mnd, ft, st] 'transformBiM e
+--    [d|instance TransformBiM $mndq $ftq $stq where transformBiM = $(return e) |]
 
 
 -- | Generate TH code for a function that extracts all subparts of a certain type.
diff --git a/geniplate.cabal b/geniplate.cabal
--- a/geniplate.cabal
+++ b/geniplate.cabal
@@ -1,6 +1,6 @@
 Name:           geniplate
 Cabal-Version:  >= 1.2
-Version:        0.5.0.0
+Version:        0.5.0.1
 License:        BSD3
 Author:         Lennart Augustsson
 Maintainer:     Lennart Augustsson
