Skip to content

Commit

Permalink
Merge pull request #7 from bflyblue/next
Browse files Browse the repository at this point in the history
servant-event-stream 0.3.0
  • Loading branch information
bflyblue authored Sep 5, 2024
2 parents 7dcb2b3 + f9a2186 commit 08d4d6f
Show file tree
Hide file tree
Showing 13 changed files with 301 additions and 398 deletions.
2 changes: 2 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
use flake
watch_file *.cabal
9 changes: 4 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.4
- uses: cachix/install-nix-action@v13
with:
nix_path: nixpkgs=channel:nixos-unstable
- run: nix-build
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v22
- run: nix build
- run: nix flake check
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ dist/
dist-newstyle/
.ghc.environment.*
.stack-work/
.direnv/
# nix results
result
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# Revision history for servant-event-stream

## 0.3.0.0 -- 2024-09-05

* Breaking changes to the API.

Event streams are implemented using servant's 'Stream' endpoint. You should
provide a handler that returns a stream of events that implements 'ToSourceIO'
where events have a 'ToServerEvent' instance.

Example:

> type MyApi = "books" :> ServerSentEvents (SourceIO Book)
>
> instance ToServerEvent Book where
> toServerEvent book = ...
>
> server :: Server MyApi
> server = streamBooks
> where streamBooks :: Handler (SourceIO Book)
> streamBooks = pure $ source [book1, ...]
## 0.2.1.0 -- 2021-04-21

* Import `Data.Semigroup` for base < 4.11.0
Expand Down
1 change: 0 additions & 1 deletion default.nix

This file was deleted.

27 changes: 27 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 59 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
description = "servant-event-stream";

inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
};

outputs =
{ self, nixpkgs, ... }:
let
supportedSystems = [ "x86_64-linux" ];
forallSystems =
f:
nixpkgs.lib.genAttrs supportedSystems (
system:
f (rec {
inherit system;
pkgs = nixpkgsFor system;
haskellPackages = hpkgsFor system pkgs;
})
);
nixpkgsFor = system: import nixpkgs { inherit system; };
hpkgsFor =
system: pkgs:
with pkgs.haskell.lib;
pkgs.haskell.packages.ghc98.override { overrides = self: super: { }; };
in
{
packages = forallSystems (
{
system,
pkgs,
haskellPackages,
}:
{
servant-event-stream = haskellPackages.callCabal2nix "servant-event-stream" ./. { };
default = self.packages.${system}.servant-event-stream;
}
);
devShells = forallSystems (
{
system,
pkgs,
haskellPackages,
}:
{
servant-event-stream = haskellPackages.shellFor {
packages = p: [ self.packages.${system}.servant-event-stream ];
buildInputs = with haskellPackages; [
cabal-install
haskell-language-server
];
withHoogle = true;
};
default = self.devShells.${system}.servant-event-stream;
}
);
};
}
26 changes: 0 additions & 26 deletions nix/sources.json

This file was deleted.

174 changes: 0 additions & 174 deletions nix/sources.nix

This file was deleted.

Loading

0 comments on commit 08d4d6f

Please sign in to comment.