Skip to content

Instantly share code, notes, and snippets.

@m-renaud
Last active November 21, 2018 07:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save m-renaud/4a89c4e88bb0113f9b2deb2f5c4dafd0 to your computer and use it in GitHub Desktop.
Save m-renaud/4a89c4e88bb0113f9b2deb2f5c4dafd0 to your computer and use it in GitHub Desktop.
Default project template for `cabal init`
-- File: src/Lib.hs
module Lib (greeting) where
greeting :: String
greeting = "Hello, world!"
-- File: test/src/LibSpec.hs
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE OverloadedStrings #-}
module Main (main) where
import qualified Lib
import Test.Hspec
main :: IO ()
main = hspec spec
spec :: Spec
spec = do
describe "greeting test" $ do
it "is hello world" $ do
Lib.greeting `shouldBe` "Hello, world!"
-- File: app/Main.hs
module Main where
import qualified Lib
main :: IO ()
main = putStrLn Lib.greeting
cabal-version: 2.4
name: myproject
version: 0.1.0.0
synopsis: myproject synopsis.
description: myproject description.
license: BSD-3-Clause
license-file: LICENSE
author: Matt Renaud
maintainer: matt@m-renaud.com
build-type: Simple
extra-source-files: CHANGELOG.md
library internal-lib
default-language: Haskell2010
hs-source-dirs: src
exposed-modules:
Lib,
build-depends:
base >=4.12 && <4.13,
executable myproject
default-language: Haskell2010
hs-source-dirs: app
main-is: Main.hs
build-depends:
base >=4.12 && < 4.13,
internal-lib,
test-suite internal-lib-test
default-language: Haskell2010
hs-source-dirs: test/src
type: exitcode-stdio-1.0
main-is: LibSpec.hs
build-depends:
base >=4.12 && <4.13,
internal-lib,
hspec,
ghc-options:
-threaded -rtsopts -with-rtsopts=-N
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment