Plain source file: base/AST/HsIdent.hs (2002-03-13)

HsIdent is imported by: BaseSyntaxStruct, HasBaseName, HsConstants, HsDeclMaps, HsDeclStruct, HsExpMaps, HsExpPretty, HsExpStruct, HsExpUtil, HsIdentPretty, HsModule, HsModuleMaps, HsPatMaps, HsPatStruct, HsPatUtil, AST4ModSys, Ents, QualNames, NameMapsDecorate, OrigTiMonad, TiD, TiDefinedNames, TiFreeNames, TiKEnv, TiNameMaps, TiNames, TiPrelude, TiTEnv, DefinedNames, DefinedNamesBaseStruct, FreeNames, PNT, ReAssoc, ScopeModule, PosName, RemovePatBinds, Prop2Alfa, USCC, ConvRefsTypes, StrategoCmds, TiBase2Stratego2, PFE0, PFE4, PFE_StdNames, PFEdeps, Pfe4Cmds, PfeDepCmds, IsabelleCmds, HsPropMaps, HsPropStruct, NameMapsPropDecorate, DefinedNamesPropStruct, FreeNamesPropStruct, PfePropCmds.

module HsIdent where
import SrcLoc

data HsIdentI i
    = HsVar i
    | HsCon i
      deriving (Eq, Ord, Show,Read)

-- This is perhaps not a good idea, in case we want to change HsIdentI...
instance Functor HsIdentI where fmap = mapHsIdent

getHSName = accHsIdent id

mapHsIdent nf = mapHsIdent2 nf nf

mapHsIdent2 vf cf = accHsIdent2 (HsVar . vf) (HsCon . cf)

accHsIdent nf = accHsIdent2 nf nf

accHsIdent2 vf cf (HsVar n) = vf n
accHsIdent2 vf cf (HsCon n) = cf n

seqHsIdent (HsVar i)    = fmap HsVar i
seqHsIdent (HsCon i)    = fmap HsCon i

isHsVar (HsVar _) = True
isHsVar  _        = False

isHsCon (HsCon _) = True
isHsCon  _        = False

{- -- not used
hsVarName (HsVar v) = Just v
hsVarName _ = Nothing

hsConName (HsCon c) = Just c
hsConName _ = Nothing

instance HasSrcLoc i => HasSrcLoc (HsIdentI i) where
  srcLoc = srcLoc . getHSName


(HTML for this module was generated on 2006-08-12. About the conversion tool.)