-- | A model for Hydra namespaces and modules (collections of elements in the same namespace)

module Hydra.Module where

import qualified Hydra.Core as Core
import qualified Hydra.Mantle as Mantle
import Data.List
import Data.Map
import Data.Set

newtype FileExtension = 
  FileExtension {
    FileExtension -> String
unFileExtension :: String}
  deriving (FileExtension -> FileExtension -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FileExtension -> FileExtension -> Bool
$c/= :: FileExtension -> FileExtension -> Bool
== :: FileExtension -> FileExtension -> Bool
$c== :: FileExtension -> FileExtension -> Bool
Eq, Eq FileExtension
FileExtension -> FileExtension -> Bool
FileExtension -> FileExtension -> Ordering
FileExtension -> FileExtension -> FileExtension
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: FileExtension -> FileExtension -> FileExtension
$cmin :: FileExtension -> FileExtension -> FileExtension
max :: FileExtension -> FileExtension -> FileExtension
$cmax :: FileExtension -> FileExtension -> FileExtension
>= :: FileExtension -> FileExtension -> Bool
$c>= :: FileExtension -> FileExtension -> Bool
> :: FileExtension -> FileExtension -> Bool
$c> :: FileExtension -> FileExtension -> Bool
<= :: FileExtension -> FileExtension -> Bool
$c<= :: FileExtension -> FileExtension -> Bool
< :: FileExtension -> FileExtension -> Bool
$c< :: FileExtension -> FileExtension -> Bool
compare :: FileExtension -> FileExtension -> Ordering
$ccompare :: FileExtension -> FileExtension -> Ordering
Ord, ReadPrec [FileExtension]
ReadPrec FileExtension
Int -> ReadS FileExtension
ReadS [FileExtension]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FileExtension]
$creadListPrec :: ReadPrec [FileExtension]
readPrec :: ReadPrec FileExtension
$creadPrec :: ReadPrec FileExtension
readList :: ReadS [FileExtension]
$creadList :: ReadS [FileExtension]
readsPrec :: Int -> ReadS FileExtension
$creadsPrec :: Int -> ReadS FileExtension
Read, Int -> FileExtension -> String -> String
[FileExtension] -> String -> String
FileExtension -> String
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
showList :: [FileExtension] -> String -> String
$cshowList :: [FileExtension] -> String -> String
show :: FileExtension -> String
$cshow :: FileExtension -> String
showsPrec :: Int -> FileExtension -> String -> String
$cshowsPrec :: Int -> FileExtension -> String -> String
Show)

_FileExtension :: Name
_FileExtension = (String -> Name
Core.Name String
"hydra/module.FileExtension")

-- | A logical collection of elements in the same namespace, having dependencies on zero or more other modules
data Module m = 
  Module {
    -- | A common prefix for all element names in the module
    forall m. Module m -> Namespace
moduleNamespace :: Namespace,
    -- | The elements defined in this module
    forall m. Module m -> [Element m]
moduleElements :: [Mantle.Element m],
    -- | Any additional modules this one has a direct dependency upon
    forall m. Module m -> [Module m]
moduleDependencies :: [Module m],
    -- | An optional human-readable description of the module
    forall m. Module m -> Maybe String
moduleDescription :: (Maybe String)}
  deriving (Module m -> Module m -> Bool
forall m. Eq m => Module m -> Module m -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Module m -> Module m -> Bool
$c/= :: forall m. Eq m => Module m -> Module m -> Bool
== :: Module m -> Module m -> Bool
$c== :: forall m. Eq m => Module m -> Module m -> Bool
Eq, Module m -> Module m -> Bool
Module m -> Module m -> Ordering
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall {m}. Ord m => Eq (Module m)
forall m. Ord m => Module m -> Module m -> Bool
forall m. Ord m => Module m -> Module m -> Ordering
forall m. Ord m => Module m -> Module m -> Module m
min :: Module m -> Module m -> Module m
$cmin :: forall m. Ord m => Module m -> Module m -> Module m
max :: Module m -> Module m -> Module m
$cmax :: forall m. Ord m => Module m -> Module m -> Module m
>= :: Module m -> Module m -> Bool
$c>= :: forall m. Ord m => Module m -> Module m -> Bool
> :: Module m -> Module m -> Bool
$c> :: forall m. Ord m => Module m -> Module m -> Bool
<= :: Module m -> Module m -> Bool
$c<= :: forall m. Ord m => Module m -> Module m -> Bool
< :: Module m -> Module m -> Bool
$c< :: forall m. Ord m => Module m -> Module m -> Bool
compare :: Module m -> Module m -> Ordering
$ccompare :: forall m. Ord m => Module m -> Module m -> Ordering
Ord, ReadPrec [Module m]
ReadPrec (Module m)
ReadS [Module m]
forall m. (Read m, Ord m) => ReadPrec [Module m]
forall m. (Read m, Ord m) => ReadPrec (Module m)
forall m. (Read m, Ord m) => Int -> ReadS (Module m)
forall m. (Read m, Ord m) => ReadS [Module m]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Module m]
$creadListPrec :: forall m. (Read m, Ord m) => ReadPrec [Module m]
readPrec :: ReadPrec (Module m)
$creadPrec :: forall m. (Read m, Ord m) => ReadPrec (Module m)
readList :: ReadS [Module m]
$creadList :: forall m. (Read m, Ord m) => ReadS [Module m]
readsPrec :: Int -> ReadS (Module m)
$creadsPrec :: forall m. (Read m, Ord m) => Int -> ReadS (Module m)
Read, Int -> Module m -> String -> String
forall m. Show m => Int -> Module m -> String -> String
forall m. Show m => [Module m] -> String -> String
forall m. Show m => Module m -> String
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
showList :: [Module m] -> String -> String
$cshowList :: forall m. Show m => [Module m] -> String -> String
show :: Module m -> String
$cshow :: forall m. Show m => Module m -> String
showsPrec :: Int -> Module m -> String -> String
$cshowsPrec :: forall m. Show m => Int -> Module m -> String -> String
Show)

