Skip to content

Commit 6a31989

Browse files
committed
Toys around with proof of concept
1 parent 303a0fb commit 6a31989

8 files changed

+95
-0
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
dist-newstyle
2+
*.local
3+
*.local~
4+
result

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Revision history for barbq2
2+
3+
## 0.1.0.0 -- YYYY-mm-dd
4+
5+
* First version. Released on an unsuspecting world.

Main.hs

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{-# LANGUAGE FlexibleContexts, FlexibleInstances, InstanceSigs, MultiParamTypeClasses, DeriveFunctor, DerivingStrategies, GeneralizedNewtypeDeriving, KindSignatures #-}
2+
{-# LANGUAGE GADTs #-}
3+
{-# LANGUAGE ScopedTypeVariables #-}
4+
{-# LANGUAGE RankNTypes #-}
5+
6+
7+
module Main where
8+
9+
import System.Clock
10+
11+
-- Actions get an `a` from the universe
12+
newtype Action m a = Action (m a)
13+
deriving Functor
14+
15+
-- Providers control how frequently actions are run
16+
-- for now, just via polling
17+
newtype Provider m a = Provider { providerPoll :: () -> Action m a }
18+
deriving Functor
19+
20+
data Timeout = Immediate | In TimeSpec
21+
22+
now :: [Timeout]
23+
now = [Immediate]
24+
25+
every :: TimeSpec -> [Timeout]
26+
every s = In s : every s
27+
28+
-- provide :: forall (m :: * -> *) a. [Timeout] -> Action m a -> Provider m a
29+
30+
newtype Component a view = Component { consume :: a -> view }
31+
32+
-- provide (now <> every (5 seconds)) (run "kwm...")
33+
-- <*>
34+
35+
main :: IO ()
36+
main = print 4
37+

Setup.hs

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import Distribution.Simple
2+
main = defaultMain

barbq2.cabal

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
cabal-version: >=1.10
2+
-- Initial package description 'barbq2.cabal' generated by 'cabal init'.
3+
-- For further documentation, see http://haskell.org/cabal/users-guide/
4+
5+
name: barbq2
6+
version: 0.1.0.0
7+
-- synopsis:
8+
-- description:
9+
-- bug-reports:
10+
-- license:
11+
-- license-file: LICENSE
12+
-- author:
13+
-- maintainer:
14+
-- copyright:
15+
-- category:
16+
build-type: Simple
17+
extra-source-files: CHANGELOG.md
18+
19+
executable barbq2
20+
main-is: Main.hs
21+
-- other-modules:
22+
-- other-extensions:
23+
build-depends: base >=4.12 && <4.13, clock
24+
-- hs-source-dirs:
25+
default-language: Haskell2010

default.nix

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{ compiler ? "ghc865", pkgs ? import <nixpkgs> {} }:
2+
3+
let
4+
5+
haskellPackages = pkgs.haskell.packages.${compiler};
6+
drv = haskellPackages.callCabal2nix "barbq2" ./. {};
7+
8+
in
9+
{
10+
barbq = drv;
11+
barbq-shell = haskellPackages.shellFor {
12+
packages = p: [drv];
13+
buildInputs = with pkgs; [ cabal-install hlint ghcid];
14+
};
15+
}
16+

release.nix

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
let
2+
pkgs = import <nixpkgs> { };
3+
in
4+
pkgs.haskellPackages.callPackage ./default.nix { }

shell.nix

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
(import ./. {}).barbq-shell
2+

0 commit comments

Comments
 (0)