Skip to content

Add index entries for GHC-67120, GHC-89246, and GHC-94803 #517

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions message-index/messages/GHC-67120/example1/after/Main.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module Main where
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My experience is that it's far more common reason for GHC-67120 that you meant to write a library exporting notMain, in which case the solution is to rename module Main to module Lib or anything.

What contributes to the problem is that GHC would assume module Main where implicitly unless there is module declaration.

Probably worth adding another example or at least discussing this case in index.md.


-- Insert the fixed example here.

main :: IO ()
main = putStrLn "Hello, World!"
6 changes: 6 additions & 0 deletions message-index/messages/GHC-67120/example1/before/Main.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module Main where

-- Insert the example containing a bug here.

notMain :: IO ()
notMain = putStrLn "Hello, World!"
3 changes: 3 additions & 0 deletions message-index/messages/GHC-67120/example1/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: <insert a title for this example here>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please fill the title?

---
18 changes: 18 additions & 0 deletions message-index/messages/GHC-67120/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
title: Missing main
summary: Missing main action
severity: error
introduced: 9.8.1
---

According to the second paragraph of Chapter 5 of The Haskell 98 Report,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
According to the second paragraph of Chapter 5 of The Haskell 98 Report,
According to the second paragraph of Chapter 5 of [The Haskell 2010 Report](https://www.haskell.org/onlinereport/haskell2010/haskellch5.html#x11-980005),

> A Haskell program is a collection of modules, one of which, by convention, must be called Main and must export the value main. The value of the program is the value of the identifier main in module Main, which must be a computation of type IO t for some type t (see Chapter 7). When the program is executed, the computation main is performed, and its result (of type t) is discarded.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
> A Haskell program is a collection of modules, one of which, by convention, must be called Main and must export the value main. The value of the program is the value of the identifier main in module Main, which must be a computation of type IO t for some type t (see Chapter 7). When the program is executed, the computation main is performed, and its result (of type t) is discarded.
> A Haskell program is a collection of modules, one of which, by convention, must be called `Main` and must export the value `main`. The value of the program is the value of the identifier `main` in module `Main`, which must be a computation of type `IO t` for some type `t` (see Chapter 7). When the program is executed, the computation `main` is performed, and its result (of type `t`) is discarded.


## Example error text
```
error: [GHC-67120]
The IO action ‘main’ is not defined in module ‘Main’
|
1 | module Main where
| ^
```
4 changes: 4 additions & 0 deletions message-index/messages/GHC-89246/example1/after/Example1.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module Example1 where

main :: IO ()
main = print "hello"
4 changes: 4 additions & 0 deletions message-index/messages/GHC-89246/example1/before/Example1.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module Example1 where

main :: IO {}
main = print "hello"
5 changes: 5 additions & 0 deletions message-index/messages/GHC-89246/example1/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Empty record syntax in type constructor argument
---

A type constructor such as `IO` can be applied to a type variable, (e.g. `a`), or a type (e.g. `Int`, `[Bool]`, `(a,Int,b->Int)`). `{}` is neither of those. The unit type `()` can be used instead of an empty record type when the return value of the `IO` operation is irrelevant or meant to be discarded.
17 changes: 17 additions & 0 deletions message-index/messages/GHC-89246/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
title: Illegal record syntax
summary: Empty record syntax is not supported for type constructor arguments
severity: error
introduced: 9.8.1
---

Record syntax can be used for giving names to the arguments of a value constructor in `data` or `newtype` declarations. Record syntax cannot be used in place of type constructor arguments. The reason is that Haskell does not have first class records. Record syntax is merely a shorthand for declaring named projections.

## Example error text
```
error: [GHC-89246]
Record syntax is illegal here: {}
|
3 | main :: IO {}
| ^^
```
4 changes: 4 additions & 0 deletions message-index/messages/GHC-94803/example1/after/Example.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module Example where

a = (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(0,0))
4 changes: 4 additions & 0 deletions message-index/messages/GHC-94803/example1/before/Example.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module Example where

a = (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
8 changes: 8 additions & 0 deletions message-index/messages/GHC-94803/example1/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: 65-element tuples
order: 1
severity: error
introduced: 9.8.1
---

Having too many elements in a tuple causes a compilation error. A workaround is to collect the extra elements in a nested tuple.
25 changes: 25 additions & 0 deletions message-index/messages/GHC-94803/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
title: Tuple too large
summary: Tuples can only have up to 64 elements
severity: error
introduced: 9.8.1
---

A value containing more than 64 elements needs to be represented in a different way.

## Example error text
```
error: [GHC-94803]
• A 65-tuple is too large for GHC
(max size is 64)
Workaround: use nested tuples or define a data type
• In the expression:
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
In an equation for ‘a’:
a = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0)
```
Loading