This commit is contained in:
crumbtoo
2023-12-17 15:23:09 -07:00
parent 20c936f317
commit 78f88e085f
4 changed files with 127 additions and 3 deletions

View File

@@ -0,0 +1,19 @@
{-# LANGUAGE QuasiQuotes #-}
module Core.HindleyMilnerSpec
( spec
)
where
----------------------------------------------------------------------------------
import Core.Syntax
import Core.TH (coreExpr)
import Core.HindleyMilner (infer)
import Test.Hspec
----------------------------------------------------------------------------------
-- TODO: more tests. preferrably property-based. lol.
spec :: Spec
spec = do
it "should infer `id 3` :: Int" $
let g = [ ("id", TyVar "a" :-> TyVar "a") ]
in infer g [coreExpr|id 3|] `shouldBe` Just TyInt