module Fay.Exts where import qualified Language.Haskell.Exts as A type X = A.SrcSpanInfo type Alt = A.Alt X type BangType = A.BangType X type ClassDecl = A.ClassDecl X type Decl = A.Decl X type DeclHead = A.DeclHead X type Ex = A.Exp X type Exp = A.Exp X type ExportSpec = A.ExportSpec X type FieldDecl = A.FieldDecl X type FieldUpdate = A.FieldUpdate X type GadtDecl = A.GadtDecl X type GuardedRhs = A.GuardedRhs X type ImportDecl = A.ImportDecl X type ImportSpec = A.ImportSpec X type Literal = A.Literal X type Match = A.Match X type Module = A.Module X type ModuleName = A.ModuleName X type ModulePragma = A.ModulePragma X type Name = A.Name X type Pat = A.Pat X type PatField = A.PatField X type QName = A.QName X type QOp = A.QOp X type QualConDecl = A.QualConDecl X type QualStmt = A.QualStmt X type Rhs = A.Rhs X type SpecialCon = A.SpecialCon X type SrcLoc = A.SrcLoc type Stmt = A.Stmt X type TyVarBind = A.TyVarBind X type Type = A.Type X moduleName :: A.SrcInfo a => A.Module a -> A.ModuleName a moduleName :: Module a -> ModuleName a moduleName (A.Module _ (Just (A.ModuleHead _ n :: ModuleName a n _ _)) _ _ _) = ModuleName a n moduleName (A.Module a :: a a Nothing _ _ _) = a -> String -> ModuleName a forall l. l -> String -> ModuleName l A.ModuleName a a "Main" moduleName m :: Module a m = String -> ModuleName a forall a. HasCallStack => String -> a error (String -> ModuleName a) -> String -> ModuleName a forall a b. (a -> b) -> a -> b $ "moduleName: " String -> String -> String forall a. [a] -> [a] -> [a] ++ Module a -> String forall a. Pretty a => a -> String A.prettyPrint Module a m moduleExports :: A.Module X -> Maybe (A.ExportSpecList X) moduleExports :: Module X -> Maybe (ExportSpecList X) moduleExports (A.Module _ (Just (A.ModuleHead _ _ _ e :: Maybe (ExportSpecList X) e)) _ _ _) = Maybe (ExportSpecList X) e moduleExports (A.Module _ Nothing _ _ _) = Maybe (ExportSpecList X) forall a. Maybe a Nothing moduleExports m :: Module X m = String -> Maybe (ExportSpecList X) forall a. HasCallStack => String -> a error (String -> Maybe (ExportSpecList X)) -> String -> Maybe (ExportSpecList X) forall a b. (a -> b) -> a -> b $ "moduleExports: " String -> String -> String forall a. [a] -> [a] -> [a] ++ Module X -> String forall a. Pretty a => a -> String A.prettyPrint Module X m moduleNameString :: A.ModuleName t -> String moduleNameString :: ModuleName t -> String moduleNameString (A.ModuleName _ n :: String n) = String n mkIdent :: String -> A.Name A.SrcSpanInfo mkIdent :: String -> Name X mkIdent = X -> String -> Name X forall l. l -> String -> Name l A.Ident X noI noI :: A.SrcSpanInfo noI :: X noI = SrcSpan -> X A.noInfoSpan (SrcLoc -> SrcLoc -> SrcSpan A.mkSrcSpan SrcLoc A.noLoc SrcLoc A.noLoc) convertFieldDecl :: A.FieldDecl a -> ([A.Name a], A.Type a) convertFieldDecl :: FieldDecl a -> ([Name a], Type a) convertFieldDecl (A.FieldDecl _ ns :: [Name a] ns b :: Type a b) = ([Name a] ns, Type a b) fieldDeclNames :: A.FieldDecl a -> [A.Name a] fieldDeclNames :: FieldDecl a -> [Name a] fieldDeclNames (A.FieldDecl _ ns :: [Name a] ns _) = [Name a] ns declHeadName :: A.DeclHead a -> A.Name a declHeadName :: DeclHead a -> Name a declHeadName d :: DeclHead a d = case DeclHead a d of A.DHead _ n :: Name a n -> Name a n A.DHInfix _ _ n :: Name a n -> Name a n A.DHParen _ h :: DeclHead a h -> DeclHead a -> Name a forall a. DeclHead a -> Name a declHeadName DeclHead a h A.DHApp _ h :: DeclHead a h _ -> DeclHead a -> Name a forall a. DeclHead a -> Name a declHeadName DeclHead a h