Split to multiproject

This commit is contained in:
Mats Rauhala 2022-05-16 21:42:11 +03:00
parent 0266d4b06b
commit 03b4cfb3bf
35 changed files with 70 additions and 8 deletions

1
cabal.project Normal file
View File

@ -0,0 +1 @@
packages: */*

View File

@ -12,8 +12,9 @@
{ {
overlay = final: prev: { overlay = final: prev: {
haskellPackages = prev.haskellPackages.override ( old: { haskellPackages = prev.haskellPackages.override ( old: {
overrides = final.lib.composeExtensions ( old.overrides or (_: _: {})) (f: p: { overrides = final.lib.composeExtensions ( old.overrides or (_: _: {})) (f: p: rec {
reddit-pub = f.callPackage ./. {}; reddit-pub = f.callPackage ./reddit_pub {};
reddit-lib = f.callPackage ./reddit_lib {};
}); });
} ); } );
}; };

2
hie.yaml Normal file
View File

@ -0,0 +1,2 @@
cradle:
cabal:

5
reddit_lib/CHANGELOG.md Normal file
View File

@ -0,0 +1,5 @@
# Revision history for reddit-lib
## 0.1.0.0 -- YYYY-mm-dd
* First version. Released on an unsuspecting world.

10
reddit_lib/default.nix Normal file
View File

@ -0,0 +1,10 @@
{ mkDerivation, base, lib }:
mkDerivation {
pname = "reddit-lib";
version = "0.1.0.0";
src = ./.;
libraryHaskellDepends = [ base ];
testHaskellDepends = [ base ];
license = "unknown";
hydraPlatforms = lib.platforms.none;
}

View File

@ -0,0 +1,38 @@
cabal-version: 3.0
name: reddit-lib
version: 0.1.0.0
synopsis:
-- A longer description of the package.
-- description:
homepage:
-- A URL where users can report bugs.
-- bug-reports:
license: NONE
author: Mats Rauhala
maintainer: mats.rauhala@iki.fi
-- A copyright notice.
-- copyright:
category: Web
extra-source-files: CHANGELOG.md
library
exposed-modules: Reddit.Publish
-- Modules included in this library but not exported.
-- other-modules:
-- LANGUAGE extensions used by modules in this package.
-- other-extensions:
build-depends: base ^>=4.15.1.0
hs-source-dirs: src
default-language: Haskell2010
test-suite reddit-lib-test
default-language: Haskell2010
type: exitcode-stdio-1.0
hs-source-dirs: test
main-is: MyLibTest.hs
build-depends: base ^>=4.15.1.0

View File

@ -1,5 +1,5 @@
{-# LANGUAGE DerivingVia #-} {-# LANGUAGE DerivingVia #-}
module Publish where module Reddit.Publish where
import Data.Functor.Contravariant import Data.Functor.Contravariant
import Data.Monoid (Ap(..)) import Data.Monoid (Ap(..))

View File

@ -0,0 +1,4 @@
module Main (main) where
main :: IO ()
main = putStrLn "Test suite not yet implemented."

View File

@ -1,6 +1,6 @@
{ mkDerivation, aeson, amqp, base, bytestring, containers, dhall { mkDerivation, aeson, amqp, base, bytestring, containers, dhall
, hedgehog, hspec, hspec-hedgehog, lens, lens-aeson, lib, mtl , hedgehog, hspec, hspec-hedgehog, lens, lens-aeson, lib, mtl
, pipes, sqlite-simple, text, wreq , pipes, reddit-lib, sqlite-simple, text, wreq
}: }:
mkDerivation { mkDerivation {
pname = "reddit-pub"; pname = "reddit-pub";
@ -8,9 +8,10 @@ mkDerivation {
src = ./.; src = ./.;
isLibrary = true; isLibrary = true;
isExecutable = true; isExecutable = true;
enableSeparateDataOutput = true;
libraryHaskellDepends = [ libraryHaskellDepends = [
aeson amqp base bytestring containers dhall lens lens-aeson mtl aeson amqp base bytestring containers dhall lens lens-aeson mtl
pipes sqlite-simple text wreq pipes reddit-lib sqlite-simple text wreq
]; ];
executableHaskellDepends = [ base ]; executableHaskellDepends = [ base ];
testHaskellDepends = [ testHaskellDepends = [

View File

@ -32,7 +32,6 @@ library
Data.Deriving.Aeson Data.Deriving.Aeson
Network.Reddit Network.Reddit
Data.SubReddit Data.SubReddit
Publish
Membership Membership
-- Modules included in this library but not exported. -- Modules included in this library but not exported.
@ -53,6 +52,7 @@ library
, pipes , pipes
, containers , containers
, sqlite-simple , sqlite-simple
, reddit-lib
hs-source-dirs: src hs-source-dirs: src
default-language: Haskell2010 default-language: Haskell2010

View File

@ -43,7 +43,7 @@ import Network.AMQP
) )
import Network.Reddit (RedditId(RedditId), publishEntries) import Network.Reddit (RedditId(RedditId), publishEntries)
import Network.Wreq.Session (newSession) import Network.Wreq.Session (newSession)
import Publish (Publish(..)) import Reddit.Publish (Publish(..))
import Text.Printf (printf) import Text.Printf (printf)
import Data.ByteString.Lazy (ByteString) import Data.ByteString.Lazy (ByteString)

View File

@ -14,7 +14,7 @@ import Network.Wreq hiding (getWith)
import Network.Wreq.Session (Session, getWith) import Network.Wreq.Session (Session, getWith)
import Pipes (Producer, (>->), for, runEffect) import Pipes (Producer, (>->), for, runEffect)
import qualified Pipes.Prelude as P import qualified Pipes.Prelude as P
import Publish import Reddit.Publish
import Data.Maybe (maybeToList) import Data.Maybe (maybeToList)
import Control.Monad.Trans (liftIO) import Control.Monad.Trans (liftIO)
import Database.SQLite.Simple.ToField (ToField) import Database.SQLite.Simple.ToField (ToField)

View File