Skip to content

Commit 1411a93

Browse files
committed
Make it compile with MicroHs.
1 parent d570679 commit 1411a93

File tree

7 files changed

+73
-9
lines changed

7 files changed

+73
-9
lines changed

.github/workflows/mhs-ci.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
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.27.0
19+
path: mhs
20+
- name: make and install mhs
21+
run: |
22+
cd mhs
23+
make minstall
24+
25+
# prettyprinter
26+
- name: checkout prettyprinter repo
27+
uses: actions/checkout@v4
28+
with:
29+
path: prettyprinter
30+
31+
- name: compile and install prettyprinter package
32+
run: |
33+
PATH="$HOME/.mcabal/bin:$PATH"
34+
cd prettyprinter/prettyprinter
35+
mcabal -r install
36+
37+
- name: compile and install prettyprinter-ansi-terminal package
38+
run: |
39+
PATH="$HOME/.mcabal/bin:$PATH"
40+
cd prettyprinter/prettyprinter-ansi-terminal
41+
mcabal -r install
42+
43+
- name: compile and install prettyprinter-compat-annotated-wl-pprint package
44+
run: |
45+
PATH="$HOME/.mcabal/bin:$PATH"
46+
cd prettyprinter/prettyprinter-compat-annotated-wl-pprint
47+
mcabal -r install
48+
49+
- name: compile and install prettyprinter-compat-ansi-wl-pprint package
50+
run: |
51+
PATH="$HOME/.mcabal/bin:$PATH"
52+
cd prettyprinter/prettyprinter-compat-ansi-wl-pprint
53+
mcabal -r install
54+
55+
- name: compile and install prettyprinter-compat-wl-pprint package
56+
run: |
57+
PATH="$HOME/.mcabal/bin:$PATH"
58+
cd prettyprinter/prettyprinter-compat-wl-pprint
59+
mcabal -r install
60+
61+
- name: cleanup
62+
run: |
63+
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)