packages feed

HaskellAnalysisProgram-0.1.0: src/MetaHS/DataModel/Utils/Language/Haskell/Exts/Syntax/QName.hs

{-|
Module      : MetaHS.DataModel.Utils.Language.Haskell.Exts.Syntax.QName
Description : Utility functions for QName objects.
Copyright   : Copyright (C) 2017-2019 H.H.R.F. Vos, S. Kamps
License     : -- This file is distributed under the  terms of the Apache License 2.0.
              For more information, see the file "LICENSE", which is included in the distribution.
Stability   : experimental
Utility functions for QName objects.
-}
module MetaHS.DataModel.Utils.Language.Haskell.Exts.Syntax.QName
    where

import Language.Haskell.Exts.Syntax
import qualified MetaHS.DataModel.Utils.Language.Haskell.Exts.Syntax.Name as Name

-- | Returns the name for a QName object.
name :: QName l       -- ^ The QName object to analyze.
     -> Maybe String  -- ^ The name of the QName object.
name (Qual _ (ModuleName _ m) n) = Just $ m ++ "." ++ Name.name n
name (UnQual _ n)                = Just $ Name.name n
name _                           = Nothing