instance hell

This commit is contained in:
crumbtoo
2024-02-26 10:12:33 -07:00
parent 240db0df3d
commit 15f65a79f6
10 changed files with 284 additions and 183 deletions

View File

@@ -5,8 +5,8 @@ Description : Core quasiquoters
module Core.TH
( coreExpr
, coreProg
, coreExprT
, coreProgT
-- , coreExprT
-- , coreProgT
)
where
----------------------------------------------------------------------------------
@@ -33,18 +33,18 @@ coreExpr :: QuasiQuoter
coreExpr = mkqq $ lexCoreR >=> parseCoreExprR
-- | Type-checked @coreProg@
coreProgT :: QuasiQuoter
coreProgT = mkqq $ lexCoreR >=> parseCoreProgR >=> checkCoreProgR
-- coreProgT :: QuasiQuoter
-- coreProgT = mkqq $ lexCoreR >=> parseCoreProgR >=> checkCoreProgR
coreExprT :: QuasiQuoter
coreExprT = mkqq $ lexCoreR >=> parseCoreExprR >=> checkCoreExprR g
where
g = [ ("+#", TyInt :-> TyInt :-> TyInt)
, ("id", TyForall (MkVar "a" TyKindType) $
TyVar "a" :-> TyVar "a")
, ("fix", TyForall (MkVar "a" TyKindType) $
(TyVar "a" :-> TyVar "a") :-> TyVar "a")
]
-- coreExprT :: QuasiQuoter
-- coreExprT = mkqq $ lexCoreR >=> parseCoreExprR >=> checkCoreExprR g
-- where
-- g = [ ("+#", TyInt :-> TyInt :-> TyInt)
-- , ("id", TyForall (MkVar "a" TyKindType) $
-- TyVar "a" :-> TyVar "a")
-- , ("fix", TyForall (MkVar "a" TyKindType) $
-- (TyVar "a" :-> TyVar "a") :-> TyVar "a")
-- ]
mkqq :: (Lift a) => (Text -> RLPCIO a) -> QuasiQuoter
mkqq p = QuasiQuoter