-- -- | -- Module : TypeInfTests -- Authors : Sean Seefried (http://www.cse.unsw.edu.au/~sseefried) -- Copyright : (c) 2006 -- License : BSD3 -- Created : 16 Feb 2006 -- module TypeInfTests where import TypeInference gamma1 = let a = TyVar "a" Star b = TyVar "b" Star f = TyVar "f" (Star :->: Star) in [ ("==", Scheme [a] [Pred "Eq" [VarT a]] (VarT a `to` VarT a `to` ConT (Con "Bool" Star ))) , ("1", Scheme [] [] (ConT (Con "Int" Star))) , ("fmap", Scheme [a, b, f] [Pred "Functor" [VarT f]] ((VarT a `to` VarT b) `to` (AppT (VarT f) (VarT a)) `to` (AppT (VarT f) (VarT b)))) , ("[]", Scheme [a] [] (AppT (ConT nilCon) (VarT a))) ] -- there's a difference between the [] variable and the [] type constructor nilCon = Con "[]" (Star :->: Star) term11 = VarE "==" term12 = LamE "x" (LamE "y" ( (VarE "==") `AppE` (VarE "x") `AppE`(VarE "y"))) term13 = LamE "x" (LamE "y" (VarE "x")) term14 = LamE "x" (VarE "x") term15 = LamE "x" (VarE "==" `AppE` VarE "1" `AppE` VarE "x") term16 = VarE "1" term17 = LetE "y" (LamE "x" (VarE "x")) (VarE "y") term18 = LetE "y" (VarE "==") (AppE (VarE "y") (VarE "1")) term19 = (VarE "fmap") `AppE`(LamE "x" (VarE "x")) `AppE` (VarE "[]") term110 = (VarE "fmap") `AppE` (LamE "x" (LamE "y" (VarE "x"))) term111 = LamE "x" (LamE "y" (AppE (VarE "x") (VarE "y"))) runTests = sequence (map (typeInf gamma1) [term11, term12, term13, term14, term15, term16, term17, term18, term19, term110, term111])