diff --git a/phantom-type-tests/No_Project_Rule_Without_Visitors.txt b/phantom-type-tests/No_Project_Rule_Without_Visitors.txt index 57ed0225..8d40e538 100644 --- a/phantom-type-tests/No_Project_Rule_Without_Visitors.txt +++ b/phantom-type-tests/No_Project_Rule_Without_Visitors.txt @@ -8,20 +8,20 @@ This function cannot handle the argument sent through the (|>) pipe: The argument is: Rule.ProjectRuleSchema + { canAddModuleVisitor : (), withModuleContext : Rule.Forbidden } () moduleContext - { canAddModuleVisitor : (), withModuleContext : Rule.Forbidden } But (|>) is piping it to a function that expects: Rule.ProjectRuleSchema - () - moduleContext { a | canAddModuleVisitor : () , hasAtLeastOneVisitor : () , withModuleContext : Rule.Forbidden } + () + moduleContext Hint: Seems like a record field typo. Maybe hasAtLeastOneVisitor should be canAddModuleVisitor? diff --git a/phantom-type-tests/No_WithModuleContext_Without_WithModuleVisitor.txt b/phantom-type-tests/No_WithModuleContext_Without_WithModuleVisitor.txt index c8d7e5f9..99df73f2 100644 --- a/phantom-type-tests/No_WithModuleContext_Without_WithModuleVisitor.txt +++ b/phantom-type-tests/No_WithModuleContext_Without_WithModuleVisitor.txt @@ -12,14 +12,14 @@ This function cannot handle the argument sent through the (|>) pipe: The argument is: Rule.ProjectRuleSchema - () - () { canAddModuleVisitor : (), withModuleContext : Rule.Forbidden } + () + () But (|>) is piping it to a function that expects: Rule.ProjectRuleSchema - () - () { canAddModuleVisitor : (), withModuleContext : Rule.Required } + () + () diff --git a/phantom-type-tests/No_WithModuleVisitor_After_WithModuleContext.txt b/phantom-type-tests/No_WithModuleVisitor_After_WithModuleContext.txt index 3cfe4c7c..117d4f5d 100644 --- a/phantom-type-tests/No_WithModuleVisitor_After_WithModuleContext.txt +++ b/phantom-type-tests/No_WithModuleVisitor_After_WithModuleContext.txt @@ -14,20 +14,20 @@ This function cannot handle the argument sent through the (|>) pipe: The argument is: Rule.ProjectRuleSchema - () - () { hasAtLeastOneVisitor : (), withModuleContext : Rule.Forbidden } + () + () But (|>) is piping it to a function that expects: Rule.ProjectRuleSchema - () - () { a | canAddModuleVisitor : () , hasAtLeastOneVisitor : () , withModuleContext : Rule.Forbidden } + () + () Hint: Seems like a record field typo. Maybe canAddModuleVisitor should be hasAtLeastOneVisitor? diff --git a/phantom-type-tests/No_WithModuleVisitor_Without_WithModuleContext.txt b/phantom-type-tests/No_WithModuleVisitor_Without_WithModuleContext.txt index b501b8ea..f968c814 100644 --- a/phantom-type-tests/No_WithModuleVisitor_Without_WithModuleContext.txt +++ b/phantom-type-tests/No_WithModuleVisitor_Without_WithModuleContext.txt @@ -9,20 +9,20 @@ This function cannot handle the argument sent through the (|>) pipe: The argument is: Rule.ProjectRuleSchema - () - () { canAddModuleVisitor : (), withModuleContext : Rule.Forbidden } + () + () But (|>) is piping it to a function that expects: Rule.ProjectRuleSchema - () - () { a | canAddModuleVisitor : () , hasAtLeastOneVisitor : () , withModuleContext : Rule.Forbidden } + () + () Hint: Seems like a record field typo. Maybe hasAtLeastOneVisitor should be canAddModuleVisitor? diff --git a/phantom-type-tests/WithModuleContext_AtMostOnce.txt b/phantom-type-tests/WithModuleContext_AtMostOnce.txt index 5ceb29f8..52b104f8 100644 --- a/phantom-type-tests/WithModuleContext_AtMostOnce.txt +++ b/phantom-type-tests/WithModuleContext_AtMostOnce.txt @@ -18,20 +18,20 @@ This function cannot handle the argument sent through the (|>) pipe: The argument is: Rule.ProjectRuleSchema - () - () { hasAtLeastOneVisitor : (), withModuleContext : Rule.Forbidden } + () + () But (|>) is piping it to a function that expects: Rule.ProjectRuleSchema - () - () { a | canAddModuleVisitor : () , hasAtLeastOneVisitor : () , withModuleContext : Rule.Required } + () + () Hint: Seems like a record field typo. Maybe canAddModuleVisitor should be hasAtLeastOneVisitor? diff --git a/src/Review/Rule.elm b/src/Review/Rule.elm index 9f88ebb2..79d85fcb 100644 --- a/src/Review/Rule.elm +++ b/src/Review/Rule.elm @@ -716,7 +716,7 @@ See the documentation for [`newProjectRuleSchema`](#newProjectRuleSchema) for how to create a project rule. -} -type ProjectRuleSchema projectContext moduleContext schemaState +type ProjectRuleSchema schemaState projectContext moduleContext = ProjectRuleSchema { name : String , initialProjectContext : projectContext @@ -770,7 +770,7 @@ Evaluating/visiting a node means two things: part of the traversal evaluation. -} -newProjectRuleSchema : String -> projectContext -> ProjectRuleSchema projectContext moduleContext { canAddModuleVisitor : (), withModuleContext : Forbidden } +newProjectRuleSchema : String -> projectContext -> ProjectRuleSchema { canAddModuleVisitor : (), withModuleContext : Forbidden } projectContext moduleContext newProjectRuleSchema name_ initialProjectContext = ProjectRuleSchema { name = name_ @@ -786,7 +786,7 @@ newProjectRuleSchema name_ initialProjectContext = {-| Create a [`Rule`](#Rule) from a configured [`ProjectRuleSchema`](#ProjectRuleSchema). -} -fromProjectRuleSchema : ProjectRuleSchema projectContext moduleContext { schemaState | withModuleContext : Forbidden, hasAtLeastOneVisitor : () } -> Rule +fromProjectRuleSchema : ProjectRuleSchema { schemaState | withModuleContext : Forbidden, hasAtLeastOneVisitor : () } projectContext moduleContext -> Rule fromProjectRuleSchema (ProjectRuleSchema schema) = Rule schema.name Exceptions.init @@ -820,8 +820,8 @@ in order to specify how to create a `moduleContext` from a `projectContext` and -} withModuleVisitor : (ModuleRuleSchema {} moduleContext -> ModuleRuleSchema { moduleSchemaState | hasAtLeastOneVisitor : () } moduleContext) - -> ProjectRuleSchema projectContext moduleContext { projectSchemaState | canAddModuleVisitor : () } - -> ProjectRuleSchema projectContext moduleContext { projectSchemaState | canAddModuleVisitor : (), withModuleContext : Required } + -> ProjectRuleSchema { projectSchemaState | canAddModuleVisitor : () } projectContext moduleContext + -> ProjectRuleSchema { projectSchemaState | canAddModuleVisitor : (), withModuleContext : Required } projectContext moduleContext withModuleVisitor visitor (ProjectRuleSchema schema) = let previousModuleVisitors : List (ModuleRuleSchema {} moduleContext -> ModuleRuleSchema { hasAtLeastOneVisitor : () } moduleContext) @@ -1098,8 +1098,8 @@ withModuleContext : , fromModuleToProject : ModuleKey -> Node ModuleName -> moduleContext -> projectContext , foldProjectContexts : projectContext -> projectContext -> projectContext } - -> ProjectRuleSchema projectContext moduleContext { schemaState | canAddModuleVisitor : (), withModuleContext : Required } - -> ProjectRuleSchema projectContext moduleContext { schemaState | hasAtLeastOneVisitor : (), withModuleContext : Forbidden } + -> ProjectRuleSchema { schemaState | canAddModuleVisitor : (), withModuleContext : Required } projectContext moduleContext + -> ProjectRuleSchema { schemaState | hasAtLeastOneVisitor : (), withModuleContext : Forbidden } projectContext moduleContext withModuleContext moduleContext (ProjectRuleSchema schema) = let visitors : List (ModuleRuleSchema {} moduleContext -> ModuleRuleSchema { hasAtLeastOneVisitor : () } moduleContext) @@ -1126,8 +1126,8 @@ The visitor will be called before any module is evaluated. -} withElmJsonProjectVisitor : (Maybe { elmJsonKey : ElmJsonKey, project : Elm.Project.Project } -> projectContext -> ( List Error, projectContext )) - -> ProjectRuleSchema projectContext moduleContext schemaState - -> ProjectRuleSchema projectContext moduleContext { schemaState | hasAtLeastOneVisitor : () } + -> ProjectRuleSchema schemaState projectContext moduleContext + -> ProjectRuleSchema { schemaState | hasAtLeastOneVisitor : () } projectContext moduleContext withElmJsonProjectVisitor visitor (ProjectRuleSchema schema) = ProjectRuleSchema { schema | elmJsonVisitors = visitor :: schema.elmJsonVisitors } @@ -1141,8 +1141,8 @@ The visitor will be called before any module is evaluated. -} withReadmeProjectVisitor : (Maybe { readmeKey : ReadmeKey, content : String } -> projectContext -> ( List Error, projectContext )) - -> ProjectRuleSchema projectContext moduleContext schemaState - -> ProjectRuleSchema projectContext moduleContext { schemaState | hasAtLeastOneVisitor : () } + -> ProjectRuleSchema schemaState projectContext moduleContext + -> ProjectRuleSchema { schemaState | hasAtLeastOneVisitor : () } projectContext moduleContext withReadmeProjectVisitor visitor (ProjectRuleSchema schema) = ProjectRuleSchema { schema | readmeVisitors = visitor :: schema.readmeVisitors } @@ -1156,8 +1156,8 @@ module is evaluated. -} withDependenciesProjectVisitor : (Dict String Review.Project.Dependency.Dependency -> projectContext -> ( List Error, projectContext )) - -> ProjectRuleSchema projectContext moduleContext schemaState - -> ProjectRuleSchema projectContext moduleContext { schemaState | hasAtLeastOneVisitor : () } + -> ProjectRuleSchema schemaState projectContext moduleContext + -> ProjectRuleSchema { schemaState | hasAtLeastOneVisitor : () } projectContext moduleContext withDependenciesProjectVisitor visitor (ProjectRuleSchema schema) = ProjectRuleSchema { schema | dependenciesVisitors = visitor :: schema.dependenciesVisitors } @@ -1175,8 +1175,8 @@ That means that if you call [`error`](#error), we won't know which module to ass -} withFinalProjectEvaluation : (projectContext -> List Error) - -> ProjectRuleSchema projectContext moduleContext schemaState - -> ProjectRuleSchema projectContext moduleContext schemaState + -> ProjectRuleSchema schemaState projectContext moduleContext + -> ProjectRuleSchema schemaState projectContext moduleContext withFinalProjectEvaluation visitor (ProjectRuleSchema schema) = ProjectRuleSchema { schema | finalEvaluationFns = visitor :: schema.finalEvaluationFns } @@ -1207,7 +1207,7 @@ and the analysis will be much faster, because we know other files won't influenc the results of other modules' analysis. -} -withContextFromImportedModules : ProjectRuleSchema projectContext moduleContext schemaState -> ProjectRuleSchema projectContext moduleContext schemaState +withContextFromImportedModules : ProjectRuleSchema schemaState projectContext moduleContext -> ProjectRuleSchema schemaState projectContext moduleContext withContextFromImportedModules (ProjectRuleSchema schema) = ProjectRuleSchema { schema | traversalType = ImportedModulesFirst } @@ -1220,7 +1220,7 @@ type alias ProjectRuleCache projectContext = } -runProjectRule : ProjectRuleSchema projectContext moduleContext schemaState -> ProjectRuleCache projectContext -> Exceptions -> Project -> List (Graph.NodeContext ModuleName ()) -> ( List Error, Rule ) +runProjectRule : ProjectRuleSchema schemaState projectContext moduleContext -> ProjectRuleCache projectContext -> Exceptions -> Project -> List (Graph.NodeContext ModuleName ()) -> ( List Error, Rule ) runProjectRule ((ProjectRuleSchema schema) as wrappedSchema) startCache exceptions project nodeContexts = let elmJsonData : Maybe { elmJsonKey : ElmJsonKey, project : Elm.Project.Project } @@ -1295,7 +1295,7 @@ runProjectRule ((ProjectRuleSchema schema) as wrappedSchema) startCache exceptio computeModules : - ProjectRuleSchema projectContext moduleContext schemaState + ProjectRuleSchema schemaState projectContext moduleContext -> { visitors : List (ModuleRuleSchema {} moduleContext -> ModuleRuleSchema { hasAtLeastOneVisitor : () } moduleContext) , moduleContext : ModuleContextFunctions projectContext moduleContext @@ -1518,7 +1518,7 @@ getModuleName module_ = |> Module.moduleName -errorsFromFinalEvaluationForProject : ProjectRuleSchema projectContext moduleContext schemaState -> projectContext -> List projectContext -> List Error +errorsFromFinalEvaluationForProject : ProjectRuleSchema schemaState projectContext moduleContext -> projectContext -> List projectContext -> List Error errorsFromFinalEvaluationForProject (ProjectRuleSchema schema) initialContext contextsPerModule = if List.isEmpty schema.finalEvaluationFns then [] diff --git a/src/Scope2.elm b/src/Scope2.elm index 79c970b9..d0215f76 100644 --- a/src/Scope2.elm +++ b/src/Scope2.elm @@ -167,8 +167,8 @@ emptyScope = addProjectVisitors : - Rule.ProjectRuleSchema { projectContext | scope : ProjectContext } { moduleContext | scope : ModuleContext } { schemaState | canAddModuleVisitor : () } - -> Rule.ProjectRuleSchema { projectContext | scope : ProjectContext } { moduleContext | scope : ModuleContext } { schemaState | canAddModuleVisitor : (), hasAtLeastOneVisitor : (), withModuleContext : Rule.Required } + Rule.ProjectRuleSchema { schemaState | canAddModuleVisitor : () } { projectContext | scope : ProjectContext } { moduleContext | scope : ModuleContext } + -> Rule.ProjectRuleSchema { schemaState | canAddModuleVisitor : (), hasAtLeastOneVisitor : (), withModuleContext : Rule.Required } { projectContext | scope : ProjectContext } { moduleContext | scope : ModuleContext } addProjectVisitors schema = schema |> Rule.withContextFromImportedModules