Skip to content

Commit 06259d7

Browse files
Update to PureScript 0.15 (#9)
* Update for PureScript 0.15 * Add purs-tidy and ci * Update formatting check * Bump spago version
1 parent 3295054 commit 06259d7

File tree

10 files changed

+67
-33
lines changed

10 files changed

+67
-33
lines changed

.github/workflows/ci.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v2
14+
15+
- uses: purescript-contrib/setup-purescript@main
16+
with:
17+
purescript: "0.15.0"
18+
purs-tidy: "0.8.0"
19+
spago: "0.20.9"
20+
21+
- name: Build source
22+
run: spago build
23+
24+
- name: Run tests
25+
run: spago test --no-install
26+
27+
- name: Verify formatting
28+
run: purs-tidy check src test

.tidyrc.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"importSort": "ide",
3+
"importWrap": "source",
4+
"indent": 2,
5+
"operatorsFile": null,
6+
"ribbon": 1,
7+
"typeArrowPlacement": "first",
8+
"unicode": "never",
9+
"width": null
10+
}

packages.dhall

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
let upstream =
2-
https://github.com/purescript/package-sets/releases/download/psc-0.14.3-20210811/packages.dhall sha256:a2de7ef2f2e753733eddfa90573a82da0c7c61d46fa87d015b7f15ef8a6e97d5
2+
https://github.com/purescript/package-sets/releases/download/psc-0.15.0-20220509/packages.dhall
3+
sha256:d4c1a03606efdbb7bb7745a9d3aa908cb1ba5611921373659a4c7bf1c41c106c
34

4-
let overrides = {=}
5-
6-
let additions = {=}
7-
8-
in upstream // overrides // additions
5+
in upstream

spago.dhall

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
{-
2-
Welcome to a Spago project!
3-
You can edit this file as you like.
4-
-}
51
{ name = "dodo-printer"
2+
, license = "MIT"
3+
, repository = "https://github.com/natefaubion/purescript-dodo-printer.git"
64
, dependencies =
75
[ "aff"
86
, "ansi"
@@ -29,7 +27,6 @@ You can edit this file as you like.
2927
, "partial"
3028
, "posix-types"
3129
, "prelude"
32-
, "psci-support"
3330
, "safe-coerce"
3431
, "strings"
3532
, "tuples"

src/Dodo.purs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ import Data.String.Regex as Regex
5151
import Data.String.Regex.Flags (global)
5252
import Data.String.Regex.Unsafe (unsafeRegex)
5353
import Data.Tuple (Tuple(..))
54-
import Dodo.Internal (Doc(..), Position, LocalOptions, bothNotEmpty, isEmpty, notEmpty)
54+
import Dodo.Internal (Doc(..), LocalOptions, Position, bothNotEmpty, isEmpty, notEmpty)
5555
import Dodo.Internal (Doc, Position, bothNotEmpty, isEmpty, notEmpty) as Exports
5656
import Dodo.Internal.Buffer (Buffer)
5757
import Dodo.Internal.Buffer as Buffer
@@ -472,7 +472,7 @@ print (Printer printer) opts = flip go initState <<< pure <<< Doc
472472
, ribbonRatio: state.options.ribbonRatio
473473
}
474474
Tuple localOptions doc1 = k prevOptions
475-
go (Doc doc1 : LeaveLocal prevOptions: stk) $ storeOptions state.position.indent localOptions state
475+
go (Doc doc1 : LeaveLocal prevOptions : stk) $ storeOptions state.position.indent localOptions state
476476
Empty ->
477477
go stk state
478478
LeaveFlexGroup doc1 doc2 -> case state.flexGroup of

src/Dodo/Ansi.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module Dodo.Ansi
99

1010
import Prelude
1111

12-
import Ansi.Codes (GraphicsParam, Color(..)) as Exports
12+
import Ansi.Codes (Color(..), GraphicsParam) as Exports
1313
import Ansi.Codes as Ansi
1414
import Data.List (List)
1515
import Data.List as List

test/Snapshot.purs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module Test.Snapshot where
22

33
import Prelude
44

5-
import Control.MonadZero (guard)
5+
import Control.Alternative (guard)
66
import Control.Parallel (parTraverse)
77
import Data.Array (mapMaybe)
88
import Data.Array as Array
@@ -72,7 +72,7 @@ snapshotMainOutput directory accept mbPattern = do
7272

7373
runSnapshot :: String -> Aff SnapshotTest
7474
runSnapshot name = flip catchError (makeErrorResult name) do
75-
result <- exec $ "node -e 'require(\"./output/" <> name <> "/index.js\").main()'"
75+
result <- exec $ "node --input-type=module -e 'import { main } from \"./output/" <> name <> "/index.js\";main()'"
7676
case result of
7777
{ error: Just err } ->
7878
throwError err

test/snapshots/DodoBox.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ table { headers, rows } =
7272
rowSep =
7373
horizontal
7474
[ joint
75-
, horizontal $ Array.intersperse joint $ map
75+
, horizontal $ Array.intersperse joint $ map
7676
( \width ->
7777
fill (Dodo.text "-")
7878
{ width: width + 2

test/snapshots/DodoExampleJson.purs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,18 @@ infix 0 Tuple as :
4040
exampleJson :: Json
4141
exampleJson =
4242
JObject
43-
[ "bool": JBool true
44-
, "string": JString "bar"
45-
, "number": JNumber 1234.0
46-
, "array": JArray
43+
[ "bool" : JBool true
44+
, "string" : JString "bar"
45+
, "number" : JNumber 1234.0
46+
, "array" : JArray
4747
[ JNull
4848
, JString "two"
49-
, JArray [ JString "three"]
49+
, JArray [ JString "three" ]
5050
]
51-
, "object": JObject
51+
, "object" : JObject
5252
[]
53-
, "wideObject": JObject
54-
[ "key": JString "1111111111111111111111111111111111111111"
53+
, "wideObject" : JObject
54+
[ "key" : JString "1111111111111111111111111111111111111111"
5555
]
5656
]
5757

test/snapshots/DodoFlexSelectHanging.purs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,11 @@ joinArgs args last = fst $ foldr go start args
3535
start = case last of
3636
Hang a b ->
3737
Tuple
38-
(flexSelect
39-
(spaceBreak <> a)
40-
(flexGroup (spaceBreak <> b))
41-
(flexGroup (spaceBreak <> indent b)))
38+
( flexSelect
39+
(spaceBreak <> a)
40+
(flexGroup (spaceBreak <> b))
41+
(flexGroup (spaceBreak <> indent b))
42+
)
4243
(break <> a <> flexGroup (spaceBreak <> indent b))
4344
NoHang a ->
4445
Tuple
@@ -53,10 +54,11 @@ joinArgs args last = fst $ foldr go start args
5354
Hang a b ->
5455
a <> flexGroup (spaceBreak <> indent b)
5556
Tuple
56-
(flexSelect
57-
(spaceBreak <> doc)
58-
(fst next)
59-
(snd next))
57+
( flexSelect
58+
(spaceBreak <> doc)
59+
(fst next)
60+
(snd next)
61+
)
6062
(break <> doc <> snd next)
6163

6264
test :: forall a. Doc a

0 commit comments

Comments
 (0)