{-# LANGUAGE TupleSections #-}\r
module TypeChecker where\r
\r
-import Data.Either\r
-import Data.Function\r
-import Data.List\r
-import Data.Maybe\r
-import Data.Map (Map,(!),mapWithKey,assocs,filterWithKey\r
- ,elems,intersectionWith,keys,intersectionWithKey\r
- ,intersection)\r
+import Data.Map (Map,(!),mapWithKey,assocs,filterWithKey,elems,keys\r
+ ,intersection,intersectionWith,intersectionWithKey)\r
import qualified Data.Map as Map\r
-import Data.Monoid hiding (Sum)\r
import Control.Monad\r
import Control.Monad.Trans\r
import Control.Monad.Trans.Error hiding (throwError)\r
(throwError ("Incompatible system " ++ show ps))\r
Map.fromList <$> sequence [ (alpha,) <$> t | (alpha,t) <- alist ]\r
\r
--- checkGlueElem vu ts us = do\r
--- unless (keys ts == keys us)\r
--- (throwError ("Keys don't match in " ++ show ts ++ " and " ++ show us))\r
--- rho <- asks env\r
--- k <- asks index\r
--- sequence_ $ elems $ intersectionWithKey\r
--- (\alpha vt u -> check (hisoDom vt) u) ts us\r
--- let vus = evalSystem rho us\r
--- sequence_ $ elems $ intersectionWithKey\r
--- (\alpha vt vAlpha -> do\r
--- unless (conv k (app (hisoFun vt) vAlpha) (vu `face` alpha))\r
--- (throwError $ "Image of glueElem component " ++ show vAlpha ++\r
--- " doesn't match " ++ show vu)) ts vus\r
--- unless (isCompSystem k vus)\r
--- (throwError $ "Incompatible system " ++ show vus)\r
-\r
---inferCompElem :: Ter -> System Ter\r
-\r
-\r
checkFresh :: Name -> Typing ()\r
checkFresh i = do\r
rho <- asks env\r