mirror of
https://github.com/GaloisInc/cryptol.git
synced 2024-11-30 23:45:23 +03:00
Add more destructor functions for TypeCheck.AST.Type
This commit is contained in:
parent
28043c395c
commit
a6077dd59a
@ -290,6 +290,26 @@ tIsVar ty = case tNoUser ty of
|
||||
TVar x -> Just x
|
||||
_ -> Nothing
|
||||
|
||||
tIsFun :: Type -> Maybe (Type, Type)
|
||||
tIsFun ty = case tNoUser ty of
|
||||
TCon (TC TCFun) [a, b] -> Just (a, b)
|
||||
_ -> Nothing
|
||||
|
||||
tIsSeq :: Type -> Maybe (Type, Type)
|
||||
tIsSeq ty = case tNoUser ty of
|
||||
TCon (TC TCSeq) [n, a] -> Just (n, a)
|
||||
_ -> Nothing
|
||||
|
||||
tIsBit :: Type -> Bool
|
||||
tIsBit ty = case tNoUser ty of
|
||||
TCon (TC TCBit) [] -> True
|
||||
_ -> False
|
||||
|
||||
tIsTuple :: Type -> Maybe [Type]
|
||||
tIsTuple ty = case tNoUser ty of
|
||||
TCon (TC (TCTuple _)) ts -> Just ts
|
||||
_ -> Nothing
|
||||
|
||||
pIsFin :: Prop -> Maybe Type
|
||||
pIsFin ty = case tNoUser ty of
|
||||
TCon (PC PFin) [t1] -> Just t1
|
||||
@ -305,6 +325,16 @@ pIsEq ty = case tNoUser ty of
|
||||
TCon (PC PEqual) [t1,t2] -> Just (t1,t2)
|
||||
_ -> Nothing
|
||||
|
||||
pIsArith :: Prop -> Maybe Type
|
||||
pIsArith ty = case tNoUser ty of
|
||||
TCon (PC PArith) [t1] -> Just t1
|
||||
_ -> Nothing
|
||||
|
||||
pIsCmp :: Prop -> Maybe Type
|
||||
pIsCmp ty = case tNoUser ty of
|
||||
TCon (PC PCmp) [t1] -> Just t1
|
||||
_ -> Nothing
|
||||
|
||||
|
||||
|
||||
pIsNumeric :: Prop -> Bool
|
||||
|
Loading…
Reference in New Issue
Block a user