I am trying out c2hs, and wanted to compile a small example of a shared library with Cabal to get started.
I have the following relevant section of the cabal file test.cabal:
executable libtest.so
hs-source-dirs: src
main-is: Dummy.hs
other-extensions: ForeignFunctionInterface
build-depends: base
default-language: Haskell2010
ghc-options: -no-hs-main -threaded
build-tools: c2hs
Then the source. src/Dummy.hs:
import Test
main :: IO ()
main = return
In the file src/Test.chs
{-# LANGUAGE ForeignFunctionInterface #-}
import Foreign
import Foreign.C
module Android where
And then when I try to compile (cabal configure && cabal build -v) I get the following error message:
Component build order: executable 'libtest.so'
creating dist/build
creating dist/build/autogen
Building test-0.1.0.0...
Preprocessing executable 'libtest.so' for test-0.1.0.0...
Building executable libtest.so...
creating dist/build/libtest.so
creating dist/build/libtest.so/libtest.so-tmp
/opt/ghc/bin/ghc --make -no-link -fbuilding-cabal-package -O -j8 -static
-outputdir dist/build/libtest.so/libtest.so-tmp -odir dist/build
/libtest.so/libtest.so-tmp -hidir dist/build/libtest.so/libtest.so-tmp-stubdir
dist/build/libtest.so/libtest.so-tmp -i -idist/build/libtest.so/libtest.so-tmp
-isrc -idist/build/autogen -Idist/build/autogen
-Idist/build/libtest.so/libtest.so-tmp
-optP-include -optPdist/build/autogen/cabal_macros.h -hide-all-packages
-package-db dist/package.conf.inplace -package-id
base-4.7.0.1-1a55ebc8256b39ccbff004d48b3eb834 -XHaskell2010
src/Dummy.hs -no-hs-main -threaded
src/Dummy.hs:1:8:
Could not find module ‘Test’
Use -v to see a list of the files searched for.
Please, can you tell me what the cause of the error is? What am I missing?
You need to add Test to the other-modules field.
Related
It seems I might need to add some 'packages' to the nix dependencies, though I'm not sure how to determine which packages (besides a tedious web search for each lm,lrt...)?
stack install
Building all executables for `sodiumSierraStrawberry' once. After a successful build of all of them, only specified executables will be rebuilt.
sodiumSierraStrawberry-0.1.0.0: configure (exe)
Configuring sodiumSierraStrawberry-0.1.0.0...
sodiumSierraStrawberry-0.1.0.0: build (exe)
Preprocessing executable 'sodiumSierraStrawberry' for sodiumSierraStrawberry-0.1.0.0..
Building executable 'sodiumSierraStrawberry' for sodiumSierraStrawberry-0.1.0.0..
[1 of 2] Compiling Paths_sodiumSierraStrawberry ( .stack-work/dist/x86_64-linux-nix/Cabal-2.4.0.1/build/sodiumSierraStrawberry/autogen/Paths_sodiumSierraStrawberry.hs, .stack-work/dist/x86_64-linux-nix/Cabal-2.4.0.1/build/sodiumSierraStrawberry/sodiumSierraStrawberry-tmp/Paths_sodiumSierraStrawberry.o )
[2 of 2] Compiling Prompt ( src/Prompt.hs, .stack-work/dist/x86_64-linux-nix/Cabal-2.4.0.1/build/sodiumSierraStrawberry/sodiumSierraStrawberry-tmp/Prompt.o )
Linking .stack-work/dist/x86_64-linux-nix/Cabal-2.4.0.1/build/sodiumSierraStrawberry/sodiumSierraStrawberry ...
/nix/store/5vyv136pqs75pj0b8vcpdyc03dmn9p0n-binutils-2.30/bin/ld: cannot find -lm
/nix/store/5vyv136pqs75pj0b8vcpdyc03dmn9p0n-binutils-2.30/bin/ld: cannot find -lrt
/nix/store/5vyv136pqs75pj0b8vcpdyc03dmn9p0n-binutils-2.30/bin/ld: cannot find -lutil
/nix/store/5vyv136pqs75pj0b8vcpdyc03dmn9p0n-binutils-2.30/bin/ld: cannot find -ldl
/nix/store/5vyv136pqs75pj0b8vcpdyc03dmn9p0n-binutils-2.30/bin/ld: cannot find -lgmp
/nix/store/5vyv136pqs75pj0b8vcpdyc03dmn9p0n-binutils-2.30/bin/ld: cannot find -lm
/nix/store/5vyv136pqs75pj0b8vcpdyc03dmn9p0n-binutils-2.30/bin/ld: cannot find -lrt
/nix/store/5vyv136pqs75pj0b8vcpdyc03dmn9p0n-binutils-2.30/bin/ld: cannot find -ldl
/nix/store/5vyv136pqs75pj0b8vcpdyc03dmn9p0n-binutils-2.30/bin/ld: cannot find -lpthread
/nix/store/5vyv136pqs75pj0b8vcpdyc03dmn9p0n-binutils-2.30/bin/ld: cannot find -lc
collect2: error: ld returned 1 exit status
`cc' failed in phase `Linker'. (Exit code: 1)
-- While building package sodiumSierraStrawberry-0.1.0.0 using:
/home/chris/.stack/setup-exe-cache/x86_64-linux-nix/Cabal-simple_mPHDZzAJ_2.4.0.1_ghc-8.6.3 --builddir=.stack-work/dist/x86_64-linux-nix/Cabal-2.4.0.1 build exe:sodiumSierraStrawberry --ghc-options " -ddump-hi -ddump-to-file -fdiagnostics-color=always"
Process exited with code: ExitFailure 1
cabal file:
-- This file has been generated from package.static.yaml by hpack version 0.28.2.
--
-- see: https://github.com/sol/hpack
--
-- hash: dc5d80120403b39adcd93487e3eb7b084fcc8abb48bc9c23eaaa9dbc7c48cb06
cabal-version: >= 1.10
name: sodiumSierraStrawberry
version: 0.1.0.0
author: Chris Stryczynski
maintainer: Chris Stryczynski
license: BSD3
license-file: LICENSE
build-type: Simple
extra-source-files:
ChangeLog.md
executable sodiumSierraStrawberry
main-is: Prompt.hs
other-modules:
Paths_sodiumSierraStrawberry
hs-source-dirs:
src
default-extensions: LambdaCase
ghc-options: -Wall -O2 -static -threaded -main-is Prompt
cc-options: -static
ld-options: -static -pthread
build-depends:
MissingH
, aeson
, base
, bytestring
, directory
, filepath
, optparse-applicative
, pretty-simple
, safe
, split
, stm
, string-conversions
, text
, thyme
, time
default-language: Haskell2010
In this particular case I was able to solve it by adding:
nix:
packages:
- glibc.static
- gmp5.static
However, I'm still not sure how I can determine the relationship between these flags (lm, lrt etc) to the actual packages.
I'm trying to use the req package (http://hackage.haskell.org/package/req) in a Haskell project, with stack.
So far, I've done stack new my-project, stack setup, stack build and stack exec my-project-exe all fine.
Have added req to the cabal file like so:
name: my-project
version: 0.1.0.0
synopsis: Short description of your package
homepage: https://github.com/githubuser/#readme
license: BSD3
license-file: LICENSE
author: Author name here
maintainer: example#example.com
copyright: 2017 Author name here
category: Web
build-type: Simple
extra-source-files: README.md
cabal-version: >=1.10
library
hs-source-dirs: src
exposed-modules: Lib
build-depends: base >= 4.7 && < 5
, req -- THIS IS THE LINE IVE ADDED
default-language: Haskell2010
executable my-project-exe
hs-source-dirs: app
main-is: Main.hs
ghc-options: -threaded -rtsopts -with-rtsopts=-N
build-depends: base
, my-project
default-language: Haskell2010
test-suite my-project-test
type: exitcode-stdio-1.0
hs-source-dirs: test
main-is: Spec.hs
build-depends: base
, my-project
ghc-options: -threaded -rtsopts -with-rtsopts=-N
default-language: Haskell2010
source-repository head
type: git
location: https://github.com/githubuser/my-project
And finally, cut and paste the example from the req readme into src/Lib.hs, changing the function name like so:
{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Lib
( someFunc
) where
import Control.Exception (throwIO)
import Network.HTTP.Req
import Data.Aeson
-- Just make your monad stack an instance of MonadHttp in your application
-- and start making requests, enjoy automatic connection sharing.
instance MonadHttp IO where
handleHttpException = throwIO
someFunc :: IO ()
someFunc = do
let payload = object
[ "foo" .= (10 :: Int)
, "bar" .= (20 :: Int) ]
-- One function, full power and flexibility.
r <- req POST -- method
(https "httpbin.org" /: "post") -- safe by construction URL
(ReqBodyJson payload) -- use built-in options or add your own
jsonResponse -- specify how to interpret response
mempty -- query params, headers, explicit port number, etc.
print (responseBody r :: Value)
And now stack build is erroring:
%> stack build
basement-0.0.4: configure
basement-0.0.4: build
zlib-0.6.1.2: configure
aeson-1.1.2.0: download
zlib-0.6.1.2: build
network-2.6.3.2: configure
th-lift-instances-0.1.11: download
aeson-1.1.2.0: configure
aeson-1.1.2.0: build
th-lift-instances-0.1.11: configure
th-lift-instances-0.1.11: build
th-lift-instances-0.1.11: copy/register
aeson-1.1.2.0: copy/register
Progress: 5/28
-- While building package network-2.6.3.2 using:
/tmp/stack7830/network-2.6.3.2/.stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/setup/setup --builddir=.stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0 configure --with-ghc=/home/liam/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/bin/ghc --with-ghc-pkg=/home/liam/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/bin/ghc-pkg --user --package-db=clear --package-db=global --package-db=/home/liam/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.14/8.0.2/pkgdb --libdir=/home/liam/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.14/8.0.2/lib --bindir=/home/liam/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.14/8.0.2/bin --datadir=/home/liam/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.14/8.0.2/share --libexecdir=/home/liam/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.14/8.0.2/libexec --sysconfdir=/home/liam/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.14/8.0.2/etc --docdir=/home/liam/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.14/8.0.2/doc/network-2.6.3.2 --htmldir=/home/liam/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.14/8.0.2/doc/network-2.6.3.2 --haddockdir=/home/liam/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.14/8.0.2/doc/network-2.6.3.2 --dependency=base=base-4.9.1.0 --dependency=bytestring=bytestring-0.10.8.1 --dependency=unix=unix-2.7.2.1
Process exited with code: ExitFailure 1
Logs have been written to: /home/liam/code/forecast-compare/.stack-work/logs/network-2.6.3.2.log
[1 of 2] Compiling Main ( /tmp/stack7830/network-2.6.3.2/Setup.hs, /tmp/stack7830/network-2.6.3.2/.stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/setup/Main.o )
[2 of 2] Compiling StackSetupShim ( /home/liam/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs, /tmp/stack7830/network-2.6.3.2/.stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/setup/StackSetupShim.o )
Linking /tmp/stack7830/network-2.6.3.2/.stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/setup/setup ...
Configuring network-2.6.3.2...
configure: WARNING: unrecognized options: --with-compiler
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for gcc... /usr/bin/gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... configure: error: in `/tmp/stack7830/network-2.6.3.2':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
-- While building package zlib-0.6.1.2 using:
/home/liam/.stack/setup-exe-cache/x86_64-linux-tinfo6-nopie/Cabal-simple_mPHDZzAJ_1.24.2.0_ghc-8.0.2 --builddir=.stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0 build --ghc-options " -ddump-hi -ddump-to-file"
Process exited with code: ExitFailure 1
Logs have been written to: /home/liam/code/forecast-compare/.stack-work/logs/zlib-0.6.1.2.log
Configuring zlib-0.6.1.2...
Building zlib-0.6.1.2...
Preprocessing library zlib-0.6.1.2...
/usr/bin/ld: .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/build/Codec/Compression/Zlib/Stream_hsc_make.o: relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
linking .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/build/Codec/Compression/Zlib/Stream_hsc_make.o failed (exit code 1)
command was: /usr/bin/gcc .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/build/Codec/Compression/Zlib/Stream_hsc_make.o .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/build/Codec/Compression/Zlib/Stream_hsc_utils.o -o .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/build/Codec/Compression/Zlib/Stream_hsc_make -fno-PIE -fno-stack-protector -lz -L/home/liam/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/bytestring-0.10.8.1 -Wl,-R,/home/liam/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/bytestring-0.10.8.1 -L/home/liam/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/deepseq-1.4.2.0 -Wl,-R,/home/liam/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/deepseq-1.4.2.0 -L/home/liam/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/array-0.5.1.1 -Wl,-R,/home/liam/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/array-0.5.1.1 -L/home/liam/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/base-4.9.1.0 -Wl,-R,/home/liam/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/base-4.9.1.0 -L/home/liam/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/integer-gmp-1.0.0.1 -Wl,-R,/home/liam/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/integer-gmp-1.0.0.1 -lgmp -L/home/liam/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/ghc-prim-0.5.0.0 -Wl,-R,/home/liam/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/ghc-prim-0.5.0.0 -L/home/liam/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/rts -Wl,-R,/home/liam/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/rts -lm -lrt -ldl -lpthread
-- While building package basement-0.0.4 using:
/home/liam/.stack/setup-exe-cache/x86_64-linux-tinfo6-nopie/Cabal-simple_mPHDZzAJ_1.24.2.0_ghc-8.0.2 --builddir=.stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0 build --ghc-options " -ddump-hi -ddump-to-file"
Process exited with code: ExitFailure 1
Logs have been written to: /home/liam/code/forecast-compare/.stack-work/logs/basement-0.0.4.log
Configuring basement-0.0.4...
Building basement-0.0.4...
Preprocessing library basement-0.0.4...
/usr/bin/ld: .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/build/Basement/Terminal/Size_hsc_make.o: relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
linking .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/build/Basement/Terminal/Size_hsc_make.o failed (exit code 1)
command was: /usr/bin/gcc .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/build/Basement/Terminal/Size_hsc_make.o .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/build/Basement/Terminal/Size_hsc_utils.o -o .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/build/Basement/Terminal/Size_hsc_make -fno-PIE -fno-stack-protector -L/home/liam/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/base-4.9.1.0 -Wl,-R,/home/liam/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/base-4.9.1.0 -L/home/liam/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/integer-gmp-1.0.0.1 -Wl,-R,/home/liam/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/integer-gmp-1.0.0.1 -lgmp -L/home/liam/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/ghc-prim-0.5.0.0 -Wl,-R,/home/liam/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/ghc-prim-0.5.0.0 -L/home/liam/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/rts -Wl,-R,/home/liam/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/rts -lm -lrt -ldl -lpthread
Any help much appreciated!
This issue has been plaguing users of Arch Linux for a few months. It appears to be related to the ncurses library, and possibly due to Arch Linux dynamically linking Haskell packages, whilst most (all?) other distros use static linking.
The current work around involves using the ghc-build: nopie option for the stack ghc version, and installing ncurses5-compat-libs from the AUR.
If you wish to set this globally, you can set it in your ~/.stack/config.yaml, so it applies to all projects you build with stack.
A bug report is currently open here, and some related discussion can be found on the arch forums or the stack github.
For me deleting ~/.stack and using
stack setup --ghc-build=ncurses6
and adding
ghc-build: ncurses6
to
~/.stack/config.yaml
resolved this.
Addendum:
ghc-build: tinfo6
and
stack setup --ghc-build=tinfo6
worked even better for me.
What I want is: cabal to build my modules; make to build this one script.
The script links to Objective-C (see https://github.com/mchakravarty/language-c-inline/tree/master/tests/objc/marshal-array). when I build the script, it fails on the import:
$ make
Main.hs:1:1:
Bad interface file: dist/build/Commands/OSX/Events.hi
Something is amiss; requested module main:Commands.OSX.Events differs from name found in the interface file commands-0.0.0:Commands.OSX.Events
here are some file contents:
$ cat Makefile
PACKAGES = -package template-haskell -package language-c-quote -package language-c-inline -package commands
FRAMEWORKS = -framework Carbon -framework Cocoa -framework Foundation
LDFLAGS = $(PACKAGES) $(FRAMEWORKS)
Main: Main.o
cabal exec -- ghc -o Main Main.o $(LDFLAGS)
Main.o:
cabal build
cabal exec -- ghc -c Main.hs -idist/build/ -v
...
$ cat commands.cabal
exposed-modules: Commands.OSX.Events
hs-source-dirs: sources
...
$ ghc --show-iface dist/build/Commands/OSX/Events.hi
interface commands-0.0.0:Commands.OSX.Events 7083
...
$ cat sources/Commands/OSX/Events.hs
module Commands.OSX.Events where
...
$ cat Main.hs
import Commands.OSX.Events
...
the cabal build is successful, and executable compiles and runs successfully, if I just put everything in the same directory, and ignore cabal.
can I tell GHC that some module is part of some package?
can I make a cabal executable, with these external dependencies?
any other solutions?
explicitly naming the modules package worked:
ghc -package-name commands-0.0.0
http://www.haskell.org/ghc/docs/7.2.1/html/users_guide/packages.html
Silly question. I have a cabal file with a library and an executable that I would like to use to profile the library, but I can't manage to see cost centers from my library (although I see some from other modules like GHC.IO.Encoding).
Here's a simplified version of my cabal file
flag dev
default: False
manual: True
library
exposed-modules: Foo
ghc-options: -Wall
ghc-prof-options: -fprof-auto
build-depends: base
executable dev-example
if !flag(dev)
buildable: False
ghc-options: -ddump-to-file -ddump-simpl -dsuppress-module-prefixes -dsuppress-uniques -ddump-core-stats -ddump-inlinings
ghc-options: -O2 -rtsopts
ghc-prof-options: -fprof-auto
hs-source-dirs: dev-example, ./
main-is: Main.hs
build-depends: base
Where I've been doing
$ cabal configure -fdev -w /usr/local/bin/ghc-7.6.3 --enable-library-profiling --enable-executable-profiling
$ cabal run dev-example -- +RTS -h -p
Ugh, the issue was simply that my library code was being inlined (or at least marked INLINABLE).
This is an embarrassingly simple problem, but its solution yet eludes me. As the title indicates, I simply want to specify to GHC the location of all my source files. This should be simple; the GHC user guide:
-idirs
This flag appends a colon-separated
list of dirs to the search path.
So, I tried the following invocations:
ghc -isrc/ -v -outputdir build/ --make -Wall Main.hs
ghc -isrc/: -v -outputdir build/ --make -Wall Main.hs
ghc -i:src/: -v -outputdir build/ --make -Wall Main.hs
ghc -i"src/" -v -outputdir build/ --make -Wall Main.hs
ghc -i"src/": -v -outputdir build/ --make -Wall Main.hs
ghc -i:"src/": -v -outputdir build/ --make -Wall Main.hs
On every invocation GHC gave the error: "<no location info>: can't find file: Main.hs"
As you probably could have guessed, Main.hs is located in a subdirectory from the working directory called "src". Just in case it matters, I'm on Windows XP, and I'm using GHC 6.12.2. I'm assuming there is some small problem that I'm just missing.
-i specifies where GHC will search for other source files, other than the ones you specify on the command line. So your Main.hs there will also need a src/ prefix. E.g.
$ ghc -isrc src/Main.hs --make
[1 of 1] Compiling Main ( src/Main.hs, src/Main.o )
Linking src/Main ...
Alternatively, you could use cabal, and have cabal init generate all the build metadata for you.