Skip to content

Commit 446c753

Browse files
Prep repo for breaking changes (#31)
* Update CI node, actions versions; enforce formatting * Format via purs-tidy
1 parent fbe80a9 commit 446c753

File tree

3 files changed

+23
-17
lines changed

3 files changed

+23
-17
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,16 @@ jobs:
1010
build:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v2
13+
- uses: actions/checkout@v3
1414

1515
- uses: purescript-contrib/setup-purescript@main
1616
with:
1717
purescript: "unstable"
18+
purs-tidy: "latest"
1819

19-
- uses: actions/setup-node@v2
20+
- uses: actions/setup-node@v3
2021
with:
21-
node-version: "14"
22+
node-version: "lts/*"
2223

2324
- name: Install dependencies
2425
run: |
@@ -33,3 +34,8 @@ jobs:
3334
run: |
3435
bower install
3536
npm run-script test --if-present
37+
38+
- name: Check Formatting
39+
if: runner.os == 'Linux'
40+
run: |
41+
npx purs-tidy check src

src/Node/ReadLine.purs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ historySize = opt "historySize"
5555
-- |
5656
-- | This function takes the partial command as input, and returns a collection of
5757
-- | completions, as well as the matched portion of the input string.
58-
type Completer
59-
= String
58+
type Completer =
59+
String
6060
-> Effect
61-
{ completions :: Array String
62-
, matched :: String
63-
}
61+
{ completions :: Array String
62+
, matched :: String
63+
}
6464

6565
-- | Builds an interface with the specified options.
6666
createInterface
@@ -69,15 +69,16 @@ createInterface
6969
-> Options InterfaceOptions
7070
-> Effect Interface
7171
createInterface input opts = createInterfaceImpl
72-
$ options $ opts
73-
<> opt "input" := input
72+
$ options
73+
$ opts
74+
<> opt "input" := input
7475

7576
-- | Create an interface with the specified completion function.
7677
createConsoleInterface :: Completer -> Effect Interface
7778
createConsoleInterface compl =
7879
createInterface stdin
7980
$ output := stdout
80-
<> completer := compl
81+
<> completer := compl
8182

8283
-- | A completion function which offers no completions.
8384
noCompletion :: Completer

test/Main.purs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,15 @@ import Prelude
55
import Effect (Effect)
66
import Effect.Console (log)
77

8-
import Node.ReadLine (prompt, close, setLineHandler, setPrompt, noCompletion, createConsoleInterface)
8+
import Node.ReadLine (prompt, close, setLineHandler, setPrompt, noCompletion, createConsoleInterface)
99

1010
main :: Effect Unit
1111
main = do
1212
interface <- createConsoleInterface noCompletion
1313
setPrompt "> " interface
1414
prompt interface
1515
interface # setLineHandler \s ->
16-
if s == "quit"
17-
then close interface
18-
else do
19-
log $ "You typed: " <> s
20-
prompt interface
16+
if s == "quit" then close interface
17+
else do
18+
log $ "You typed: " <> s
19+
prompt interface

0 commit comments

Comments
 (0)