Skip to content

Commit 7aaa4b4

Browse files
authored
Add another example for GHC-58481 (#575)
1 parent fd266aa commit 7aaa4b4

File tree

4 files changed

+28
-1
lines changed

4 files changed

+28
-1
lines changed

message-index/messages/GHC-39999/overloaded-number/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Lib.hs:4:17: error: [GHC-39999]
1919
## Explanation
2020

2121
Sometimes, when GHC encounters a type error, it suggests solving
22-
it from an unexpected end. In this case, when it encouters a literal
22+
it from an unexpected end. In this case, when it encounters a literal
2323
instead of a list, it does not just complain about it. Instead it suspects
2424
that maybe an author meant to overload numeric literals so that they can mean lists too.
2525

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{-# LANGUAGE CApiFFI #-}
2+
3+
module CAPI where
4+
5+
import Foreign.C
6+
7+
foreign import capi "setenv"
8+
c_setenv :: CString -> CString -> CInt -> IO CInt
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module CAPI where
2+
3+
import Foreign.C
4+
5+
foreign import capi "setenv"
6+
c_setenv :: CString -> CString -> CInt -> IO CInt
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
title: Use of `capi` calling convention
3+
---
4+
5+
In this example the user attempted to use `capi` calling convention for foreign imports without enabling the `CApiFFI` extension, which leads to this generic parsing error.
6+
7+
```
8+
CAPI.hs:5:16: error: [GHC-58481]
9+
parse error on input ‘capi’
10+
|
11+
5 | foreign import capi "setenv"
12+
| ^^^^
13+
```

0 commit comments

Comments
 (0)