Shuffle things around and create a demo

This commit is contained in:
Mats Rauhala 2021-11-11 21:15:17 +02:00
parent caafd820b6
commit b73c4cfd1b
13 changed files with 93 additions and 27 deletions

View File

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

View File

@ -0,0 +1,38 @@
cabal-version: 2.4
name: FeedMonad-demo
version: 0.1.0.0
-- A short (one-line) description of the package.
-- synopsis:
-- A longer description of the package.
-- description:
-- A URL where users can report bugs.
-- bug-reports:
-- The license under which the package is released.
-- license:
author: Mats Rauhala
maintainer: mats.rauhala@iki.fi
-- A copyright notice.
-- copyright:
-- category:
extra-source-files: CHANGELOG.md
executable FeedMonad-demo
main-is: Main.hs
-- Modules included in this executable, other than Main.
-- other-modules:
-- LANGUAGE extensions used by modules in this package.
-- other-extensions:
build-depends:
base ^>=4.14.3.0,
FeedMonad,
containers
hs-source-dirs: app
default-language: Haskell2010

View File

@ -0,0 +1,9 @@
{-# LANGUAGE OverloadedStrings #-}
module Main where
import FeedMonad
import Data.Category
main :: IO ()
main = do
defaultMain defaultConfig{feeds = [ Category "News" [] ]}

View File

@ -0,0 +1,11 @@
{ mkDerivation, base, FeedMonad, lib }:
mkDerivation {
pname = "FeedMonad-demo";
version = "0.1.0.0";
src = ./.;
isLibrary = false;
isExecutable = true;
executableHaskellDepends = [ base FeedMonad ];
license = "unknown";
hydraPlatforms = lib.platforms.none;
}

View File

@ -0,0 +1,4 @@
module MyLib (someFunc) where
someFunc :: IO ()
someFunc = putStrLn "someFunc"

View File

@ -28,6 +28,7 @@ library
Data.Entry
Middleware
Paths_FeedMonad
Data.Category
-- Modules included in this library but not exported.
-- other-modules:
@ -50,18 +51,3 @@ library
hs-source-dirs: src
default-language: Haskell2010
ghc-options: -Wall
executable FeedMonad
main-is: Main.hs
-- Modules included in this executable, other than Main.
-- other-modules:
-- LANGUAGE extensions used by modules in this package.
-- other-extensions:
build-depends:
base ^>=4.14.3.0,
FeedMonad
hs-source-dirs: app
default-language: Haskell2010

View File

@ -1,7 +0,0 @@
module Main where
import FeedMonad (defaultMain, defaultConfig)
main :: IO ()
main =
defaultMain defaultConfig

View File

@ -0,0 +1,15 @@
{-# LANGUAGE DeriveFunctor #-}
module Data.Category where
import Data.Text (Text)
data Category a
= Leaf a
| Category Text [Category a]
deriving (Show, Functor)
foldCategory :: (a -> b) -> (Text -> [b] -> b) -> Category a -> b
foldCategory fab f = go
where
go (Leaf a) = fab a
go (Category txt cats) = f txt (map go cats)

View File

@ -1,17 +1,18 @@
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DeriveFunctor #-}
module FeedMonad where
import Data.Tree (Forest)
import Data.Text (Text)
import Data.Entry (URL)
import Middleware (Middleware)
import Numeric.Natural (Natural)
import Data.Foldable (for_)
import Data.Category (Category)
newtype Minutes = Minutes Natural
data FeedMonad = FeedMonad
{ feeds :: Forest URL
{ feeds :: [Category URL]
-- ^ The forest of urls for the feeds. It's a forest because of the categories
, filters :: Middleware
-- ^ The middleware. Modifies the scoring, tags and content

1
cabal.project Normal file
View File

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

2
hie.yaml Normal file
View File

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

View File

@ -10,13 +10,14 @@ let
};
easy-hls = callPackage easy-hls-src { ghcVersions = [ hp.ghc.version ]; };
hp = haskellPackages.extend (self: super: {
FeedMonad = self.callPackage ./. {};
FeedMonad = self.callPackage ./FeedMonad {};
FeedMonad-demo = self.callPackage ./FeedMonad-demo {};
});
in
hp.shellFor {
packages = h: [h.FeedMonad];
packages = h: [h.FeedMonad h.FeedMonad-demo];
withHoogle = true;
buildInputs = [
entr