Skip to content

Commit 4ec460a

Browse files
Format code via purs-tidy; enforce in CI (#52)
* Format code via purs-tidy * Add formatting check * Update changelog
1 parent 7be7bd0 commit 4ec460a

File tree

9 files changed

+206
-193
lines changed

9 files changed

+206
-193
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ jobs:
1515
- uses: purescript-contrib/setup-purescript@main
1616
with:
1717
purescript: "unstable"
18+
purs-tidy: "latest"
1819

1920
- uses: actions/setup-node@v2
2021
with:
@@ -33,3 +34,7 @@ jobs:
3334
run: |
3435
bower install
3536
npm run-script test --if-present
37+
38+
- name: Check formatting
39+
run: |
40+
purs-tidy check src test

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ New features:
1111
Bugfixes:
1212

1313
Other improvements:
14+
- Format code with `purs-tidy`; enforce in CI (#52 by @JordanMartinez)
1415

1516
## [v8.0.0](https://github.com/purescript-node/purescript-node-buffer/releases/tag/v8.0.0) - 2022-04-27
1617

src/Node/Buffer/Immutable.purs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ foreign import readImpl :: String -> Offset -> ImmutableBuffer -> Number
7373
readString :: Encoding -> Offset -> Offset -> ImmutableBuffer -> String
7474
readString = readStringImpl <<< encodingToNode
7575

76-
foreign import readStringImpl ::
77-
String -> Offset -> Offset -> ImmutableBuffer -> String
76+
foreign import readStringImpl
77+
:: String -> Offset -> Offset -> ImmutableBuffer -> String
7878

7979
-- | Reads the buffer as a string with the specified encoding.
8080
toString :: Encoding -> ImmutableBuffer -> String
@@ -92,8 +92,8 @@ foreign import toArrayBuffer :: ImmutableBuffer -> ArrayBuffer
9292
getAtOffset :: Offset -> ImmutableBuffer -> Maybe Octet
9393
getAtOffset = getAtOffsetImpl Just Nothing
9494

95-
foreign import getAtOffsetImpl ::
96-
(Octet -> Maybe Octet) -> Maybe Octet -> Offset -> ImmutableBuffer -> Maybe Octet
95+
foreign import getAtOffsetImpl
96+
:: (Octet -> Maybe Octet) -> Maybe Octet -> Offset -> ImmutableBuffer -> Maybe Octet
9797

9898
-- | Concatenates a list of buffers.
9999
foreign import concat :: Array ImmutableBuffer -> ImmutableBuffer

src/Node/Buffer/Internal.purs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ foreign import writeInternal :: forall buf m. String -> Number -> Offset -> buf
8282
writeString :: forall buf m. Monad m => Encoding -> Offset -> Int -> String -> buf -> m Int
8383
writeString = writeStringInternal <<< encodingToNode
8484

85-
foreign import writeStringInternal ::
86-
forall buf m. String -> Offset -> Int -> String -> buf -> m Int
85+
foreign import writeStringInternal
86+
:: forall buf m. String -> Offset -> Int -> String -> buf -> m Int
8787

8888
toArray :: forall buf m. Monad m => buf -> m (Array Octet)
8989
toArray = usingFromImmutable Immutable.toArray

src/Node/Buffer/Types.purs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,17 @@ data BufferValueType
3131
| DoubleBE
3232

3333
instance showBufferValueType :: Show BufferValueType where
34-
show UInt8 = "UInt8"
34+
show UInt8 = "UInt8"
3535
show UInt16LE = "UInt16LE"
3636
show UInt16BE = "UInt16BE"
3737
show UInt32LE = "UInt32LE"
3838
show UInt32BE = "UInt32BE"
39-
show Int8 = "Int8"
40-
show Int16LE = "Int16LE"
41-
show Int16BE = "Int16BE"
42-
show Int32LE = "Int32LE"
43-
show Int32BE = "Int32BE"
44-
show FloatLE = "FloatLE"
45-
show FloatBE = "FloatBE"
39+
show Int8 = "Int8"
40+
show Int16LE = "Int16LE"
41+
show Int16BE = "Int16BE"
42+
show Int32LE = "Int32LE"
43+
show Int32BE = "Int32BE"
44+
show FloatLE = "FloatLE"
45+
show FloatBE = "FloatBE"
4646
show DoubleLE = "DoubleLE"
4747
show DoubleBE = "DoubleBE"

src/Node/Encoding.purs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module Node.Encoding
2-
( Encoding (..)
2+
( Encoding(..)
33
, encodingToNode
44
, byteLength
55
) where
@@ -17,26 +17,26 @@ data Encoding
1717
| Hex
1818

1919
instance showEncoding :: Show Encoding where
20-
show ASCII = "ASCII"
21-
show UTF8 = "UTF8"
20+
show ASCII = "ASCII"
21+
show UTF8 = "UTF8"
2222
show UTF16LE = "UTF16LE"
23-
show UCS2 = "UCS2"
24-
show Base64 = "Base64"
25-
show Latin1 = "Latin1"
26-
show Binary = "Binary"
27-
show Hex = "Hex"
23+
show UCS2 = "UCS2"
24+
show Base64 = "Base64"
25+
show Latin1 = "Latin1"
26+
show Binary = "Binary"
27+
show Hex = "Hex"
2828

2929
-- | Convert an `Encoding` to a `String` in the format expected by Node.js
3030
-- | APIs.
3131
encodingToNode :: Encoding -> String
32-
encodingToNode ASCII = "ascii"
33-
encodingToNode UTF8 = "utf8"
32+
encodingToNode ASCII = "ascii"
33+
encodingToNode UTF8 = "utf8"
3434
encodingToNode UTF16LE = "utf16le"
35-
encodingToNode UCS2 = "ucs2"
36-
encodingToNode Base64 = "base64"
37-
encodingToNode Latin1 = "latin1"
38-
encodingToNode Binary = "binary"
39-
encodingToNode Hex = "hex"
35+
encodingToNode UCS2 = "ucs2"
36+
encodingToNode Base64 = "base64"
37+
encodingToNode Latin1 = "latin1"
38+
encodingToNode Binary = "binary"
39+
encodingToNode Hex = "hex"
4040

4141
foreign import byteLengthImpl :: String -> String -> Int
4242

0 commit comments

Comments
 (0)