diff options
Diffstat (limited to 'compiler/basicTypes/Var.hs')
-rw-r--r-- | compiler/basicTypes/Var.hs | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/compiler/basicTypes/Var.hs b/compiler/basicTypes/Var.hs index bfa5e5fa7a..7e451e5407 100644 --- a/compiler/basicTypes/Var.hs +++ b/compiler/basicTypes/Var.hs @@ -60,10 +60,13 @@ module Var ( isGlobalId, isExportedId, mustHaveLocalBinding, + -- * ArgFlags + ArgFlag(..), isVisibleArgFlag, isInvisibleArgFlag, sameVis, + AnonArgFlag(..), + -- * TyVar's - VarBndr(..), ArgFlag(..), TyCoVarBinder, TyVarBinder, + VarBndr(..), TyCoVarBinder, TyVarBinder, binderVar, binderVars, binderArgFlag, binderType, - isVisibleArgFlag, isInvisibleArgFlag, sameVis, mkTyCoVarBinder, mkTyCoVarBinders, mkTyVarBinder, mkTyVarBinders, isTyVarBinder, @@ -422,6 +425,31 @@ instance Binary ArgFlag where 1 -> return Specified _ -> return Inferred +-- The non-dependent version of ArgFlag, namely AnonArgFlag, +-- appears here partly so that it's together with its friend ArgFlag, +-- but also because it is used in IfaceType, rather early in the +-- compilation chain +data AnonArgFlag + = VisArg -- Used for (->): an ordinary non-dependent arrow + -- The argument is visible in source code + | InvisArg -- Used for (=>): a non-dependent predicate arrow + -- The argument is invisible in source code + deriving (Eq, Ord, Data) + +instance Outputable AnonArgFlag where + ppr VisArg = text "[vis]" + ppr InvisArg = text "[invis]" + +instance Binary AnonArgFlag where + put_ bh VisArg = putByte bh 0 + put_ bh InvisArg = putByte bh 1 + + get bh = do + h <- getByte bh + case h of + 0 -> return VisArg + _ -> return InvisArg + {- ********************************************************************* * * * VarBndr, TyCoVarBinder |