forked from GitHub/gf-core
fill in more gaps in the API
This commit is contained in:
@@ -7,7 +7,7 @@ module PGF ( PGF2.PGF, readPGF
|
||||
, functions, functionsByCat
|
||||
|
||||
, PGF2.Expr(..), PGF2.Literal(..), Tree
|
||||
, PGF2.readExpr
|
||||
, PGF2.readExpr, PGF2.showExpr
|
||||
, PGF2.mkAbs, PGF2.unAbs
|
||||
, PGF2.mkApp, PGF2.unApp, PGF2.unapply
|
||||
, PGF2.mkStr, PGF2.unStr
|
||||
@@ -15,8 +15,10 @@ module PGF ( PGF2.PGF, readPGF
|
||||
, PGF2.mkDouble, PGF2.unDouble
|
||||
, PGF2.mkFloat, PGF2.unFloat
|
||||
, PGF2.mkMeta, PGF2.unMeta
|
||||
, PGF2.exprSize, PGF2.exprFunctions
|
||||
|
||||
, PGF2.Type(..), PGF2.Hypo
|
||||
, PGF2.readType, PGF2.showType
|
||||
, PGF2.mkType, PGF2.unType
|
||||
, PGF2.mkHypo, PGF2.mkDepHypo, PGF2.mkImplHypo
|
||||
|
||||
|
||||
@@ -32,6 +32,8 @@ module PGF2 (-- * PGF
|
||||
mkDouble, unDouble,
|
||||
mkFloat, unFloat,
|
||||
mkMeta, unMeta,
|
||||
-- extra
|
||||
exprSize, exprFunctions,
|
||||
-- ** Types
|
||||
Type(..), Hypo, BindType(..), startCat,
|
||||
readType, showType,
|
||||
|
||||
@@ -11,6 +11,8 @@ module PGF2.Expr(Var, Cat, Fun,
|
||||
mkFloat, unFloat,
|
||||
mkMeta, unMeta,
|
||||
|
||||
exprSize, exprFunctions,
|
||||
|
||||
mkType, unType,
|
||||
mkHypo, mkDepHypo, mkImplHypo
|
||||
|
||||
@@ -152,6 +154,20 @@ unMeta (ETyped e ty) = unMeta e
|
||||
unMeta (EImplArg e) = unMeta e
|
||||
unMeta _ = Nothing
|
||||
|
||||
exprSize :: Expr -> Int
|
||||
exprSize (EAbs _ _ e) = exprSize e
|
||||
exprSize (EApp e1 e2) = exprSize e1 + exprSize e2
|
||||
exprSize (ETyped e ty)= exprSize e
|
||||
exprSize (EImplArg e) = exprSize e
|
||||
exprSize _ = 1
|
||||
|
||||
exprFunctions :: Expr -> [Fun]
|
||||
exprFunctions (EAbs _ _ e) = exprFunctions e
|
||||
exprFunctions (EApp e1 e2) = exprFunctions e1 ++ exprFunctions e2
|
||||
exprFunctions (ETyped e ty)= exprFunctions e
|
||||
exprFunctions (EImplArg e) = exprFunctions e
|
||||
exprFunctions (EFun f) = [f]
|
||||
exprFunctions _ = []
|
||||
|
||||
-- | creates a type from list of hypothesises, category and
|
||||
-- list of arguments for the category. The operation
|
||||
|
||||
Reference in New Issue
Block a user