From 3226856439185fadd5b4ebbe9200a07c98767779 Mon Sep 17 00:00:00 2001 From: Mats Rauhala Date: Thu, 10 Dec 2020 19:47:11 +0200 Subject: [PATCH] Initial commit --- .gitignore | 4 ++++ CHANGELOG.md | 5 +++++ LICENSE | 30 ++++++++++++++++++++++++++++++ Setup.hs | 2 ++ addressbook.cabal | 45 +++++++++++++++++++++++++++++++++++++++++++++ app/Main.hs | 8 ++++++++ default.nix | 16 ++++++++++++++++ shell.nix | 15 +++++++++++++++ src/MyLib.hs | 4 ++++ test/MyLibTest.hs | 4 ++++ 10 files changed, 133 insertions(+) create mode 100644 .gitignore create mode 100644 CHANGELOG.md create mode 100644 LICENSE create mode 100644 Setup.hs create mode 100644 addressbook.cabal create mode 100644 app/Main.hs create mode 100644 default.nix create mode 100644 shell.nix create mode 100644 src/MyLib.hs create mode 100644 test/MyLibTest.hs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8f51b0a --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +dist-newstyle +dist +tags +.envrc diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..a93a3c4 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,5 @@ +# Revision history for addressbook + +## 0.1.0.0 -- YYYY-mm-dd + +* First version. Released on an unsuspecting world. diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..2762ec9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,30 @@ +Copyright (c) 2020, Mats Rauhala + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of Mats Rauhala nor the names of other + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/Setup.hs b/Setup.hs new file mode 100644 index 0000000..9a994af --- /dev/null +++ b/Setup.hs @@ -0,0 +1,2 @@ +import Distribution.Simple +main = defaultMain diff --git a/addressbook.cabal b/addressbook.cabal new file mode 100644 index 0000000..b0aa971 --- /dev/null +++ b/addressbook.cabal @@ -0,0 +1,45 @@ +cabal-version: 2.4 +-- Initial package description 'addressbook.cabal' generated by 'cabal +-- init'. For further documentation, see +-- http://haskell.org/cabal/users-guide/ + +name: addressbook +version: 0.1.0.0 +-- synopsis: +-- description: +-- bug-reports: +license: BSD-3-Clause +license-file: LICENSE +author: Mats Rauhala +maintainer: mats.rauhala@iki.fi +-- copyright: +-- category: +extra-source-files: CHANGELOG.md + +library + exposed-modules: MyLib + -- other-modules: + -- other-extensions: + build-depends: base ^>=4.13.0.0 + , attoparsec + , mtl + , pipes + , pipes-bytestring + , text + hs-source-dirs: src + default-language: Haskell2010 + +executable addressbook + main-is: Main.hs + -- other-modules: + -- other-extensions: + build-depends: base ^>=4.13.0.0, addressbook + hs-source-dirs: app + default-language: Haskell2010 + +test-suite addressbook-test + default-language: Haskell2010 + type: exitcode-stdio-1.0 + hs-source-dirs: test + main-is: MyLibTest.hs + build-depends: base ^>=4.13.0.0 diff --git a/app/Main.hs b/app/Main.hs new file mode 100644 index 0000000..60d904e --- /dev/null +++ b/app/Main.hs @@ -0,0 +1,8 @@ +module Main where + +import qualified MyLib (someFunc) + +main :: IO () +main = do + putStrLn "Hello, Haskell!" + MyLib.someFunc diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..a7065f0 --- /dev/null +++ b/default.nix @@ -0,0 +1,16 @@ +{ mkDerivation, attoparsec, base, mtl, pipes, pipes-bytestring +, stdenv, text +}: +mkDerivation { + pname = "addressbook"; + version = "0.1.0.0"; + src = ./.; + isLibrary = true; + isExecutable = true; + libraryHaskellDepends = [ + attoparsec base mtl pipes pipes-bytestring text + ]; + executableHaskellDepends = [ base ]; + testHaskellDepends = [ base ]; + license = stdenv.lib.licenses.bsd3; +} diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..0df029a --- /dev/null +++ b/shell.nix @@ -0,0 +1,15 @@ +with (import {}); + +let addressbook = haskellPackages.callPackage ./. {}; + +in + +mkShell { + name = "addressbook-shell"; + buildInputs = [ + ghcid + stylish-haskell + haskellPackages.cabal-install + (haskellPackages.ghcWithHoogle (_: addressbook.buildInputs ++ addressbook.propagatedBuildInputs)) + ]; +} diff --git a/src/MyLib.hs b/src/MyLib.hs new file mode 100644 index 0000000..e657c44 --- /dev/null +++ b/src/MyLib.hs @@ -0,0 +1,4 @@ +module MyLib (someFunc) where + +someFunc :: IO () +someFunc = putStrLn "someFunc" diff --git a/test/MyLibTest.hs b/test/MyLibTest.hs new file mode 100644 index 0000000..3e2059e --- /dev/null +++ b/test/MyLibTest.hs @@ -0,0 +1,4 @@ +module Main (main) where + +main :: IO () +main = putStrLn "Test suite not yet implemented."