Skip to content

Commit 6ecd6d6

Browse files
authored
Merge pull request #5 from srghma/master
update
2 parents f6a6e28 + d57bf24 commit 6ecd6d6

11 files changed

Lines changed: 197 additions & 62 deletions

File tree

.github/workflows/ci.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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+
- uses: actions/setup-node@v2
15+
- uses: purescript-contrib/setup-purescript@main
16+
# with:
17+
# purescript: "latest"
18+
# spago: "latest"
19+
20+
- uses: actions/cache@v2
21+
with:
22+
key: ${{ runner.os }}-spago-${{ hashFiles('**/*.dhall') }}
23+
path: |
24+
.spago
25+
output
26+
27+
- name: Install dependencies
28+
run: |
29+
spago install
30+
spago --config test.dhall install
31+
32+
- name: Build source
33+
run: |
34+
spago build --no-install --purs-args '--censor-lib --strict'
35+
spago --config test.dhall build --no-install --purs-args '--censor-lib --strict'
36+
37+
- name: Run tests
38+
run: spago --config test.dhall test

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@
66
/src/.webpack.js
77
/pursuit.json
88
yarn.lock
9+
.psc-ide-port
10+
.purs-repl

.travis.yml

Lines changed: 0 additions & 18 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
purescript-boxes
33
=====================================
44

