module SyntaxTrees.Haskell.ModuleDef where

import SyntaxTrees.Haskell.ClassDef (ClassDef, DerivingDef, InstanceDef)
import SyntaxTrees.Haskell.Common   (Module, Var, VarOp)
import SyntaxTrees.Haskell.DataDef  (DataDef, NewTypeDef, TypeDef)
import SyntaxTrees.Haskell.FnDef    (FnDefOrSig, InfixFnAnnotation)
import SyntaxTrees.Haskell.Type     (TypeVar)


data ModuleDef
  = ModuleDef
      { ModuleDef -> Module
name    :: Module
      , ModuleDef -> Maybe ModuleExport
export  :: Maybe ModuleExport
      , ModuleDef -> [ModuleImport]
imports :: [ModuleImport]
      , ModuleDef -> [InternalDef]
defs    :: [InternalDef]
      }
  deriving (Int -> ModuleDef -> ShowS
[ModuleDef] -> ShowS
ModuleDef -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModuleDef] -> ShowS
$cshowList :: [ModuleDef] -> ShowS
show :: ModuleDef -> String
$cshow :: ModuleDef -> String
showsPrec :: Int -> ModuleDef -> ShowS
$cshowsPrec :: Int -> ModuleDef -> ShowS
Show)

newtype ModuleExport
  = ModuleExport [ModuleExportDef]
  deriving (Int -> ModuleExport -> ShowS
[ModuleExport] -> ShowS
ModuleExport -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModuleExport] -> ShowS
$cshowList :: [ModuleExport] -> ShowS
show :: ModuleExport -> String
$cshow :: ModuleExport -> String
showsPrec :: Int -> ModuleExport -> ShowS
$cshowsPrec :: Int -> ModuleExport -> ShowS
Show)

data ModuleExportDef
  = ModuleExportDef ImportExportDef
  | FullModuleExport Module
  deriving (Int -> ModuleExportDef -> ShowS
[ModuleExportDef] -> ShowS
ModuleExportDef -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModuleExportDef] -> ShowS
$cshowList :: [ModuleExportDef] -> ShowS
show :: ModuleExportDef -> String
$cshow :: ModuleExportDef -> String
showsPrec :: Int -> ModuleExportDef -> ShowS
$cshowsPrec :: Int -> ModuleExportDef -> ShowS
Show)

data ModuleImport
  = ModuleImport
      { ModuleImport -> Bool
qualified  :: Bool
      , ModuleImport -> Module
module'    :: Module
      , ModuleImport -> Maybe Module
alias      :: Maybe Module
      , ModuleImport -> Bool
hiding     :: Bool
      , ModuleImport -> [ModuleImportDef]
importDefs :: [ModuleImportDef]
      }
  deriving (Int -> ModuleImport -> ShowS
[ModuleImport] -> ShowS
ModuleImport -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModuleImport] -> ShowS
$cshowList :: [ModuleImport] -> ShowS
show :: ModuleImport -> String
$cshow :: ModuleImport -> String
showsPrec :: Int -> ModuleImport -> ShowS
$cshowsPrec :: Int -> ModuleImport -> ShowS
Show)

data ModuleImportDef
  = ModuleImportDef ImportExportDef
  deriving (Int -> ModuleImportDef -> ShowS
[ModuleImportDef] -> ShowS
ModuleImportDef -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModuleImportDef] -> ShowS
$cshowList :: [ModuleImportDef] -> ShowS
show :: ModuleImportDef -> String
$cshow :: ModuleImportDef -> String
showsPrec :: Int -> ModuleImportDef -> ShowS
$cshowsPrec :: Int -> ModuleImportDef -> ShowS
Show)

data ImportExportDef
  = Member ModuleMember
  | FullData TypeVar
  | FilteredData TypeVar [ModuleMember]
  deriving (Int -> ImportExportDef -> ShowS
[ImportExportDef] -> ShowS
ImportExportDef -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ImportExportDef] -> ShowS
$cshowList :: [ImportExportDef] -> ShowS
show :: ImportExportDef -> String
$cshow :: ImportExportDef -> String
showsPrec :: Int -> ImportExportDef -> ShowS
$cshowsPrec :: Int -> ImportExportDef -> ShowS
Show)

data ModuleMember
  = VarMember Var
  | VarOpMember VarOp
  | DataMember TypeVar
  deriving (Int -> ModuleMember -> ShowS
[ModuleMember] -> ShowS
ModuleMember -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModuleMember] -> ShowS
$cshowList :: [ModuleMember] -> ShowS
show :: ModuleMember -> String
$cshow :: ModuleMember -> String
showsPrec :: Int -> ModuleMember -> ShowS
$cshowsPrec :: Int -> ModuleMember -> ShowS
Show)

data InternalDef
  = TypeDef' TypeDef
  | NewTypeDef' NewTypeDef
  | DataDef' DataDef
  | FnDefOrSig' FnDefOrSig
  | ClassDef' ClassDef
  | InstanceDef' InstanceDef
  | DerivingDef' DerivingDef
  | InfixFnAnnotation' InfixFnAnnotation
  deriving (Int -> InternalDef -> ShowS
[InternalDef] -> ShowS
InternalDef -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InternalDef] -> ShowS
$cshowList :: [InternalDef] -> ShowS
show :: InternalDef -> String
$cshow :: InternalDef -> String
showsPrec :: Int -> InternalDef -> ShowS
$cshowsPrec :: Int -> InternalDef -> ShowS
Show)