Skip to content

Commit ae4720d

Browse files
committed
Refine explanations of Haskell and C code
1 parent 45698dc commit ae4720d

File tree

2 files changed

+8
-16
lines changed

2 files changed

+8
-16
lines changed

doc/haskell_and_c_code.md

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,31 +29,23 @@ int max(int x1, int x2) {
2929
}
3030
~~~
3131
32-
A different `src/Lib.hs` Haskell module, including a Haskell foreign import
33-
declaration making use of the C `max` function:
32+
A different Haskell module in source file `src/Lib.hs`, including a Haskell
33+
foreign import declaration making use of the C `max` function:
3434
~~~haskell
35-
module Lib
36-
( someFunc
37-
, c_max
38-
) where
39-
40-
someFunc :: IO ()
41-
someFunc = putStrLn "someFunc"
35+
module Lib ( c_max ) where
4236
4337
foreign import ccall "max" c_max :: Int -> Int -> Int
4438
~~~
4539

46-
A different `app/Main.hs` Haskell module, making use of the Haskell `c_max`
47-
function now exported from module `Lib`:
40+
A different Haskell module in source file `app/Main.hs`, making use of the
41+
Haskell function `c_max` exported from module `Lib`:
4842
~~~haskell
4943
module Main ( main ) where
5044

51-
import Lib ( c_max, someFunc )
45+
import Lib ( c_max )
5246

5347
main :: IO ()
54-
main = do
55-
someFunc
56-
print $ c_max 10 100
48+
main = print $ c_max 10 100
5749
~~~
5850

5951
The package's `package.yaml` file (simplied), used to create the package's
@@ -64,7 +56,6 @@ spec-version: 0.36.0
6456
name: c-example
6557
version: 0.1.0.0
6658

67-
# Hpack 0.36.1 and earlier does not support Cabal's 'includes' field
6859
extra-source-files:
6960
- include/my-library.h
7061

stack.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ extra-source-files:
5858
doc/glossary.md
5959
doc/GUIDE.md
6060
doc/GUIDE_advanced.md
61+
doc/haskell_and_c_code.md
6162
doc/hoogle_command.md
6263
doc/hpc_command.md
6364
doc/ide_command.md

0 commit comments

Comments
 (0)