Skip to content

Commit 4b3eee8

Browse files
authored
Add subsites for Cabal, GHC, GHCup and stack (#545)
* Add subsites for Cabal, GHC, GHCup and stack Fixes #378 * Add missing eof newline * Make ormolu happy * Add links to README
1 parent e10833e commit 4b3eee8

File tree

8 files changed

+177
-70
lines changed

8 files changed

+177
-70
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ Haskell tooling emits a variety of errors, warnings, and other messages. In rece
99

1010
Today, the Haskell Message Index supports three tools. Any user-facing Haskell-related programming tools are welcome to join the effort!
1111

12-
| Tool | Earliest supported version | Namespace |
13-
|-------|----------------------------|-----------|
14-
| GHC | 9.6.1 | `GHC-` |
15-
| Stack | 2.9.3 | `S-` |
16-
| GHCup | 0.1.19.0 | `GHCup-` |
17-
| Cabal | 3.12 | `Cabal-` |
12+
| Tool | Earliest supported version | Namespace | Link to subpage |
13+
|-------|----------------------------|-----------|-----------------|
14+
| GHC | 9.6.1 | `GHC-` | [/ghc](https://errors.haskell.org/ghc) |
15+
| Stack | 2.9.3 | `S-` | [/stack](https://errors.haskell.org/stack) |
16+
| GHCup | 0.1.19.0 | `GHCup-` | [/ghcup](https://errors.haskell.org/ghcup) |
17+
| Cabal | 3.12 | `Cabal-` | [/cabal](https://errors.haskell.org/cabal) |
1818

1919
## Contributing to the Message Index
2020

message-index/cabal/index.html

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
title: The Haskell Error Index | Cabal
3+
---
4+
5+
<h2>Welcome</h2>
6+
7+
<p>
8+
This site describes error messages that can be returned by <a href="https://www.haskell.org/cabal/">Cabal</a>, including both errors and warnings.
9+
Every error and warning has a code that Cabal emits when you run into it—you can look them up below.
10+
</p>
11+
12+
<p>
13+
So far, $messageCount$ Cabal errors and warnings are documented here.
14+
If you encounter a message that is not yet documented, please
15+
<a href="https://github.com/haskellfoundation/error-message-index/issues">open an issue</a> or
16+
<a href="https://github.com/haskellfoundation/error-message-index/pulls">submit a pull request with documentation</a>.
17+
Pull requests with additional examples and improved explanations for
18+
existing messages are also very welcome, as are
19+
<a href="https://github.com/haskellfoundation/error-message-index/issues?q=is%3Aissue+is%3Aopen+label%3Acss">improvements to the generated site</a>.
20+
</p>
21+
22+
<p>
23+
This site is a project of <a href="https://haskell.foundation" target="_blank" rel="noopener noreferrer">The Haskell Foundation</a>.
24+
Please <a href="https://haskell.foundation/contact/" target="_blank" rel="noopener noreferrer">get in touch</a> if you have feedback or if you'd like to get involved!
25+
</p>
26+
27+
$partial("templates/messages.html")$

message-index/ghc/index.html

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
title: The Haskell Error Index | GHC
3+
---
4+
5+
<h2>Welcome</h2>
6+
7+
<p>
8+
This site describes error messages that can be returned by <a href="https://www.haskell.org/ghc/">GHC</a>, including both errors and warnings.
9+
Every error and warning has a code that GHC emits when you run into it—you can look them up below.
10+
</p>
11+
12+
<p>
13+
So far, $messageCount$ GHC errors and warnings are documented here.
14+
If you encounter a message that is not yet documented, please
15+
<a href="https://github.com/haskellfoundation/error-message-index/issues">open an issue</a> or
16+
<a href="https://github.com/haskellfoundation/error-message-index/pulls">submit a pull request with documentation</a>.
17+
Pull requests with additional examples and improved explanations for
18+
existing messages are also very welcome, as are
19+
<a href="https://github.com/haskellfoundation/error-message-index/issues?q=is%3Aissue+is%3Aopen+label%3Acss">improvements to the generated site</a>.
20+
</p>
21+
22+
<p>
23+
This site is a project of <a href="https://haskell.foundation" target="_blank" rel="noopener noreferrer">The Haskell Foundation</a>.
24+
Please <a href="https://haskell.foundation/contact/" target="_blank" rel="noopener noreferrer">get in touch</a> if you have feedback or if you'd like to get involved!
25+
</p>
26+
27+
$partial("templates/messages.html")$

message-index/ghcup/index.html

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
title: The Haskell Error Index | GHCup
3+
---
4+
5+
<h2>Welcome</h2>
6+
7+
<p>
8+
This site describes error messages that can be returned by <a href="https://www.haskell.org/ghcup/">GHCup</a>, including both errors and warnings.
9+
Every error and warning has a code that GHCup emits when you run into it—you can look them up below.
10+
</p>
11+
12+
<p>
13+
So far, $messageCount$ GHCup errors and warnings are documented here.
14+
If you encounter a message that is not yet documented, please
15+
<a href="https://github.com/haskellfoundation/error-message-index/issues">open an issue</a> or
16+
<a href="https://github.com/haskellfoundation/error-message-index/pulls">submit a pull request with documentation</a>.
17+
Pull requests with additional examples and improved explanations for
18+
existing messages are also very welcome, as are
19+
<a href="https://github.com/haskellfoundation/error-message-index/issues?q=is%3Aissue+is%3Aopen+label%3Acss">improvements to the generated site</a>.
20+
</p>
21+
22+
<p>
23+
This site is a project of <a href="https://haskell.foundation" target="_blank" rel="noopener noreferrer">The Haskell Foundation</a>.
24+
Please <a href="https://haskell.foundation/contact/" target="_blank" rel="noopener noreferrer">get in touch</a> if you have feedback or if you'd like to get involved!
25+
</p>
26+
27+
$partial("templates/messages.html")$

message-index/index.html

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,6 @@ <h2>Welcome</h2>
1111
These codes can be looked up below for further information.
1212
</p>
1313

14-
<p>
15-
Other Haskell-related tools are welcome to add their own messages to the index. Please contact
16-
<a href="https://haskell.foundation/contact/" target="_blank" rel="noopener noreferrer">the Haskell Foundation</a>
17-
or <a href="https://github.com/haskellfoundation/error-message-index/issues">open an issue</a>
18-
to begin the process.
19-
</p>
20-
2114
<p>
2215
So far, $messageCount$ errors and warnings are documented here.
2316
If you encounter a message that is not yet documented, please
@@ -34,42 +27,4 @@ <h2>Welcome</h2>
3427
Please <a href="https://haskell.foundation/contact/" target="_blank" rel="noopener noreferrer">get in touch</a> if you have feedback or if you'd like to get involved!
3528
</p>
3629

37-
<h2>The Messages</h2>
38-
39-
<script src="/js/tablefilter.js"></script>
40-
41-
$partial("templates/message-list.html")$
42-
43-
<script>
44-
var filtersConfig = {
45-
base_path: '/wrong-on-purpose/',
46-
auto_filter: {
47-
delay: 75 //milliseconds
48-
},
49-
single_filter: true
50-
};
51-
var tf = new TableFilter(document.querySelector('.message-list'), filtersConfig);
52-
tf.init();
53-
54-
var input = document.querySelector('.single_flt');
55-
56-
if (input) {
57-
input.setAttribute("placeholder", "🔍 Type here to filter ...");
58-
input.focus();
59-
60-
//Autofill the search from the URL
61-
let url = new URL(document.location.href);
62-
let query = url.searchParams.get('q');
63-
if(query !== null)
64-
{
65-
input.setAttribute('value',query)
66-
//Move cursor to end
67-
input.setSelectionRange(query.length,query.length);
68-
69-
//Make sure that the list gets filtered as if the query had been typed manually
70-
input.dispatchEvent(new KeyboardEvent('keyup'));
71-
72-
}
73-
}
74-
75-
</script>
30+
$partial("templates/messages.html")$

message-index/site.hs

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -119,23 +119,11 @@ main = hakyll $ do
119119
>>= applyAsTemplate ctx
120120
>>= loadAndApplyTemplate "templates/default.html" ctx
121121

122-
match "index.html" $ do
123-
route idRoute
124-
compile $ do
125-
messages <- loadAll ("messages/*/index.md" .&&. hasNoVersion)
126-
let bread = breadcrumbCtx []
127-
indexCtx =
128-
mconcat
129-
[ listField "messages" (messageCtx <> defaultContext) (pure messages),
130-
bread,
131-
constField "messageCount" (show (length messages)),
132-
defaultContext
133-
]
134-
135-
getResourceBody
136-
>>= applyAsTemplate indexCtx
137-
>>= loadAndApplyTemplate "templates/default.html" indexCtx
138-
>>= relativizeUrls
122+
match "index.html" $ compileFilteredIndex ""
123+
match "cabal/index.html" $ compileFilteredIndex "Cabal-"
124+
match "ghc/index.html" $ compileFilteredIndex "GHC-"
125+
match "ghcup/index.html" $ compileFilteredIndex "GHCup-"
126+
match "stack/index.html" $ compileFilteredIndex "S-"
139127

140128
-- Needed for flagInfo below
141129
match "warning-sets/warning-sets-9.5.txt" $ do
@@ -185,6 +173,25 @@ main = hakyll $ do
185173

186174
--------------------------------------------------------------------------------
187175

176+
compileFilteredIndex :: String -> Rules ()
177+
compileFilteredIndex prefix = do
178+
route idRoute
179+
compile $ do
180+
messages <- loadAll (fromGlob ("messages/" <> prefix <> "*/index.md") .&&. hasNoVersion)
181+
let bread = breadcrumbCtx []
182+
indexCtx =
183+
mconcat
184+
[ listField "messages" (messageCtx <> defaultContext) (pure messages),
185+
bread,
186+
constField "messageCount" (show (length messages)),
187+
defaultContext
188+
]
189+
190+
getResourceBody
191+
>>= applyAsTemplate indexCtx
192+
>>= loadAndApplyTemplate "templates/default.html" indexCtx
193+
>>= relativizeUrls
194+
188195
-- | The file extensions to be shown in example lists
189196
exampleExtensions :: NonEmpty String
190197
exampleExtensions = "hs" :| ["yaml", "cabal"]

message-index/stack/index.html

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
title: The Haskell Error Index | Stack
3+
---
4+
5+
<h2>Welcome</h2>
6+
7+
<p>
8+
This site describes error messages that can be returned by <a href="https://docs.haskellstack.org/en/stable/">Stack</a>, including both errors and warnings.
9+
Every error and warning has a code that Stack emits when you run into it—you can look them up below.
10+
</p>
11+
12+
<p>
13+
So far, $messageCount$ Stack errors and warnings are documented here.
14+
If you encounter a message that is not yet documented, please
15+
<a href="https://github.com/haskellfoundation/error-message-index/issues">open an issue</a> or
16+
<a href="https://github.com/haskellfoundation/error-message-index/pulls">submit a pull request with documentation</a>.
17+
Pull requests with additional examples and improved explanations for
18+
existing messages are also very welcome, as are
19+
<a href="https://github.com/haskellfoundation/error-message-index/issues?q=is%3Aissue+is%3Aopen+label%3Acss">improvements to the generated site</a>.
20+
</p>
21+
22+
<p>
23+
This site is a project of <a href="https://haskell.foundation" target="_blank" rel="noopener noreferrer">The Haskell Foundation</a>.
24+
Please <a href="https://haskell.foundation/contact/" target="_blank" rel="noopener noreferrer">get in touch</a> if you have feedback or if you'd like to get involved!
25+
</p>
26+
27+
$partial("templates/messages.html")$

message-index/templates/messages.html

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,39 @@
1-
$body$
1+
<h2>The Messages</h2>
2+
3+
<script src="/js/tablefilter.js"></script>
4+
25
$partial("templates/message-list.html")$
6+
7+
<script>
8+
var filtersConfig = {
9+
base_path: '/wrong-on-purpose/',
10+
auto_filter: {
11+
delay: 75 //milliseconds
12+
},
13+
single_filter: true
14+
};
15+
var tf = new TableFilter(document.querySelector('.message-list'), filtersConfig);
16+
tf.init();
17+
18+
var input = document.querySelector('.single_flt');
19+
20+
if (input) {
21+
input.setAttribute("placeholder", "🔍 Type here to filter ...");
22+
input.focus();
23+
24+
//Autofill the search from the URL
25+
let url = new URL(document.location.href);
26+
let query = url.searchParams.get('q');
27+
if(query !== null)
28+
{
29+
input.setAttribute('value',query)
30+
//Move cursor to end
31+
input.setSelectionRange(query.length,query.length);
32+
33+
//Make sure that the list gets filtered as if the query had been typed manually
34+
input.dispatchEvent(new KeyboardEvent('keyup'));
35+
36+
}
37+
}
38+
39+
</script>

0 commit comments

Comments
 (0)