preparing for rewrite #100

This commit is contained in:
crumbtoo
2024-03-13 16:06:20 -06:00
parent 8d8651d549
commit e00e0eff3b
5 changed files with 95 additions and 5 deletions

View File

@@ -2,11 +2,12 @@
{-# LANGUAGE OverloadedLists #-}
{-# LANGUAGE TemplateHaskell #-}
module Rlp.HindleyMilner
-- ( infer
-- , check
-- , TypeError(..)
-- , HMError
-- )
( typeCheckRlpProgR
, solve
, TypeError(..)
, runHM'
, HM
)
where
--------------------------------------------------------------------------------
import Control.Lens hiding (Context', Context, (:<), para)
@@ -31,6 +32,7 @@ import Data.Fix hiding (cata, para)
import Control.Comonad.Cofree
import Control.Comonad
import Compiler.RLPC
import Compiler.RlpcError
import Rlp.AltSyntax as Rlp
import Core.Syntax qualified as Core
@@ -120,3 +122,15 @@ prettyHM :: (Pretty a)
prettyHM = over (mapped . _1) rpretty
. over (mapped . _2 . each) rpretty
fixtend :: (f (Fix f) -> b) -> Fix f -> Cofree f b
fixtend = undefined
infer :: RlpExpr PsName -> HM (Cofree (RlpExprF PsName) (Type PsName))
infer = _ . fixtend (solve _ . wrapFix)
typeCheckRlpProgR :: (Monad m)
=> Program PsName (RlpExpr PsName)
-> RLPCT m (Program PsName
(Cofree (RlpExprF PsName) (Type PsName)))
typeCheckRlpProgR = undefined