_Module :: Name
_Module = (String -> Name
Core.Name String
"hydra/module.Module")

_Module_namespace :: FieldName
_Module_namespace = (String -> FieldName
Core.FieldName String
"namespace")

_Module_elements :: FieldName
_Module_elements = (String -> FieldName
Core.FieldName String
"elements")

_Module_dependencies :: FieldName
_Module_dependencies = (String -> FieldName
Core.FieldName String
"dependencies")

_Module_description :: FieldName
_Module_description = (String -> FieldName
Core.FieldName String
"description")

-- | A prefix for element names
newtype Namespace = 
  Namespace {
    -- | A prefix for element names
    Namespace -> String
unNamespace :: String}
  deriving (Namespace -> Namespace -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Namespace -> Namespace -> Bool
$c/= :: Namespace -> Namespace -> Bool
== :: Namespace -> Namespace -> Bool
$c== :: Namespace -> Namespace -> Bool
Eq, Eq Namespace
Namespace -> Namespace -> Bool
Namespace -> Namespace -> Ordering
Namespace -> Namespace -> Namespace
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Namespace -> Namespace -> Namespace
$cmin :: Namespace -> Namespace -> Namespace
max :: Namespace -> Namespace -> Namespace
$cmax :: Namespace -> Namespace -> Namespace
>= :: Namespace -> Namespace -> Bool
$c>= :: Namespace -> Namespace -> Bool
> :: Namespace -> Namespace -> Bool
$c> :: Namespace -> Namespace -> Bool
<= :: Namespace -> Namespace -> Bool
$c<= :: Namespace -> Namespace -> Bool
< :: Namespace -> Namespace -> Bool
$c< :: Namespace -> Namespace -> Bool
compare :: Namespace -> Namespace -> Ordering
$ccompare :: Namespace -> Namespace -> Ordering
Ord, ReadPrec [Namespace]
ReadPrec Namespace
Int -> ReadS Namespace
ReadS [Namespace]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Namespace]
$creadListPrec :: ReadPrec [Namespace]
readPrec :: ReadPrec Namespace
$creadPrec :: ReadPrec Namespace
readList :: ReadS [Namespace]
$creadList :: ReadS [Namespace]
readsPrec :: Int -> ReadS Namespace
$creadsPrec :: Int -> ReadS Namespace
Read, Int -> Namespace -> String -> String
[Namespace] -> String -> String
Namespace -> String
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
showList :: [Namespace] -> String -> String
$cshowList :: [Namespace] -> String -> String
show :: Namespace -> String
$cshow :: Namespace -> String
showsPrec :: Int -> Namespace -> String -> String
$cshowsPrec :: Int -> Namespace -> String -> String
Show)

_Namespace :: Name
_Namespace = (String -> Name
Core.Name String
"hydra/module.Namespace")