mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-11 13:59:31 -06:00
extending proto resource API
This commit is contained in:
@@ -179,13 +179,16 @@ Path path ++. lbl = Path (Left lbl : path)
|
||||
(++!) :: Path c t -> Term c t -> Path c t
|
||||
Path path ++! sel = Path (Right sel : path)
|
||||
|
||||
lintypeFollowPath :: Path c t -> LinType c t -> LinType c t
|
||||
lintypeFollowPath :: (Show c,Show t) => Path c t -> LinType c t -> LinType c t
|
||||
lintypeFollowPath (Path path) = follow path
|
||||
where follow [] ctype = ctype
|
||||
follow (Right pat : path) (TblT _ ctype) = follow path ctype
|
||||
follow (Left lbl : path) (RecT rec)
|
||||
= maybe err (follow path) $ lookup lbl rec
|
||||
where err = error $ "lintypeFollowPath: label not in record type"
|
||||
++ "\n" ++ show lbl
|
||||
++ "\n" ++ show rec
|
||||
--- by AR for debugging 23/11/2005
|
||||
|
||||
termFollowPath :: (Eq c, Eq t) => Path c t -> Term c t -> Term c t
|
||||
termFollowPath (Path path) = follow (reverse path)
|
||||
|
||||
Reference in New Issue
Block a user