extremely basic Rlp2Core

This commit is contained in:
crumbtoo
2024-04-07 14:17:41 -06:00
parent dd93b76b69
commit 2944025327
8 changed files with 106 additions and 20 deletions

View File

@@ -13,6 +13,7 @@ module Compiler.JustRun
, justParseRlp
, justTypeCheckCore
, justHdbg
, justInferRlp
, makeItPretty, makeItPretty'
)
where
@@ -35,6 +36,7 @@ import Data.Pretty
import Rlp.AltParse
import Rlp.AltSyntax qualified as Rlp
import Rlp.HindleyMilner
----------------------------------------------------------------------------------
justHdbg :: String -> IO GmState
@@ -65,6 +67,12 @@ justTypeCheckCore s = typechk (T.pack s)
& rlpcToEither
where typechk = lexCoreR >=> parseCoreProgR >=> checkCoreProgR
justInferRlp :: String
-> Either [MsgEnvelope RlpcError]
(Rlp.Program Rlp.PsName Rlp.TypedRlpExpr')
justInferRlp s = infr (T.pack s) & rlpcToEither
where infr = parseRlpProgR >=> typeCheckRlpProgR
makeItPretty :: (Out a) => Either e a -> Either e (Doc ann)
makeItPretty = fmap out