diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 06ed895..7e99424 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,15 +10,16 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: purescript-contrib/setup-purescript@main with: purescript: "unstable" + purs-tidy: "latest" - - uses: actions/setup-node@v2 + - uses: actions/setup-node@v3 with: - node-version: "14" + node-version: "lts/*" - name: Install dependencies run: | @@ -33,3 +34,8 @@ jobs: run: | bower install npm run-script test --if-present + + - name: Check Formatting + if: runner.os == 'Linux' + run: | + npx purs-tidy check src diff --git a/src/Node/ReadLine.purs b/src/Node/ReadLine.purs index 3f9d145..4444e24 100644 --- a/src/Node/ReadLine.purs +++ b/src/Node/ReadLine.purs @@ -55,12 +55,12 @@ historySize = opt "historySize" -- | -- | This function takes the partial command as input, and returns a collection of -- | completions, as well as the matched portion of the input string. -type Completer - = String +type Completer = + String -> Effect - { completions :: Array String - , matched :: String - } + { completions :: Array String + , matched :: String + } -- | Builds an interface with the specified options. createInterface @@ -69,15 +69,16 @@ createInterface -> Options InterfaceOptions -> Effect Interface createInterface input opts = createInterfaceImpl - $ options $ opts - <> opt "input" := input + $ options + $ opts + <> opt "input" := input -- | Create an interface with the specified completion function. createConsoleInterface :: Completer -> Effect Interface createConsoleInterface compl = createInterface stdin $ output := stdout - <> completer := compl + <> completer := compl -- | A completion function which offers no completions. noCompletion :: Completer diff --git a/test/Main.purs b/test/Main.purs index 66e3cec..4ddb177 100644 --- a/test/Main.purs +++ b/test/Main.purs @@ -5,7 +5,7 @@ import Prelude import Effect (Effect) import Effect.Console (log) -import Node.ReadLine (prompt, close, setLineHandler, setPrompt, noCompletion, createConsoleInterface) +import Node.ReadLine (prompt, close, setLineHandler, setPrompt, noCompletion, createConsoleInterface) main :: Effect Unit main = do @@ -13,8 +13,7 @@ main = do setPrompt "> " interface prompt interface interface # setLineHandler \s -> - if s == "quit" - then close interface - else do - log $ "You typed: " <> s - prompt interface + if s == "quit" then close interface + else do + log $ "You typed: " <> s + prompt interface