Skip to content

Commit 856978e

Browse files
authored
Merge pull request #200 from citizennet/AS-1681/fix-warnings
AS-1681 Remove Compile Warnings
2 parents 1a0c5ee + 1a2be88 commit 856978e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+153
-164
lines changed

Makefile

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@ UI_GUIDE_DIR ?= $(ROOT_DIR)/ui-guide
1313
CLEAN_DEPS :=
1414
BUILD_DEPS := build-ui
1515
DEPS := $(BUILD_DIR)/.deps
16-
FIND_SRC_FILES_ARGS := \( -name '*.purs' -o -name '*.js' \) -type f
16+
FIND_SRC_FILES_ARGS := -name '*.purs' -type f
1717
NODE_MODULES := $(ROOT_DIR)/node_modules/.stamp
1818
PACKAGE_JSON := $(ROOT_DIR)/package.json
19+
PSA_ARGS ?= --censor-lib --stash=$(BUILD_DIR)/.psa_stash --is-lib=.spago --strict --censor-codes=UserDefinedWarning
1920
SRC_FILES := $(shell find $(SRC_DIR) $(FIND_SRC_FILES_ARGS))
2021
TEST_FILES := $(shell find $(TEST_DIR) $(FIND_SRC_FILES_ARGS))
2122
UI_GUIDE_FILES := $(shell find $(UI_GUIDE_DIR) $(FIND_SRC_FILES_ARGS))
@@ -25,7 +26,7 @@ YARN_LOCK := $(ROOT_DIR)/yarn.lock
2526
CYAN := \033[0;36m
2627
RESET := \033[0;0m
2728

28-
YARN := cd $(ROOT_DIR) && yarn
29+
NPX := cd $(ROOT_DIR) && npx
2930

3031
-include $(ROOT_DIR)/css/Makefile
3132

@@ -45,7 +46,7 @@ $(BUILD_DIR)/help: $(BUILD_DIR)/help-unsorted | $(BUILD_DIR)
4546
@sort $< > $@
4647

4748
$(BUILD_DIR)/test.js: $(OUTPUT_DIR)/Test.Main/index.js | $(BUILD_DIR)
48-
$(YARN) run purs bundle \
49+
$(NPX) purs bundle \
4950
$(RTS_ARGS) \
5051
$(OUTPUT_DIR)/*/*.js \
5152
--main Test.Main \
@@ -57,29 +58,29 @@ $(BUILD_DIR)/test.out: $(BUILD_DIR)/test.js
5758
mv $@.tmp $@ # Move the output where it belongs.
5859

5960
$(DEPS): packages.dhall spago.dhall $(NODE_MODULES) | $(BUILD_DIR)
60-
$(YARN) run spago install $(RTS_ARGS)
61-
touch $@
61+
$(NPX) spago install $(RTS_ARGS)
62+
$(NPX) spago sources | sed -e "s/\(.*\)/'\1'/" | tr '\n' ' ' > $(DEPS)
6263

6364
$(DIST_DIR)/bundled.js: $(OUTPUT_DIR)/Main/index.js
64-
$(YARN) run purs bundle \
65+
$(NPX) purs bundle \
6566
$(RTS_ARGS) \
6667
$(OUTPUT_DIR)/*/*.js \
6768
--main Main \
6869
--module Main \
6970
--output $@
7071

7172
$(DIST_DIR)/index.js: $(OUTPUT_DIR)/Main/index.js
72-
$(YARN) run browserify dist/main.js --outfile $@
73+
$(NPX) browserify dist/main.js --outfile $@
7374

7475
$(NODE_MODULES): $(PACKAGE_JSON) $(YARN_LOCK)
75-
$(YARN) install
76+
$(NPX) yarn install
7677
touch $@
7778

78-
$(OUTPUT_DIR)/Main/index.js: $(SRC_FILES) $(UI_GUIDE_FILES) $(DEPS)
79-
$(YARN) run spago build -p "$(UI_GUIDE_DIR)/**/*.purs" -u "$(RTS_ARGS)"
79+
$(OUTPUT_DIR)/Main/index.js: $(DEPS) $(SRC_FILES) $(UI_GUIDE_FILES)
80+
$(NPX) psa $(PSA_ARGS) $(RTS_ARGS) $(shell cat $(DEPS)) $(UI_GUIDE_FILES)
8081

81-
$(OUTPUT_DIR)/Test.Main/index.js: $(SRC_FILES) $(TEST_FILES) $(DEPS)
82-
$(YARN) run spago build -p "$(TEST_DIR)/Main.purs $(TEST_DIR)/Test/**/*.purs" -u "$(RTS_ARGS)"
82+
$(OUTPUT_DIR)/Test.Main/index.js: $(DEPS) $(SRC_FILES) $(TEST_FILES)
83+
$(NPX) psa $(PSA_ARGS) $(RTS_ARGS) $(shell cat $(DEPS))
8384

8485
.PHONY: build
8586
build: $(BUILD_DEPS) ## Build everything — all the CSS, and the UI Guide — installing any missing dependencies along the way

css/Makefile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ DIST_CSS_DEV_SCOPED := $(DIST_DIR)/$(DIST_CSS_FILENAME).scoped.css
1313
DIST_CSS_PROD_GLOBAL := $(DIST_DIR)/$(DIST_CSS_FILENAME).min.css
1414
DIST_CSS_PROD_SCOPED := $(DIST_DIR)/$(DIST_CSS_FILENAME).scoped.min.css
1515

16-
CSS_YARN := cd $(CSS_DIR) && yarn
16+
CSS_NPX := cd $(CSS_DIR) && npx
1717

1818
.DEFAULT_GOAL := build-css
1919

@@ -23,20 +23,20 @@ BUILD_DEPS += build-css
2323
CLEAN_DEPS += clean-css
2424

2525
$(CSS_NODE_MODULES): $(CSS_PACKAGE_JSON) $(CSS_YARN_LOCK)
26-
$(CSS_YARN) install
26+
$(CSS_NPX) yarn install
2727
touch $@
2828

2929
$(DIST_CSS_DEV_GLOBAL): $(CSS_NODE_MODULES) | $(DIST_DIR)
30-
$(CSS_YARN) run webpack
30+
$(CSS_NPX) webpack
3131

3232
$(DIST_CSS_DEV_SCOPED): $(CSS_NODE_MODULES) | $(DIST_DIR)
33-
$(CSS_YARN) run webpack --env=scoped
33+
$(CSS_NPX) webpack --env=scoped
3434

3535
$(DIST_CSS_PROD_GLOBAL): $(CSS_NODE_MODULES) | $(DIST_DIR)
36-
$(CSS_YARN) run webpack --env=prod
36+
$(CSS_NPX) webpack --env=prod
3737

3838
$(DIST_CSS_PROD_SCOPED): $(CSS_NODE_MODULES) | $(DIST_DIR)
39-
$(CSS_YARN) run webpack --env=prod,scoped
39+
$(CSS_NPX) webpack --env=prod,scoped
4040

4141
$(DIST_DIR):
4242
mkdir -p $@
@@ -69,4 +69,4 @@ clean-css: ## Remove all CSS dependencies and build artifacts, starting over wit
6969
$(DIST_CSS_DEV_GLOBAL) \
7070
$(DIST_CSS_DEV_SCOPED) \
7171
$(DIST_CSS_PROD_GLOBAL) \
72-
$(DIST_CSS_PROD_SCOPED)
72+
$(DIST_CSS_PROD_SCOPED)

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"parcel": "1.12.4",
1515
"parcel-bundler": "1.12.3",
1616
"purescript": "0.14.3",
17+
"purescript-psa": "0.8.2",
1718
"spago": "^0.15.2"
1819
},
1920
"dependencies": {

src/Blocks/Expandable.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ instance read :: Read Status where
2626
read = case _ of
2727
"collapsed" -> pure Collapsed
2828
"expanded" -> pure Expanded
29-
otherwise -> Nothing
29+
_ -> Nothing
3030

3131
instance isPropStatus :: IsProp Status where
3232
toPropValue = propFromString <<< toProp

src/Blocks/Pager.purs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import Prelude
55
import DOM.HTML.Indexed (HTMLdiv)
66
import Data.Array ((..))
77
import Data.FoldableWithIndex (foldlWithIndex)
8-
import Data.Maybe (Maybe)
98
import Foreign.Object as Foreign.Object
109
import Halogen.HTML as HH
1110
import Halogen.HTML.Core (ClassName(..))
@@ -44,17 +43,17 @@ pager skip last query =
4443
foldlWithIndex makePagingButtons' [] makeList
4544

4645
makePagingButtons' :: Int -> Array (HH.HTML p i) -> Int -> Array (HH.HTML p i)
47-
makePagingButtons' 0 btns btn =
46+
makePagingButtons' 0 _ btn =
4847
(if skip == 1 then [] else [backArrow]) <> [button btn]
4948
makePagingButtons' 1 btns btn | btn /= 2 =
5049
btns <> [ellipsis] <> [button btn]
51-
makePagingButtons' idx btns btn | btn == last && last < 7 && skip /= last =
50+
makePagingButtons' _ btns btn | btn == last && last < 7 && skip /= last =
5251
btns <> [button btn] <> [forwardArrow]
53-
makePagingButtons' idx btns btn | btn == last && last < 7 =
52+
makePagingButtons' _ btns btn | btn == last && last < 7 =
5453
btns <> [button btn]
55-
makePagingButtons' idx btns btn | btn == last && skip < (last - 3) =
54+
makePagingButtons' _ btns btn | btn == last && skip < (last - 3) =
5655
btns <> [ellipsis] <> [button btn] <> [forwardArrow]
57-
makePagingButtons' idx btns btn | btn == last =
56+
makePagingButtons' _ btns btn | btn == last =
5857
btns <> [button btn] <> (if skip == last then [] else [forwardArrow])
5958
makePagingButtons' _ btns btn =
6059
btns <> [button btn]
@@ -122,17 +121,17 @@ makePagingButtonsNew skip last query = foldlWithIndex makePagingButtons' [] make
122121
makeList = [1] <> (skip - 2) .. (skip + 2) <> [last]
123122

124123
makePagingButtons' :: Int -> Array (HH.HTML p i) -> Int -> Array (HH.HTML p i)
125-
makePagingButtons' 0 btns btn =
124+
makePagingButtons' 0 _ btn =
126125
(if skip == 1 then [] else [backArrow]) <> [button btn]
127126
makePagingButtons' 1 btns btn | btn /= 2 =
128127
btns <> [ellipsis] <> [button btn]
129-
makePagingButtons' idx btns btn | btn == last && last < 7 && skip /= last =
128+
makePagingButtons' _ btns btn | btn == last && last < 7 && skip /= last =
130129
btns <> [button btn] <> [forwardArrow]
131-
makePagingButtons' idx btns btn | btn == last && last < 7 =
130+
makePagingButtons' _ btns btn | btn == last && last < 7 =
132131
btns <> [button btn]
133-
makePagingButtons' idx btns btn | btn == last && skip < (last - 3) =
132+
makePagingButtons' _ btns btn | btn == last && skip < (last - 3) =
134133
btns <> [ellipsis] <> [button btn] <> [forwardArrow]
135-
makePagingButtons' idx btns btn | btn == last =
134+
makePagingButtons' _ btns btn | btn == last =
136135
btns <> [button btn] <> (if skip == last then [] else [forwardArrow])
137136
makePagingButtons' _ btns btn =
138137
btns <> [button btn]

src/Components/MultiInput/Component.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ data Action
6868
| Receive Input
6969
| RemoveOne Int
7070

71-
data Query a
71+
data Query (a :: Type)
7272
= GetItems (Array String -> a)
7373
| SetItems (Array String) a
7474
| SelectItem String a

src/Components/MultiInput/TextWidth.purs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,18 @@ type State =
3737
data Action
3838
= Receive Input
3939

40-
data Query a
40+
data Query (a :: Type)
4141
= GetWidth String (Number -> a)
4242

4343
type Input =
4444
{ renderText :: String -> Halogen.HTML.PlainHTML
4545
}
4646

47-
type Output =
48-
Void
47+
type Output
48+
= Void
4949

50-
type ChildSlots =
51-
()
50+
type ChildSlots
51+
= () :: Row Type
5252

5353
component ::
5454
forall m.

src/Components/SearchBar.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ data Action
4141
| Open
4242
| Blur
4343

44-
data Query a
44+
data Query (a :: Type)
4545
= SetText String a
4646

4747
type Slot = H.Slot Query Message

src/Data/Currency.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ parseCentsFromDollarStr str = Cents <$> case split (Pattern ".") str of
8686
=<< (+) <$> dollarsPlace dollars <*> BigInt.fromString (take 2 $ cents <> "0")
8787

8888
-- Unable to parse
89-
otherwise -> Nothing
89+
_ -> Nothing
9090

9191
where
9292
-- Expects only the dollars place, no cents. Cents will overstate

src/Data/DateTime.purs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,12 @@ adjustDaysBy n = unsafePartial fromJust <<< next n
112112
nextMonth :: Date -> Date
113113
nextMonth d = case (month d) of
114114
December -> canonicalDate (unsafeSucc (year d)) January (day d)
115-
other -> canonicalDate (year d) (unsafeSucc (month d)) (day d)
115+
_ -> canonicalDate (year d) (unsafeSucc (month d)) (day d)
116116

117117
prevMonth :: Date -> Date
118118
prevMonth d = case (month d) of
119119
January -> canonicalDate (unsafePred (year d)) December (day d)
120-
other -> canonicalDate (year d) (unsafePred (month d)) (day d)
120+
_ -> canonicalDate (year d) (unsafePred (month d)) (day d)
121121

122122
-- Years
123123
-- Note: Attempts to preserve the same day, but due to the use of

0 commit comments

Comments
 (0)