5-
[![Build
6-
Status](https://travis-ci.org/cdepillabout/purescript-boxes.svg)](https://travis-ci.org/cdepillabout/purescript-boxes)
5+
[![CI](https://github.com/cdepillabout/purescript-boxes/actions/workflows/ci.yml/badge.svg)](https://github.com/cdepillabout/purescript-boxes/actions/workflows/ci.yml)
76

87
A pretty-printing library for laying out text in two dimensions, using a simple box model.
98

bower.json

Lines changed: 0 additions & 27 deletions
This file was deleted.

package.json

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
{
22
"private": true,
33
"scripts": {
4-
"clean": "rimraf output && rimraf .pulp-cache",
5-
"build": "pulp build -- --censor-lib --strict",
6-
"test": "pulp test"
4+
"clean": "rimraf output",
5+
"build": "spago build",
6+
"test": "spago --config test.dhall test"
77
},
88
"devDependencies": {
9-
"bower": "^1.8.8",
10-
"pulp": "^14.0.0",
11-
"purescript": "^0.13.6",
129
"rimraf": "^3.0.2",
13-
"purescript-psa": "^0.7.3"
10+
"purescript-psa": "^0.8.2"
1411
}
1512
}

packages.dhall

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
{-
2+
Welcome to your new Dhall package-set!
3+
4+
Below are instructions for how to edit this file for most use
5+
cases, so that you don't need to know Dhall to use it.
6+
7+
## Use Cases
8+
9+
Most will want to do one or both of these options:
10+
1. Override/Patch a package's dependency
11+
2. Add a package not already in the default package set
12+
13+
This file will continue to work whether you use one or both options.
14+
Instructions for each option are explained below.
15+
16+
### Overriding/Patching a package
17+
18+
Purpose:
19+
- Change a package's dependency to a newer/older release than the
20+
default package set's release
21+
- Use your own modified version of some dependency that may
22+
include new API, changed API, removed API by
23+
using your custom git repo of the library rather than
24+
the package set's repo
25+
26+
Syntax:
27+
where `entityName` is one of the following:
28+
- dependencies
29+
- repo
30+
- version
31+
-------------------------------
32+
let upstream = --
33+
in upstream
34+
with packageName.entityName = "new value"
35+
-------------------------------
36+
37+
Example:
38+
-------------------------------
39+
let upstream = --
40+
in upstream
41+
with halogen.version = "master"
42+
with halogen.repo = "https://example.com/path/to/git/repo.git"
43+
44+
with halogen-vdom.version = "v4.0.0"
45+
with halogen-vdom.dependencies = [ "extra-dependency" ] # halogen-vdom.dependencies
46+
-------------------------------
47+
48+
### Additions
49+
50+
Purpose:
51+
- Add packages that aren't already included in the default package set
52+
53+
Syntax:
54+
where `<version>` is:
55+
- a tag (i.e. "v4.0.0")
56+
- a branch (i.e. "master")
57+
- commit hash (i.e. "701f3e44aafb1a6459281714858fadf2c4c2a977")
58+
-------------------------------
59+
let upstream = --
60+
in upstream
61+
with new-package-name =
62+
{ dependencies =
63+
[ "dependency1"
64+
, "dependency2"
65+
]
66+
, repo =
67+
"https://example.com/path/to/git/repo.git"
68+
, version =
69+
"<version>"
70+
}
71+
-------------------------------
72+
73+
Example:
74+
-------------------------------
75+
let upstream = --
76+
in upstream
77+
with benchotron =
78+
{ dependencies =
79+
[ "arrays"
80+
, "exists"
81+
, "profunctor"
82+
, "strings"
83+
, "quickcheck"
84+
, "lcg"
85+
, "transformers"
86+
, "foldable-traversable"
87+
, "exceptions"
88+
, "node-fs"
89+
, "node-buffer"
90+
, "node-readline"
91+
, "datetime"
92+
, "now"
93+
]
94+
, repo =
95+
"https://github.com/hdgarrood/purescript-benchotron.git"
96+
, version =
97+
"v7.0.0"
98+
}
99+
-------------------------------
100+
-}
101+
let upstream =
102+
https://github.com/purescript/package-sets/releases/download/psc-0.14.5-20220201/packages.dhall sha256:cea7c15d7cae3c323e940c40f656f3083616ad7cf68bb83d39241863c976348a
103+
104+
in upstream

spago.dhall

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{ name = "boxes"
2+
, dependencies =
3+
[ "prelude"
4+
, "psci-support"
5+
, "stringutils"
6+
, "arrays"
7+
, "foldable-traversable"
8+
, "maybe"
9+
, "newtype"
10+
, "profunctor"
11+
, "strings"
12+
, "tuples"
13+
]
14+
, packages = ./packages.dhall
15+
, sources = [ "src/**/*.purs" ]
16+
, license = "BSD-3-Clause"
17+
, repository = "https://github.com/cdepillabout/purescript-boxes"
18+
}

src/Text/PrettyPrint/Boxes.purs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,15 @@ newtype Box = Box { rows :: Int
7575
, content :: Content
7676
}
7777

78-
derive instance genericBox :: Generic Box _
7978
derive instance eqBox :: Eq Box
80-
derive instance newtypeBox :: Newtype Box _
8179
instance showBox :: Show Box where
8280
show (Box b) = "Box " <> show b
8381

8482
cols :: Box -> Int
85-
cols = _.cols <<< unwrap
83+
cols (Box box) = box.cols
8684

8785
rows :: Box -> Int
88-
rows = _.rows <<< unwrap
86+
rows (Box box) = box.rows
8987

9088
createBox :: Int -> Int -> Content -> Box
9189
createBox r c content = Box { rows: r, cols: c, content }
@@ -96,10 +94,12 @@ data Alignment = AlignFirst -- ^ Align at the top/left.
9694
| AlignCenter2 -- ^ Centered, biased to the bottom/right.
9795
| AlignLast -- ^ Align at the bottom/right.
9896

99-
derive instance genericAlignment :: Generic Alignment _
10097
derive instance eqAlignment :: Eq Alignment
10198
instance showAlignment :: Show Alignment where
102-
show = genericShow
99+
show AlignFirst = "AlignFirst"
100+
show AlignCenter1 = "AlignCenter1"
101+
show AlignCenter2 = "AlignCenter2"
102+
show AlignLast = "AlignLast"
103103

104104
-- | Align boxes along their tops.
105105
top :: Alignment

test.dhall

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{ name = "tests"
2+
, dependencies = (./spago.dhall).dependencies #
3+
[ "spec"
4+
, "aff"
5+
, "effect"
6+
]
7+
, packages = (./spago.dhall).packages
8+
, sources = (./spago.dhall).sources # [ "test/**/*.purs" ]
9+
}

0 commit comments

Comments
 (0)