Skip to content

Commit d2ddf82

Browse files
authored
Make it compile with MicroHs. (#270)
1 parent 9d2959f commit d2ddf82

7 files changed

Lines changed: 67 additions & 9 deletions

File tree

.github/workflows/mhs-ci.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: mhs-ci
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
9+
jobs:
10+
build-mhs-prettyprinter:
11+
runs-on: ubuntu-latest
12+
steps:
13+
14+
- name: checkout mhs repo
15+
uses: actions/checkout@v4
16+
with:
17+
repository: augustss/MicroHs
18+
ref: v0.15.4.0
19+
path: mhs
20+
- name: make and install mhs
21+
run: |
22+
cd mhs
23+
make minstall
24+
echo "$HOME/.mcabal/bin" >> "$GITHUB_PATH"
25+
26+
# prettyprinter
27+
- name: checkout prettyprinter repo
28+
uses: actions/checkout@v4
29+
with:
30+
path: prettyprinter
31+
32+
- name: compile and install prettyprinter package
33+
run: |
34+
cd prettyprinter/prettyprinter
35+
mcabal -r install
36+
37+
- name: compile and install prettyprinter-ansi-terminal package
38+
run: |
39+
cd prettyprinter/prettyprinter-ansi-terminal
40+
mcabal -r install
41+
42+
- name: compile and install prettyprinter-compat-annotated-wl-pprint package
43+
run: |
44+
cd prettyprinter/prettyprinter-compat-annotated-wl-pprint
45+
mcabal -r install
46+
47+
- name: compile and install prettyprinter-compat-ansi-wl-pprint package
48+
run: |
49+
cd prettyprinter/prettyprinter-compat-ansi-wl-pprint
50+
mcabal -r install
51+
52+
- name: compile and install prettyprinter-compat-wl-pprint package
53+
run: |
54+
cd prettyprinter/prettyprinter-compat-wl-pprint
55+
mcabal -r install
56+
57+
- name: cleanup
58+
run: |
59+
rm -rf $HOME/.mcabal

misc/version-compatibility-macros.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
-- purpose much clearer than just demanding a specific version of a library.
1010

1111
#define APPLICATIVE_MONAD MIN_VERSION_base(4,8,0)
12-
#define FOLDABLE_TRAVERSABLE_IN_PRELUDE MIN_VERSION_base(4,8,0)
12+
#define FOLDABLE_TRAVERSABLE_IN_PRELUDE (MIN_VERSION_base(4,8,0) && !defined(__MHS__))
1313
#define FUNCTOR_IDENTITY_IN_BASE MIN_VERSION_base(4,8,0)
1414
#define MONOID_IN_PRELUDE MIN_VERSION_base(4,8,0)
1515
#define NATURAL_IN_BASE MIN_VERSION_base(4,8,0)

prettyprinter-ansi-terminal/prettyprinter-ansi-terminal.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ library
6060

6161
if impl(ghc >= 8.0)
6262
ghc-options: -Wcompat
63-
if !impl(ghc >= 8.0)
63+
if !impl(ghc >= 8.0) && !impl(mhs)
6464
build-depends: semigroups >= 0.1
6565

6666
test-suite doctest

prettyprinter-compat-ansi-wl-pprint/prettyprinter-compat-ansi-wl-pprint.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@ library
3434
, prettyprinter >= 1.7.0
3535
, prettyprinter-ansi-terminal >= 1.1
3636

37-
if !impl(ghc >= 8.0)
37+
if !impl(ghc >= 8.0) && !impl(mhs)
3838
build-depends: semigroups >= 0.1

prettyprinter-compat-wl-pprint/prettyprinter-compat-wl-pprint.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@ library
3232
, text >= 1.2
3333
, prettyprinter >= 1.7.0
3434

35-
if !impl(ghc >= 8.0)
35+
if !impl(ghc >= 8.0) && !impl(mhs)
3636
build-depends: semigroups >= 0.1

prettyprinter/prettyprinter.cabal

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,19 +80,18 @@ library
8080
, Data.Text.Lazy
8181
, Data.Text.Lazy.Builder
8282

83-
if !impl(ghc >= 7.6)
83+
if !impl(ghc >= 7.6) && !impl(mhs)
8484
build-depends: ghc-prim
8585

8686
if impl(ghc >= 8.0)
8787
ghc-options: -Wcompat
88-
if !impl(ghc >= 8.0)
88+
if !impl(ghc >= 8.0) && !impl(mhs)
8989
build-depends: semigroups >= 0.17
9090
build-depends: fail >= 4.9.0.0 && <4.10
91-
if !impl(ghc >= 7.10)
91+
if !impl(ghc >= 7.10) && !impl(mhs)
9292
build-depends: void >=0.4 && <0.8
9393

9494

95-
9695
Flag buildReadme
9796
Description: Build the readme generator
9897
Default: False

prettyprinter/src/Prettyprinter/Internal.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ import Numeric.Natural
108108
#if !(FOLDABLE_TRAVERSABLE_IN_PRELUDE)
109109
import Data.Foldable (Foldable (..))
110110
import Data.Traversable (Traversable (..))
111-
import Prelude hiding (foldr, foldr1)
111+
import Prelude hiding (null, foldr, foldr1)
112112
#endif
113113

114114
#if FUNCTOR_IDENTITY_IN_BASE

0 commit comments

Comments
 (0)