Skip to content

Commit

Permalink
Enable strict building on all packages (#1153)
Browse files Browse the repository at this point in the history
  • Loading branch information
f-f authored Dec 25, 2023
1 parent bcf3cd4 commit b450892
Show file tree
Hide file tree
Showing 22 changed files with 88 additions and 115 deletions.
1 change: 1 addition & 0 deletions bin/spago.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package:
version: 0.93.22
license: BSD-3-Clause
build:
strict: true
censor_project_warnings:
- WildcardInferredType
dependencies:
Expand Down
2 changes: 2 additions & 0 deletions core/spago.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package:
name: spago-core
build:
strict: true
dependencies:
- aff
- argonaut-core
Expand Down
2 changes: 2 additions & 0 deletions docs-search/client-halogen/spago.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ package:
- web-html
- web-storage
- web-uievents
build:
strict: true
bundle:
type: "app"
minify: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ handleQuery
:: forall a
. Query a
-> H.HalogenM State Action () SearchFieldMessage Aff (Maybe a)
handleQuery (ReadURIHash next) = do
handleQuery (ReadURIHash _next) = do
oldInput <- H.get <#> _.input
newInput <- H.liftEffect URIHash.getInput
when (oldInput /= newInput) do
Expand All @@ -85,7 +85,7 @@ handleAction = case _ of
(HTMLDocument.toEventTarget document)
(map (HandleKey sid) <<< KE.fromEvent)

HandleKey sid ev -> do
HandleKey _sid ev -> do

when (KE.code ev == "KeyS") do
state <- H.get
Expand Down
26 changes: 13 additions & 13 deletions docs-search/client-halogen/src/Docs/Search/App/SearchResults.purs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import Docs.Search.SearchResult (ResultInfo(..), SearchResult(..))
import Docs.Search.TypeDecoder (Constraint(..), Constraint', Type', Qualified(..), QualifiedBy(..), ProperName(..), Type(..), TypeArgument, ClassName, FunDeps)
import Docs.Search.TypeQuery as TypeQuery
import Docs.Search.TypeIndex (TypeIndex)
import Docs.Search.Types (Identifier(..), ModuleName(..), PackageName)
import Docs.Search.Types (Identifier, ModuleName(..), PackageName)
import Docs.Search.Meta (Meta)

import Prelude
Expand Down Expand Up @@ -95,15 +95,15 @@ handleQuery
:: forall o a
. Query a
-> H.HalogenM State Action () o Aff (Maybe a)
handleQuery (MessageFromSearchField Focused next) = do
handleQuery (MessageFromSearchField Focused _next) = do
pure Nothing
handleQuery (MessageFromSearchField LostFocus next) = do
handleQuery (MessageFromSearchField LostFocus _next) = do
pure Nothing
handleQuery (MessageFromSearchField InputCleared next) = do
handleQuery (MessageFromSearchField InputCleared _next) = do
H.modify_ (_ { results = [], input = "", mode = Off })
showPageContents
pure Nothing
handleQuery (MessageFromSearchField (InputUpdated input_) next) = do
handleQuery (MessageFromSearchField (InputUpdated input_) _next) = do
let input = String.trim input_

state <- H.modify (_ { input = input })
Expand Down Expand Up @@ -233,9 +233,9 @@ renderResult state (DeclResult r) =
renderSearchResult state r
renderResult state (TypeResult r) =
renderSearchResult state r
renderResult state (PackResult r) =
renderResult _state (PackResult r) =
renderPackageResult r
renderResult state (MdlResult r) =
renderResult _state (MdlResult r) =
renderModuleResult r

renderPackageResult
Expand Down Expand Up @@ -272,7 +272,7 @@ renderModuleResult
:: forall a
. ModuleResult
-> Array (HH.HTML a Action)
renderModuleResult { name, package } =
renderModuleResult { name, package: _ } =
[ HH.div [ HP.class_ (wrap "result") ]
[ HH.h3 [ HP.class_ (wrap "result__title") ]
[ HH.span
Expand Down Expand Up @@ -457,7 +457,7 @@ renderTypeClassMemberSignature
}
-> { name :: Identifier | rest }
-> Array (HH.HTML a Action)
renderTypeClassMemberSignature { type: ty, typeClass, typeClassArguments } result =
renderTypeClassMemberSignature { type: ty, typeClass: _, typeClassArguments: _ } result =
[ HH.text $ unwrap result.name
, HH.text " :: "
, renderType ty
Expand Down Expand Up @@ -507,8 +507,8 @@ renderTypeSynonymSignature { type: ty, arguments } { name } =
]

renderTypeArgument :: forall a. TypeArgument -> Array (HH.HTML a Action)
renderTypeArgument ({ name, kind }) =
case kind of
renderTypeArgument ({ name, kind: maybeKind }) =
case maybeKind of
Nothing ->
[ HH.text $ name ]
Just kind ->
Expand Down Expand Up @@ -614,8 +614,8 @@ renderForAll ty =
[ keyword "forall" ]
<>
( Array.fromFoldable foralls.binders <#>
\{ name, kind } ->
case kind of
\{ name, kind: maybeKind } ->
case maybeKind of
Nothing -> HH.text (" " <> name)
Just kind ->
HH.span_
Expand Down
4 changes: 2 additions & 2 deletions docs-search/client-halogen/src/Docs/Search/App/Sidebar.purs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ handleQuery
:: forall a i
. Query a
-> H.HalogenM State i () Action Aff (Maybe a)
handleQuery (UpdateModuleGrouping next) = do
handleQuery (UpdateModuleGrouping _next) = do
oldGroupingMode <- H.get <#> _.groupingMode
newGroupingMode <- H.liftEffect loadGroupingModeFromLocalStorage
when (oldGroupingMode /= newGroupingMode) do
Expand Down Expand Up @@ -201,7 +201,7 @@ getCurrentModuleName = do
getCurrentPackage :: ModuleIndex -> Maybe ModuleName -> PackageInfo
getCurrentPackage { modulePackages } (Just moduleName) =
fromMaybe UnknownPackage $ Map.lookup moduleName modulePackages
getCurrentPackage { modulePackages } Nothing = UnknownPackage
getCurrentPackage { modulePackages: _ } Nothing = UnknownPackage

-- | Convert checkbox status to sidebar mode
isCheckedToGroupingMode :: Boolean -> GroupingMode
Expand Down
5 changes: 5 additions & 0 deletions docs-search/common/spago.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
package:
name: docs-search-common
build:
strict: true
censor_project_warnings:
- ImplicitQualifiedImport
- ImplicitQualifiedImportReExport
dependencies:
- aff
- aff-promise
Expand Down
4 changes: 1 addition & 3 deletions docs-search/common/src/Docs/Search/Config.purs
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
module Docs.Search.Config where

import Docs.Search.Types (GlobalIdentifier, PackageName, PartId(..), URL, FilePath)

import Prelude

import Data.Char as Char
import Data.List (List, (:))
import Data.List as List
import Data.Newtype (wrap)
import Docs.Search.Types (GlobalIdentifier, PackageName, PartId(..), URL, FilePath)

version :: String
version = "0.0.12"
Expand Down
10 changes: 5 additions & 5 deletions docs-search/common/src/Docs/Search/Declarations.purs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ mkDeclarations scores = Declarations <<< foldr (insertDocModule scores) mempty
-> Trie Char (List SearchResult)
-> Trie Char (List SearchResult)

insertDocModule scores (DocModule { name, declarations }) trie =
insertDocModule _scores (DocModule { name, declarations }) trie =
foldr (insertDeclaration scores name) trie declarations

insertDeclaration
Expand All @@ -55,7 +55,7 @@ insertDeclaration
-> Declaration
-> Trie Char (List SearchResult)
-> Trie Char (List SearchResult)
insertDeclaration scores moduleName entry@(Declaration { title }) trie = foldr insertSearchResult trie (resultsForDeclaration scores moduleName entry)
insertDeclaration scores moduleName entry@(Declaration { title: _ }) trie = foldr insertSearchResult trie (resultsForDeclaration scores moduleName entry)

insertSearchResult
:: { path :: String
Expand Down Expand Up @@ -120,7 +120,7 @@ resultsForDeclaration scores moduleName indexEntry@(Declaration entry) =
_ -> Nothing

mkInfo :: DeclLevel -> Declaration -> Maybe ResultInfo
mkInfo declLevel (Declaration { info, title }) =
mkInfo declLevel (Declaration { info, title: _ }) =
case info of
ValueDeclaration ty ->
Just $ ValueResult { type: ty }
Expand Down Expand Up @@ -195,7 +195,7 @@ getLevelAndName (Declaration { info, title }) =
) title
)

ExternDataDeclaration _ kind ->
ExternDataDeclaration _ _kind ->
{ name: title, declLevel: TypeLevel }

-- | Extract package name from `sourceSpan.name`, which contains path to
Expand Down Expand Up @@ -228,7 +228,7 @@ resultsForChildDeclaration
packageInfo
moduleName
parentResult
child@(ChildDeclaration { title, info, comments, sourceSpan })
child@(ChildDeclaration { title, info: _, comments, sourceSpan })
| Just resultInfo <- mkChildInfo parentResult child =
{ path: title
, result: SearchResult
Expand Down
7 changes: 2 additions & 5 deletions docs-search/common/src/Docs/Search/Engine.purs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ getResultPackageInfo (MdlResult r) = r.package
getResultModuleName :: Result -> ModuleName
getResultModuleName (DeclResult r) = (unwrap r).moduleName
getResultModuleName (TypeResult r) = (unwrap r).moduleName
getResultModuleName (PackResult r) = ModuleName ""
getResultModuleName (PackResult _r) = ModuleName ""
getResultModuleName (MdlResult r) = r.name

getResultName :: Result -> String
Expand All @@ -79,10 +79,7 @@ getResultName (TypeResult r) = unwrap (unwrap r).name
getResultName (PackResult r) = unwrap r.name
getResultName (MdlResult r) = unwrap r.name

sortByPopularity
:: forall index typeIndex
. Array Result
-> Array Result
sortByPopularity :: Array Result -> Array Result
sortByPopularity =
Array.sortBy
( compare `on` (getResultScore >>> negate)
Expand Down
13 changes: 5 additions & 8 deletions docs-search/common/src/Docs/Search/JsonCodec.purs
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,15 @@ module Docs.Search.JsonCodec
) where

import Prelude
import Prim.Row (class Cons)

import Prim.Row (class Cons)
import Codec.Json.Unidirectional.Value (DecodeError, printDecodeError)
import Data.Argonaut.Core (Json, fromString, stringify)
import Data.Codec.Argonaut (JsonCodec, JsonDecodeError(..))
import Data.Codec.Argonaut.Common as CA
import Data.Codec.Argonaut.Sum as CAS
import Data.Codec.Argonaut.Record as CAR
import Data.Either (Either(..))
import Data.Argonaut.Core (Json)
import Data.Codec.Argonaut (JsonDecodeError(..))
import Data.Either (Either)
import Data.Profunctor.Choice (left)
import Data.Symbol (class IsSymbol)
import Data.Variant
import Data.Variant (Variant, inj)
import Type.Proxy (Proxy(..))

-- | Equivalent to `Data.Variant.inj`, just uses a Visible Type Application instead of Proxy
Expand Down
11 changes: 4 additions & 7 deletions docs-search/common/src/Docs/Search/Meta.purs
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
module Docs.Search.Meta where

import Prelude

import Data.Codec.Argonaut (JsonCodec)
import Data.Codec.Argonaut.Record as CAR
import Docs.Search.Config as Config
import Docs.Search.Loader as Loader
import Docs.Search.Types (PackageName)
import Docs.Search.Types as Package

import Data.Codec.Argonaut (JsonCodec, JsonDecodeError)
import Data.Codec.Argonaut.Common as CA
import Data.Codec.Argonaut.Record as CAR

import Prelude

import Effect.Aff (Aff, catchError)

type Meta =
Expand Down
6 changes: 1 addition & 5 deletions docs-search/common/src/Docs/Search/Score.purs
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
module Docs.Search.Score where

import Docs.Search.Types (PackageName(..), PackageInfo(..), PackageScore(..))

import Prelude

import Data.Array as Array
import Data.Map (Map)
import Data.Map as Map
import Data.Maybe (fromMaybe)
import Data.Newtype (unwrap, wrap)
import Data.String.CodeUnits as String
import Data.Tuple (Tuple(..))
import Data.Tuple as Tuple
import Docs.Search.Types (PackageInfo(..), PackageName, PackageScore(..))
import Safe.Coerce (coerce)
import Web.Bower.PackageMeta as Bower

Expand Down
21 changes: 8 additions & 13 deletions docs-search/common/src/Docs/Search/SearchResult.purs
Original file line number Diff line number Diff line change
@@ -1,28 +1,23 @@
module Docs.Search.SearchResult where

import Docs.Search.JsonCodec (inject)
import Docs.Search.DocsJson as Docs
import Docs.Search.TypeDecoder (Constraint, FunDeps, QualifiedName, Type, TypeArgument)
import Docs.Search.Types (Identifier(..), ModuleName, PackageInfo, PackageScore)
import Docs.Search.Types as Package
import Docs.Search.TypeDecoder (Constraint', Qualified, Type, TypeArgument, FunDeps, Type', ProperName(..), ClassName(..))
import Docs.Search.TypeDecoder as TypeDecoder
import Docs.Search.JsonCodec as JsonCodec
import Docs.Search.DocTypes (DataDeclType, SourceSpan)
import Docs.Search.Types (ModuleName, PackageInfo, Identifier, PackageScore)

import Prelude

import Data.Codec.Argonaut (JsonCodec, JsonDecodeError)
import Data.Codec.Argonaut (JsonCodec)
import Data.Codec.Argonaut.Common as CA
import Data.Codec.Argonaut.Record as CAR
import Data.Codec.Argonaut.Variant as CAV
import Data.Either (Either(..))
import Data.Maybe (Maybe(..))
import Data.Newtype (class Newtype, un)
import Data.Profunctor (wrapIso, dimap)
import Data.Tuple (Tuple)
import Data.Variant as Variant
import Docs.Search.DocTypes (DataDeclType, SourceSpan)
import Docs.Search.DocsJson as Docs
import Docs.Search.JsonCodec (inject)
import Docs.Search.TypeDecoder (ClassName, Constraint', FunDeps, ProperName, Qualified, Type', TypeArgument)
import Docs.Search.TypeDecoder as TypeDecoder
import Docs.Search.Types (Identifier(..), ModuleName, PackageInfo, PackageScore)
import Docs.Search.Types as Package

-- | Metadata that makes sense only for certain types of search results.
data ResultInfo
Expand Down
18 changes: 6 additions & 12 deletions docs-search/common/src/Docs/Search/TypeDecoder.purs
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,19 @@ module Docs.Search.TypeDecoder
, constraintCodec
) where

import Docs.Search.DocTypes as ReExport

import Docs.Search.Types (Identifier)
import Docs.Search.DocTypes (Type', Type(..), Constraint(..), Label(..), DataDeclType, ProperName(..), Qualified(..))
import Docs.Search.DocTypes as DocTypes
import Docs.Search.JsonCodec as JsonCodec

import Prelude
import Prim hiding (Constraint)

import Codec.Json.Unidirectional.Value as Json
import Data.Argonaut.Core as Argonaut
import Data.Codec.Argonaut (JsonCodec)
import Data.Codec.Argonaut.Common as CA
import Data.Codec.Argonaut.Record as CAR
import Data.List (List(..), (:))
import Data.List as List
import Data.Maybe (Maybe(..))
import Data.Newtype (wrap)
import Data.Maybe (Maybe)
import Data.Tuple (Tuple)
import Docs.Search.DocTypes (AnyOpName, ChildDeclaration(..), ChildDeclarationInfo(..), ClassName, Constraint(..), Constraint', ConstraintData(..), ConstructorName, DataDeclType(..), Declaration(..), DeclarationInfo(..), DocLink(..), DocModule(..), GithubRepo(..), GithubUser(..), Ident(..), InPackage(..), InternalIdentData(..), KindInfo(..), Label(..), LinkLocation(..), LinksContext(..), ManifestError(..), ModuleName(..), Name(..), Namespace, NotYetKnown(..), OpName(..), OpNameType, Package(..), PackageError(..), ProperName(..), ProperNameType, Qualified(..), QualifiedBy(..), RowListItem(..), SkolemScope(..), SourceAnn(..), SourceConstraint, SourcePos(..), SourceSpan(..), SourceType, Type(..), Type', TypeName, TypeOpName, TypeVarVisibility(..), UploadedPackage, ValueOpName, VerifiedPackage, WildcardData(..), _ss, _sss, byNullSourcePos, compareConstraint, compareMaybeType, compareType, eqConstraint, eqMaybeType, eqType, fromChildDeclaration, fromChildDeclarationInfo, fromConstraint, fromConstraintData, fromDataDeclType, fromDeclaration, fromDeclarationInfo, fromDocModule, fromGithubRepo, fromGithubUser, fromISO8601, fromIdent, fromInPackage, fromInternalIdentData, fromKindInfo, fromLabel, fromModuleName, fromNotYetKnown, fromOpName, fromPackage, fromProperName, fromQualified, fromQualifiedBy, fromSkolemScope, fromSourceAnn, fromSourcePos, fromSourceSpan, fromType, fromTypeVarVisibility, fromVersion, fromWildcardData, hh_mm, kindType, nullSourceAnn, nullSourcePos, nullSourceSpan, showDataDeclType, srcTypeConstructor, toAsConstrantUnit, toChildDeclaration, toChildDeclarationInfo, toConstraint', toConstraintData, toConstraintUnit, toDataDeclType, toDeclaration, toDeclarationInfo, toDocModule, toFunDeps, toGithubRepo, toGithubUser, toISO8601, toIdent, toInPackage, toInternalIdentData, toKindInfo, toLabel, toModuleName, toNotYetKnown, toOpName, toPackage, toProperName, toQualified, toQualifiedBy, toSkolemScope, toSourceAnn, toSourceConstraint, toSourcePos, toSourceSpan, toSourceType, toType', toTypeArguments, toTypeUnit, toTypeVarVisibility, toUploadedPackage, toVersion, toWildcardData, yyyy_mm_dd) as ReExport
import Docs.Search.DocTypes (Constraint, DataDeclType, ProperName, Qualified, Type')
import Docs.Search.DocTypes as DocTypes
import Docs.Search.JsonCodec as JsonCodec

type QualifiedName tag = Qualified (ProperName tag)

Expand Down
Loading

0 comments on commit b450892

Please sign in to comment.