.. so that it's able to handle Kind '* -> *' types such as
'MaybeForJSON'.

Signed-off-by: Petr Pudlak <[email protected]>
---
 src/Ganeti/THH/PyRPC.hs | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/Ganeti/THH/PyRPC.hs b/src/Ganeti/THH/PyRPC.hs
index 729075c..5ca2a22 100644
--- a/src/Ganeti/THH/PyRPC.hs
+++ b/src/Ganeti/THH/PyRPC.hs
@@ -98,6 +98,7 @@ toFunc fname as = do
     varName idx (AppT ListT t)        = listOf idx t
     varName idx (AppT (ConT n) t)
       | n == ''[]                     = listOf idx t
+      | otherwise                     = kind1Of idx n t
     varName idx (AppT (AppT (TupleT 2) t) t')
                                       = pairOf idx t t'
     varName idx (AppT (AppT (ConT n) t) t')
@@ -112,6 +113,11 @@ toFunc fname as = do
     listOf :: Int -> Type -> Q Doc
     listOf idx t = (<> text "List") <$> varName idx t
 
+    -- | Create a name for a method argument, knowing that its wrapped in
+    -- a type of kind @* -> *@.
+    kind1Of :: Int -> Name -> Type -> Q Doc
+    kind1Of idx name t = (<> text (nameBase name)) <$> varName idx t
+
     -- | Create a name for a method argument, knowing that its a pair of
     -- the given types.
     pairOf :: Int -> Type -> Type -> Q Doc
-- 
1.9.1.423.g4596e3a

Reply via email to