This commit is contained in:
crumbtoo
2024-02-01 18:15:40 -07:00
parent 77f2f900d8
commit c9d1ca51f5
6 changed files with 77 additions and 28 deletions

40
src/Rlp2Core.hs Normal file
View File

@@ -0,0 +1,40 @@
module Rlp2Core
( rlpProgToCore
)
where
--------------------------------------------------------------------------------
import Control.Monad
import Control.Monad.Writer.CPS
import Lens.Micro
import Lens.Micro.Internal
import Data.Text (Text)
import Data.Text qualified as T
import Data.HashMap.Strict qualified as H
import Core.Syntax as Core
import Rlp.Syntax as Rlp
import Rlp.Parse.Types (RlpcPs)
--------------------------------------------------------------------------------
rlpProgToCore :: RlpProgram RlpcPs -> Program'
rlpProgToCore = foldMapOf (progDecls . each) declToCore
declToCore :: Decl' RlpcPs -> Program'
declToCore = undefined
-- declToCore (TySigD ns t) =
-- mempty & programTypeSigs .~ H.fromList [ (n, typeToCore t) | n <- ns ]
typeToCore :: RlpType RlpcPs -> Type
typeToCore = undefined
-- typeToCore FunConT = TyFun
-- typeToCore (FunT s t) = typeToCore s :-> typeToCore t
-- typeToCore (AppT s t) = TyApp (typeToCore s) (typeToCore t)
-- typeToCore (ConT n) = TyCon (dsNameToName n)
-- typeToCore (VarT x) = TyVar (dsNameToName x)
-- | Forwards-compatiblity if IdP RlpDs is changed
dsNameToName :: IdP RlpcPs -> Name
dsNameToName = id