diff --git a/derive-has-field.cabal b/derive-has-field.cabal
--- a/derive-has-field.cabal
+++ b/derive-has-field.cabal
@@ -5,7 +5,7 @@
 -- see: https://github.com/sol/hpack
 
 name:           derive-has-field
-version:        0.0.1.1
+version:        0.0.1.2
 synopsis:       Derive HasField instances with Template Haskell
 description:    A Template Haskell function to derive HasField instances to utilize OverloadedRecordDot more effectively.
 category:       Template Haskell
diff --git a/src/DeriveHasField.hs b/src/DeriveHasField.hs
--- a/src/DeriveHasField.hs
+++ b/src/DeriveHasField.hs
@@ -44,17 +44,21 @@
   -- Build the instances
   let constructorNamesAndTypes :: [(Name, Type)]
       constructorNamesAndTypes = zip recordConstructorNames constructorInfo.constructorFields
+      parentType =
+        foldl'
+          (\acc var -> appT acc (varT $ tyVarBndrToName var))
+          (conT datatypeInfo.datatypeName)
+          datatypeInfo.datatypeVars
   decs <- for constructorNamesAndTypes $ \(name, ty) ->
     let currentFieldName = nameBase name
         wantedFieldName = lowerFirst $ fieldModifier currentFieldName
         litTCurrentField = litT $ strTyLit currentFieldName
         litTFieldWanted = litT $ strTyLit wantedFieldName
-        parentTypeConstructor = conT datatypeInfo.datatypeName
      in if currentFieldName == wantedFieldName
           then fail "deriveHasField: after applying fieldModifier, field didn't change"
           else
             [d|
-              instance HasField $litTFieldWanted $parentTypeConstructor $(pure ty) where
+              instance HasField $litTFieldWanted $parentType $(pure ty) where
                 getField = $(appTypeE (varE $ mkName "getField") litTCurrentField)
               |]
   pure $ Foldable.concat decs
@@ -63,3 +67,8 @@
 lowerFirst = \case
   [] -> []
   (x : xs) -> toLower x : xs
+
+tyVarBndrToName :: TyVarBndr flag -> Name
+tyVarBndrToName = \case
+  PlainTV name _ -> name
+  KindedTV name _ _ -> name
diff --git a/test/DeriveHasFieldSpec.hs b/test/DeriveHasFieldSpec.hs
--- a/test/DeriveHasFieldSpec.hs
+++ b/test/DeriveHasFieldSpec.hs
@@ -26,6 +26,20 @@
     , someTypeSomeEitherField = Right 0
     }
 
+data OtherType a b = OtherType
+  { otherTypeField :: Maybe a
+  , otherTypeOtherField :: Either a b
+  }
+
+deriveHasFieldWith (dropPrefix "otherType") ''OtherType
+
+otherType :: OtherType Int String
+otherType =
+  OtherType
+    { otherTypeField = Just 0
+    , otherTypeOtherField = Right "hello"
+    }
+
 spec :: Spec
 spec = do
   describe "deriveHasField" $ do
@@ -34,3 +48,6 @@
       someType.someOtherField `shouldBe` 0
       someType.someMaybeField `shouldBe` Just 0
       someType.someEitherField `shouldBe` Right 0
+    it "compiles and gets the right field" $ do
+      otherType.field `shouldBe` Just 0
+      otherType.otherField `shouldBe` Right "hello"
