zio: App-centric Monad-transformer based on Scala ZIO (UIO + Reader + Either/ExceptT).

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

Warnings:

Please see the README on GitHub at https://github.com/bbarker/haskell-zio#readme


[Skip to Readme]

Properties

Versions 0.1.0.0, 0.1.0.1, 0.1.0.2
Change log ChangeLog.md
Dependencies 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) [details]
License MPL-2.0
Copyright 2020 Brandon Elam Barker
Author Brandon Elam Barker
Maintainer brandon.barker@gmail.com
Category Control
Home page https://github.com/bbarker/haskell-zio#readme
Bug tracker https://github.com/bbarker/haskell-zio/issues
Source repo head: git clone https://github.com/bbarker/haskell-zio
Uploaded by bebarker at 2020-11-21T20:01:13Z

Modules

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Readme for zio-0.1.0.1

[back to package description]

haskell-zio

A small monad-transformer analogue to the Scala ZIO library (basically, UIO + Reader + Either/ExceptT).

I like to call ZIO a best-practices monad for applications. It wraps in a Reader monad for carrying around configuration and environment data, and slightly more controversially, makes error-handling more explicit by making all recoverable
exceptions and errors part of the return-type of functions.

Note that this is meant to provide the same basic functionality of the ZIO monad. While I'm not immediately looking into other features of ZIO-the-library, such as concurrency, I welcome suggestions via issues or pull requests.

Comparison to other Haskell libraries

The Scala-Haskell ZIO dictionary

Type Aliases

The Scala ZIO type parameters and aliases are largely reproduced in Haskell, though in some cases we can't exactly reproduce them. For instance, IO is already taken in Haskell at a very fundamental level. As well, UIO has the same meaning as in the Scala implementation, but it isn't an alias, since it is an inner monad of the ZIO type.

An apparent downsize of having UIO, EIO, and ZIO as distinct (non-aliased) types is that one might feel inclined to provide APIs for one or more of these when warranted. For this reason UEIO e, UZIO a, and other aliases along with associated lift and unlift functions are provided. These aliases have Void in the expanded type, and in some cases, it is more appropriate to use a universal quantifier, e.g., when lifting into a type, we usually have some Error type in mind 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.

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]