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 a _ (Just (A.ModuleHead a _ ModuleName a n Maybe (WarningText a) _ Maybe (ExportSpecList a) _)) [ModulePragma a] _ [ImportDecl a] _ [Decl a] _) = ModuleName a n moduleName (A.Module a a Maybe (ModuleHead a) Nothing [ModulePragma a] _ [ImportDecl a] _ [Decl a] _) = a -> String -> ModuleName a forall l. l -> String -> ModuleName l A.ModuleName a a String "Main" moduleName 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 $ String "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 X _ (Just (A.ModuleHead X _ ModuleName X _ Maybe (WarningText X) _ Maybe (ExportSpecList X) e)) [ModulePragma X] _ [ImportDecl X] _ [Decl X] _) = Maybe (ExportSpecList X) e moduleExports (A.Module X _ Maybe (ModuleHead X) Nothing [ModulePragma X] _ [ImportDecl X] _ [Decl X] _) = Maybe (ExportSpecList X) forall a. Maybe a Nothing moduleExports 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 $ String "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 t _ 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 a _ [Name a] ns Type a b) = ([Name a] ns, Type a b) fieldDeclNames :: A.FieldDecl a -> [A.Name a] fieldDeclNames :: FieldDecl a -> [Name a] fieldDeclNames (A.FieldDecl a _ [Name a] ns Type a _) = [Name a] ns declHeadName :: A.DeclHead a -> A.Name a declHeadName :: DeclHead a -> Name a declHeadName DeclHead a d = case DeclHead a d of A.DHead a _ Name a n -> Name a n A.DHInfix a _ TyVarBind a _ Name a n -> Name a n A.DHParen a _ DeclHead a h -> DeclHead a -> Name a forall a. DeclHead a -> Name a declHeadName DeclHead a h A.DHApp a _ DeclHead a h TyVarBind a _ -> DeclHead a -> Name a forall a. DeclHead a -> Name a declHeadName DeclHead a h