-
Notifications
You must be signed in to change notification settings - Fork 70
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module Main where | ||
|
||
-- Insert the fixed example here. | ||
|
||
main :: IO () | ||
main = putStrLn "Hello, World!" |
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!" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
title: <insert a title for this example here> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you please fill the title? |
||
--- |
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, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
## Example error text | ||||||
``` | ||||||
error: [GHC-67120] | ||||||
The IO action ‘main’ is not defined in module ‘Main’ | ||||||
| | ||||||
1 | module Main where | ||||||
| ^ | ||||||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module Example1 where | ||
|
||
main :: IO () | ||
main = print "hello" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module Example1 where | ||
|
||
main :: IO {} | ||
main = print "hello" |
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. |
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 {} | ||
| ^^ | ||
``` |
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)) |
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) |
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. |
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) | ||
``` |
There was a problem hiding this comment.
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 renamemodule Main
to moduleLib
or anything.What contributes to the problem is that GHC would assume
module Main where
implicitly unless there ismodule
declaration.Probably worth adding another example or at least discussing this case in
index.md
.