mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-22 19:22:50 -06:00
some missing patterns
This commit is contained in:
@@ -235,6 +235,9 @@ tcRho ge scope (Strs ss) mb_ty = do
|
|||||||
(t,_) <- tcRho ge scope t (Just vtypeStr)
|
(t,_) <- tcRho ge scope t (Just vtypeStr)
|
||||||
return t
|
return t
|
||||||
instSigma ge scope (Strs ss) vtypeStrs mb_ty
|
instSigma ge scope (Strs ss) vtypeStrs mb_ty
|
||||||
|
tcRho ge scope (EPattType ty) mb_ty = do
|
||||||
|
(ty, _) <- tcRho ge scope ty (Just vtypeType)
|
||||||
|
instSigma ge scope (EPattType ty) vtypeType mb_ty
|
||||||
tcRho gr scope t _ = unimplemented ("tcRho "++show t)
|
tcRho gr scope t _ = unimplemented ("tcRho "++show t)
|
||||||
|
|
||||||
tcCases ge scope [] p_ty mb_res_ty = return ([],mb_res_ty)
|
tcCases ge scope [] p_ty mb_res_ty = return ([],mb_res_ty)
|
||||||
@@ -269,6 +272,8 @@ tcApp ge scope (QC id) = -- VAR (global)
|
|||||||
mkTcA (lookupOverloadTypes (geGrammar ge) id) `bindTcA` \(t,ty) ->
|
mkTcA (lookupOverloadTypes (geGrammar ge) id) `bindTcA` \(t,ty) ->
|
||||||
do ty <- liftErr (eval ge [] ty)
|
do ty <- liftErr (eval ge [] ty)
|
||||||
return (t,ty)
|
return (t,ty)
|
||||||
|
tcApp ge scope t =
|
||||||
|
singleTcA (tcRho ge scope t Nothing)
|
||||||
|
|
||||||
|
|
||||||
tcOverloadFailed t ttys =
|
tcOverloadFailed t ttys =
|
||||||
@@ -319,10 +324,18 @@ tcPatt ge scope (PR rs) ty0 = do
|
|||||||
ltys <- mk_ltys rs
|
ltys <- mk_ltys rs
|
||||||
subsCheckRho ge scope (EPatt (PR rs)) (VRecType [(l,ty) | (l,p,ty) <- ltys]) ty0
|
subsCheckRho ge scope (EPatt (PR rs)) (VRecType [(l,ty) | (l,p,ty) <- ltys]) ty0
|
||||||
go scope ltys
|
go scope ltys
|
||||||
tcPatt gr scope (PAlt p1 p2) ty0 = do
|
tcPatt ge scope (PAlt p1 p2) ty0 = do
|
||||||
tcPatt gr scope p1 ty0
|
tcPatt ge scope p1 ty0
|
||||||
tcPatt gr scope p2 ty0
|
tcPatt ge scope p2 ty0
|
||||||
return scope
|
return scope
|
||||||
|
tcPatt ge scope (PM q) ty0 = do
|
||||||
|
case lookupResType (geGrammar ge) q of
|
||||||
|
Ok (EPattType ty)
|
||||||
|
-> do vty <- liftErr (eval ge [] ty)
|
||||||
|
unify ge scope ty0 vty
|
||||||
|
return scope
|
||||||
|
Ok ty -> tcError ("Pattern type expected but " <+> pp ty <+> " found.")
|
||||||
|
Bad err -> tcError (pp err)
|
||||||
tcPatt ge scope p ty = unimplemented ("tcPatt "++show p)
|
tcPatt ge scope p ty = unimplemented ("tcPatt "++show p)
|
||||||
|
|
||||||
inferRecFields ge scope rs =
|
inferRecFields ge scope rs =
|
||||||
@@ -742,6 +755,9 @@ mkTcA f = case f of
|
|||||||
Ok [x] -> TcSingle (\ms msgs -> TcOk x ms msgs)
|
Ok [x] -> TcSingle (\ms msgs -> TcOk x ms msgs)
|
||||||
Ok xs -> TcMany xs (\ms msgs -> [(x,ms,msgs) | x <- xs])
|
Ok xs -> TcMany xs (\ms msgs -> [(x,ms,msgs) | x <- xs])
|
||||||
|
|
||||||
|
singleTcA :: TcM a -> TcA x a
|
||||||
|
singleTcA = TcSingle . unTcM
|
||||||
|
|
||||||
bindTcA :: TcA x a -> (a -> TcM b) -> TcA x b
|
bindTcA :: TcA x a -> (a -> TcM b) -> TcA x b
|
||||||
bindTcA f g = case f of
|
bindTcA f g = case f of
|
||||||
TcSingle f -> TcSingle (unTcM (TcM f >>= g))
|
TcSingle f -> TcSingle (unTcM (TcM f >>= g))
|
||||||
|
|||||||
Reference in New Issue
Block a user