summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbebarker <>2020-11-21 20:53:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2020-11-21 20:53:00 (GMT)
commit5a021dbb69f991a2be1e1e6ac33af74c5d9bfcd9 (patch)
tree3301ecdfd086f808234cd000f172ffd6e115e031
parentea3b37fed0991f1a916a1dd62f4966b42e2c21f0 (diff)
version 0.1.0.2HEAD0.1.0.2master
-rwxr-xr-x[-rw-r--r--]ChangeLog.md0
-rwxr-xr-x[-rw-r--r--]README.md78
-rw-r--r--docs/BuildNotes.md57
-rwxr-xr-xpackage-shell.nix37
-rwxr-xr-xshell.nix5
-rw-r--r--zio.cabal44
6 files changed, 191 insertions, 30 deletions
diff --git a/ChangeLog.md b/ChangeLog.md
index 486c011..486c011 100644..100755
--- a/ChangeLog.md
+++ b/ChangeLog.md
diff --git a/README.md b/README.md
index 3a67411..0b07467 100644..100755
--- a/README.md
+++ b/README.md
@@ -61,15 +61,71 @@ other than `Void` (that's one big reason why we're using this library!),
so we'd prefer to have e.g. `uelift :: ∀ e a. UIO a -> EIO e a`,
not `uelift :: UIO a -> UEIO a`.
-[//]: # (Table generated from docs/type_aliases.csv using https://www.tablesgenerator.com/markdown_tables)
+[//]: # (`nix-shell -p pandoc` then `pandoc TypesTable.md -o TypesTable.html`)
-| Haskell Type | Alias for | Scala Type | Notes |
-|-------------- |------------------------------------- |-------------- |------------------------------------------------------------------------------------------------------- |
-| `ZIO r e a` | | `ZIO[R,E,A]` | |
-| `UIO a` | | `UIO[A]` | This is a type alias in Scala but a concrete type in Haskell due to UIO being an inner monadic type. |
-| `EIO e a` | | `IO[E, A]` | This is a type alias in Scala but a concrete type in Haskell due to EIO being an inner monadic type. |
-| `RIO r a` | `ZIO r SomeNonPseudoException a` | `RIO[R, A]` | Same idea as in Scala. Not to be confused with the RIO library's `RIO` monad, but they are isomorphic. |
-| `Task a` | `ZIO Void SomeNonPseudoException a` | `Task[A]` | |
-| `UEIO a` | `EIO Void a` | `UIO[A]` | |
-| `URIO r a` | `ZIO r Void a` | `URIO[R, A]` | Same idea as in Scala; a ZIO value isomorphic to a RIO value (can be projected to the RIO value). |
-| `UZIO a` | `ZIO Void Void a` | `UIO[A]` | |
+<table>
+<colgroup>
+<col style="width: 8%" />
+<col style="width: 22%" />
+<col style="width: 8%" />
+<col style="width: 61%" />
+</colgroup>
+<thead>
+<tr class="header">
+<th>Haskell Type</th>
+<th>Alias for</th>
+<th>Scala Type</th>
+<th>Notes</th>
+</tr>
+</thead>
+<tbody>
+<tr class="odd">
+<td><code>ZIO r e a</code></td>
+<td></td>
+<td><code>ZIO[R,E,A]</code></td>
+<td></td>
+</tr>
+<tr class="even">
+<td><code>UIO a</code></td>
+<td></td>
+<td><code>UIO[A]</code></td>
+<td>This is a type alias in Scala but a concrete type in Haskell due to UIO being an inner monadic type.</td>
+</tr>
+<tr class="odd">
+<td><code>EIO e a</code></td>
+<td></td>
+<td><code>IO[E, A]</code></td>
+<td>This is a type alias in Scala but a concrete type in Haskell due to EIO being an inner monadic type.</td>
+</tr>
+<tr class="even">
+<td><code>RIO r a</code></td>
+<td><code>ZIO r SomeNonPseudoException a</code></td>
+<td><code>RIO[R, A]</code></td>
+<td>Same idea as in Scala. Not to be confused with the RIO library’s <code>RIO</code> monad, but they are isomorphic.</td>
+</tr>
+<tr class="odd">
+<td><code>Task a</code></td>
+<td><code>ZIO Void SomeNonPseudoException a</code></td>
+<td><code>Task[A]</code></td>
+<td></td>
+</tr>
+<tr class="even">
+<td><code>UEIO a</code></td>
+<td><code>EIO Void a</code></td>
+<td><code>UIO[A]</code></td>
+<td></td>
+</tr>
+<tr class="odd">
+<td><code>URIO r a</code></td>
+<td><code>ZIO r Void a</code></td>
+<td><code>URIO[R, A]</code></td>
+<td>Same idea as in Scala; a ZIO value isomorphic to a RIO value (can be projected to the RIO value).</td>
+</tr>
+<tr class="even">
+<td><code>UZIO a</code></td>
+<td><code>ZIO Void Void a</code></td>
+<td><code>UIO[A]</code></td>
+<td></td>
+</tr>
+</tbody>
+</table>
diff --git a/docs/BuildNotes.md b/docs/BuildNotes.md
new file mode 100644
index 0000000..17d7d81
--- /dev/null
+++ b/docs/BuildNotes.md
@@ -0,0 +1,57 @@
+# Building
+
+Many of the notes below should work outside of Nix,
+by omitting the nix-specific commands or flags.
+
+## Updating cabal build file
+
+```
+$ nix-shell -p haskellPackages.hpack cabal2nix
+$ hpack --force # force may not be necessary
+$ cabal2nix --shell . > package-shell.nix
+```
+
+## Build the project
+
+### Cabal
+
+Note, if things go poorly, it is always worth trying
+`cabal --enable-nix clean` or maybe `cabal clean` as well.
+
+At this point, you can exit the shell used to generate
+the `.cabal` and `.nix` file if you haven't already.
+
+First, make cabal-install available if it isn't, then
+run the build.
+
+```
+$ nix-shell -p cabal-install
+$ nix-shell shell.nix --run "cabal build"
+```
+
+Note that `shell.nix` is a wrapper for the generated
+`package-shell.nix` that only servers to pin nixpkgs,
+so you could either change the version on nixpkgs in
+`shell.nix` or run `nix-shell shell.nix --run "cabal build"`
+directly, which would use your existing nixpkgs channel.
+Of course, this is less likely to work due to potential version
+bound conflicts, but may be useful.
+
+#### Package and release
+
+```
+$ nix-shell shell.nix --run "cabal sdist"
+```
+
+### Stack
+
+```
+$ nix-shell -p stack
+$ stack --nix build
+```
+
+#### Generate documentation (haddocks)
+
+```
+$ stack --nix build --haddock
+```
diff --git a/package-shell.nix b/package-shell.nix
new file mode 100755
index 0000000..b30698f
--- /dev/null
+++ b/package-shell.nix
@@ -0,0 +1,37 @@
+{ nixpkgs ? import <nixpkgs> {}, compiler ? "default", doBenchmark ? false }:
+
+let
+
+ inherit (nixpkgs) pkgs;
+
+ f = { mkDerivation, base, hpack, mtl, stdenv, transformers
+ , unexceptionalio, unexceptionalio-trans
+ }:
+ mkDerivation {
+ pname = "zio";
+ version = "0.1.0.2";
+ src = ./.;
+ libraryHaskellDepends = [
+ base mtl transformers unexceptionalio unexceptionalio-trans
+ ];
+ libraryToolDepends = [ hpack ];
+ testHaskellDepends = [
+ base mtl transformers unexceptionalio unexceptionalio-trans
+ ];
+ prePatch = "hpack";
+ homepage = "https://github.com/bbarker/haskell-zio#readme";
+ description = "App-centric Monad-transformer based on Scala ZIO (UIO + ReaderT + ExceptT)";
+ license = stdenv.lib.licenses.mpl20;
+ };
+
+ haskellPackages = if compiler == "default"
+ then pkgs.haskellPackages
+ else pkgs.haskell.packages.${compiler};
+
+ variant = if doBenchmark then pkgs.haskell.lib.doBenchmark else pkgs.lib.id;
+
+ drv = variant (haskellPackages.callPackage f {});
+
+in
+
+ if pkgs.lib.inNixShell then drv.env else drv
diff --git a/shell.nix b/shell.nix
new file mode 100755
index 0000000..1cf5237
--- /dev/null
+++ b/shell.nix
@@ -0,0 +1,5 @@
+let
+ pkgShell = (import ./package-shell.nix);
+ # 20.09 on 11/20/2020
+ pkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/58f9c4c7d3a42c912362ca68577162e38ea8edfb.tar.gz") {};
+ in pkgShell {nixpkgs = pkgs;}
diff --git a/zio.cabal b/zio.cabal
index 0926b68..e0e041d 100644
--- a/zio.cabal
+++ b/zio.cabal
@@ -1,29 +1,35 @@
-cabal-version: 1.12
+cabal-version: 1.18
--- This file has been generated from package.yaml by hpack version 0.33.0.
+-- This file has been generated from package.yaml by hpack version 0.34.2.
--
-- see: https://github.com/sol/hpack
--
--- hash: 6be80043f3a5bef1bd4f8f34b4c51639fdb74962f2377876443eab74c7fd669e
+-- hash: a6a90a815ae55d95b260ad12add3e1bffdb398a6a256d8dd04c752cc7864f805
name: zio
-version: 0.1.0.0
-description: Please see the README on GitHub at <https://github.com/githubuser/haskell-zio#readme>
-homepage: https://github.com/githubuser/haskell-zio#readme
-bug-reports: https://github.com/githubuser/haskell-zio/issues
+version: 0.1.0.2
+synopsis: App-centric Monad-transformer based on Scala ZIO (UIO + ReaderT + ExceptT).
+description: Please see the README on GitHub at <https://github.com/bbarker/haskell-zio#readme>
+category: Control
+homepage: https://github.com/bbarker/haskell-zio#readme
+bug-reports: https://github.com/bbarker/haskell-zio/issues
author: Brandon Elam Barker
-maintainer: brandon.barker@cornell.edu
+maintainer: brandon.barker@gmail.com
copyright: 2020 Brandon Elam Barker
license: MPL-2.0
license-file: LICENSE
build-type: Simple
extra-source-files:
README.md
+ shell.nix
+ package-shell.nix
ChangeLog.md
+extra-doc-files:
+ docs/BuildNotes.md
source-repository head
type: git
- location: https://github.com/githubuser/haskell-zio
+ location: https://github.com/bbarker/haskell-zio
library
exposed-modules:
@@ -34,11 +40,11 @@ library
src
ghc-options: -Wall -Wtabs -Wincomplete-record-updates
build-depends:
- base >=4.7 && < 5
- , mtl >= 2.2 && < 2.3
- , transformers >= 0.5.6 && < 0.6
- , unexceptionalio >= 0.5.1 && < 0.6
- , unexceptionalio-trans >= 0.5.1 && < 0.6
+ base >=4.7 && <5
+ , mtl >=2.2.2 && <2.3
+ , transformers >=0.5.6 && <0.6
+ , unexceptionalio >=0.5.1 && <0.6
+ , unexceptionalio-trans >=0.5.1 && <0.6
default-language: Haskell2010
test-suite zio-test
@@ -50,10 +56,10 @@ test-suite zio-test
test
ghc-options: -threaded -rtsopts -with-rtsopts=-N
build-depends:
- base
- , mtl
- , transformers
- , unexceptionalio
- , unexceptionalio-trans
+ base >=4.7 && <5
+ , mtl >=2.2.2 && <2.3
+ , transformers >=0.5.6 && <0.6
+ , unexceptionalio >=0.5.1 && <0.6
+ , unexceptionalio-trans >=0.5.1 && <0.6
, zio
default-language: Haskell2010