You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>In this example the user attempted to use <code>capi</code> calling convention for foreign imports without enabling the <code>CApiFFI</code> extension, which leads to this generic parsing error.</p>
2
+
<pre><code>CAPI.hs:5:16: error: [GHC-58481]
3
+
parse error on input ‘capi’
4
+
|
5
+
5 | foreign import capi "setenv"
6
+
| ^^^^</code></pre>
7
+
8
+
<preclass="filename">CAPI.hs</pre>
9
+
<divclass="example-container">
10
+
<divclass="example">
11
+
<divclass="example-inner">
12
+
<divclass="example-title">Before</div>
13
+
<!-- keep next line as is, i.e., on one line, or the code will not format properly -->
14
+
<preclass="example-pre"><codeclass="language-haskell">module CAPI where
15
+
16
+
import Foreign.C
17
+
18
+
foreign import capi "setenv"
19
+
c_setenv :: CString -> CString -> CInt -> IO CInt
20
+
</code></pre>
21
+
</div>
22
+
</div>
23
+
<divclass="example">
24
+
<divclass="example-inner">
25
+
<divclass="example-title">After</div>
26
+
<!-- keep next line as is, i.e., on one line, or the code will not format propertly -->
27
+
<preclass="example-pre"><codeclass="language-haskell">{-# LANGUAGE CApiFFI #-}
<summary>Use of `capi` calling convention</summary>
286
+
<divclass="details-inner">
287
+
<p>In this example the user attempted to use <code>capi</code> calling convention for foreign imports without enabling the <code>CApiFFI</code> extension, which leads to this generic parsing error.</p>
288
+
<pre><code>CAPI.hs:5:16: error: [GHC-58481]
289
+
parse error on input ‘capi’
290
+
|
291
+
5 | foreign import capi "setenv"
292
+
| ^^^^</code></pre>
293
+
294
+
<preclass="filename">CAPI.hs</pre>
295
+
<divclass="example-container">
296
+
<divclass="example">
297
+
<divclass="example-inner">
298
+
<divclass="example-title">Before</div>
299
+
<!-- keep next line as is, i.e., on one line, or the code will not format properly -->
300
+
<preclass="example-pre"><codeclass="language-haskell">module CAPI where
301
+
302
+
import Foreign.C
303
+
304
+
foreign import capi "setenv"
305
+
c_setenv :: CString -> CString -> CInt -> IO CInt
306
+
</code></pre>
307
+
</div>
308
+
</div>
309
+
<divclass="example">
310
+
<divclass="example-inner">
311
+
<divclass="example-title">After</div>
312
+
<!-- keep next line as is, i.e., on one line, or the code will not format propertly -->
313
+
<preclass="example-pre"><codeclass="language-haskell">{-# LANGUAGE CApiFFI #-}
0 commit comments