Skip to content

Commit

Permalink
Do not put inferred kind variables in generated TH splices
Browse files Browse the repository at this point in the history
Fixes #23
  • Loading branch information
expipiplus1 committed Sep 19, 2024
1 parent bc6a101 commit 4f3b991
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/Hyper/TH/Internal/Utils.hs
Original file line number Diff line number Diff line change
Expand Up @@ -84,20 +84,19 @@ makeTypeInfo name =

parts :: D.DatatypeInfo -> Q (Type, Name)
parts info =
case D.datatypeVars info of
case D.datatypeInstTypes info of
[] -> fail "expected type constructor which requires arguments"
xs ->
elimTV
(pure . (,) res)
( \var c ->
case c of
ConT aHyper | aHyper == ''AHyperType -> pure (res, var)
_ -> fail "expected last argument to be a AHyperType variable"
)
(last xs)
case last xs of
SigT (VarT var) (ConT aHyper)
| aHyper == ''AHyperType -> pure (res, var)
_ -> fail "expected last argument to be a AHyperType variable"
where
unkind = \case
SigT a _k -> a
a -> a
res =
foldl AppT (ConT (D.datatypeName info)) (init xs <&> VarT . D.tvName)
foldl AppT (ConT (D.datatypeName info)) (init xs <&> unkind)

childrenTypes :: TypeInfo -> TypeContents
childrenTypes info = evalState (childrenTypesH info) mempty
Expand Down

0 comments on commit 4f3b991

Please sign in to comment.