Prelude based on protolude for GHC 8 and beyond. https://gitlab.com/theunixman/liblawless
|Latest on Hackage:||0.24.0|
This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow stackage.org to host generated Haddocks.
liblawless: An Effectful Foundation
liblawless is a replacement for the standard Prelude. It targets GHC 8.0 and newer. It's core is building a fine-grained but readily accessible Effect model to move more type checking of code that changes its environment out of plain IO.
Pure vs Effectful Functions
Pure functions don't affect the anything outside of the function. A Pure function will run a calculation on the given values, and return a result. If you pass in the same parameters, you'll always get the same result no matter how many times you call the function.
Effectful functions are functions that do affect the program outside the function, and often the environment outside the computer running them. Even with the same parameters, Effectful Functions can return different results. In many cases they can even return signals that completing their task wasn't possible. In many languages these are called "Side Effects", and aren't modeled in the type system at all. Haskell comes with a simple Effect model in its type system, the [io][IO monad].
Kinds of Effects
The [io][IO monad] models Effects a function has on the world outside the program. There are other, more limited Effects as well, and there are libraries for managing these as well. The two most common are:
- [mtl][The MTL]
These model Effects that only apply to the current program, while the IO monad models ''all other effects'' on the world. That's a really broad brush. Most bugs in Haskell code are in the IO monad.
This project is implementing several extra types of Effects that affect the world. Instead of treating them all the same, though, it breaks them up into much smaller kinds of Effects. For example, for accessing files, it's possible to:
- read bytes from a file
- write bytes to a file
- read lines of text from a file
- write lines of text from a file
- read arbitrary data from a file, operate on these data items, and write them to a network stream
- many other simple and complex operations
We are building them on top of the [machines][Machines] library. This library offers a composable model for connecting strongly-typed streams together. It also implements provisions for arbitrary effects, and connecting Effectful functions with Pure functions into streams of computations. When combined with the [async][Async] library, these streams, and even individual nodes in these streams, can be run concurrently and safely, making full use of multicore systems.
* liblawless.cabal (0.17.3): 0.17.3
* Source/Path.hs: Export more pathtype functions.
* liblawles.cabal (0.17.2): 0.17.2
* Source/Path.hs: Export the path operators.
* test.sh: Build and run tests.
* hackage.sh: Upload tagged package to hackage.
2016-12-17 Evan Cofsky <firstname.lastname@example.org>
* liblawless.cabal: Add new tests and Arbitrary module.
* Tests/TestAesonEncoding.hs: Tests for the JSON field encoding
* Source/Arbitrary.hs: Instances of Arbitrary for various useful
* Tests: Use new Arbitrary instances.
2016-12-16 Evan Cofsky <email@example.com>
* liblawless.cabal (0.14.0.3):
Use dns-2.0.8 which is available in Debian.
Update location information for this release.
* Examples/ZFS/zpools.yaml: Rename from zpool.yaml.
* liblawless.cabal: Uncomment ZFS example build.
* Source/Yaml.hs: Import and export Generics here, too.
* Examples/ZFS: Create Types, use optics, add Main.hs.
* Source/Aeson.hs: Rename molude to lawless.
* Tests/TestAeson.hs: Rename molude to lawless.
* liblawless.cabal (0.14.0): Adding Networking library, clearing
up NFC Text, focusing more on examples and tests.
* Source/Text.hs: Clearer notion of NFC optics vs regular Lens
* Source/Networking.hs: Created this file to start composing
various network libraries together.