Skip to content

Commit 361619a

Browse files
committed
Make it compile with MicroHs.
1 parent d570679 commit 361619a

File tree

7 files changed

+80
-9
lines changed

7 files changed

+80
-9
lines changed

.github/workflows/mhs-ci.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
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.14.23.1
19+
path: mhs
20+
- name: make and install mhs
21+
run: |
22+
cd mhs
23+
make minstall
24+
25+
# ghc-compat
26+
# must be installed before any other packages since there is an implicit dependency on ghc-compat
27+
- name: compile and install ghc-compat package
28+
run: |
29+
PATH="$HOME/.mcabal/bin:$PATH"
30+
mcabal install ghc-compat
31+
32+
# prettyprinter
33+
- name: checkout prettyprinter repo
34+
uses: actions/checkout@v4
35+
with:
36+
path: prettyprinter
37+
38+
- name: compile and install prettyprinter package
39+
run: |
40+
PATH="$HOME/.mcabal/bin:$PATH"
41+
cd prettyprinter/prettyprinter
42+
mcabal install
43+
44+
- name: compile and install prettyprinter-ansi-terminal package
45+
run: |
46+
PATH="$HOME/.mcabal/bin:$PATH"
47+
cd prettyprinter/prettyprinter-ansi-terminal
48+
mcabal install
49+
50+
- name: compile and install prettyprinter-compat-annotated-wl-pprint package
51+
run: |
52+
PATH="$HOME/.mcabal/bin:$PATH"
53+
cd prettyprinter/prettyprinter-compat-annotated-wl-pprint
54+
mcabal install
55+
56+
- name: compile and install prettyprinter-compat-ansi-wl-pprint package
57+
run: |
58+
PATH="$HOME/.mcabal/bin:$PATH"
59+
cd prettyprinter/prettyprinter-compat-ansi-wl-pprint
60+
mcabal install
61+
62+
- name: compile and install prettyprinter-compat-wl-pprint package
63+
run: |
64+
PATH="$HOME/.mcabal/bin:$PATH"
65+
cd prettyprinter/prettyprinter-compat-wl-pprint
66+
mcabal install
67+
68+
- name: cleanup
69+
run: |
70+
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
@@ -42,7 +42,7 @@ library
4242

4343
if impl(ghc >= 8.0)
4444
ghc-options: -Wcompat
45-
if !impl(ghc >= 8.0)
45+
if !impl(ghc >= 8.0) && !impl(mhs)
4646
build-depends: semigroups >= 0.1
4747

4848
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: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,17 +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
93-
93+
if impl(mhs)
94+
cpp-options: -DFOLDABLE_TRAVERSABLE_IN_PRELUDE=0
9495

9596

9697
Flag buildReadme

prettyprinter/src/Prettyprinter/Internal.hs

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

113113
#if FUNCTOR_IDENTITY_IN_BASE

0 commit comments

Comments
 (0)