on master help sign in
Update description
commit8f20c153930b9f96cee4d95ec1a5139490f5f843 authorAndrzej Rybczak <andrzej@rybczak.net> dateFri 11 Jun 2021, 15:26 (5 years ago) parent0ce4d7d
3 files changed+29−10
README.md+18−1 effective.cabal+5−3 examples/FileSystem.hs+6−6
README.md+18−1
@@ -2,7 +2,7 @@
22
33[![Build Status](https://github.com/arybczak/effective/workflows/Haskell-CI/badge.svg?branch=master)](https://github.com/arybczak/effective/actions?query=branch%3Amaster)
44
5−An effect system based on the [ReaderT design pattern](https://www.fpcomplete.com/blog/2017/06/readert-design-pattern/).
5+A simple, yet powerful extensible effects library.
66
77Main features:
88
@@ -25,3 +25,20 @@ Main features:
2525A `Filesystem` effect with two handlers, one that runs in `IO` and another that
2626uses an in-memory virtual file system can be found
2727[here](https://github.com/arybczak/effective/blob/master/examples/FileSystem.hs).
28+
29+## Resources
30+
31+Resources that inspired the rise of this library and had a lot of impact on its
32+design.
33+
34+Talks:
35+
36+* [Monad Transformer State](https://www.youtube.com/watch?v=KZIN9f9rI34) by Michael Snoyman.
37+
38+* [Effects for Less](https://www.youtube.com/watch?v=0jI-AlWEwYI) by Alexis King.
39+
40+Blog posts:
41+
42+* [ReaderT design pattern](https://www.fpcomplete.com/blog/2017/06/readert-design-pattern/) by Michael Snoyman.
43+
44+* [Exceptions Best Practices](https://www.fpcomplete.com/blog/2016/11/exceptions-best-practices-haskell/) by Michael Snoyman.
effective.cabal+5−3
@@ -7,12 +7,13 @@ license-file: LICENSE
77category: Control
88maintainer: andrzej@rybczak.net
99author: Andrzej Rybczak
10−synopsis: An effect system based on the ReaderT design pattern.
10+synopsis: A simple, yet powerful extensible effects library.
1111
12−description: An effect system based on the ReaderT design pattern, combining
13− advantages of both.
12+description: A simple, yet powerful extensible effects library with seamless
13+ integration with the Haskell ecosystem.
1414
1515extra-source-files: CHANGELOG.md
16+
1617tested-with: GHC ==8.0.2 || ==8.2.2 || ==8.4.4 || ==8.6.5 || ==8.8.4 || ==8.10.4
1718 || ==9.0.1 || ==9.2.0.20210422
1819
@@ -55,6 +56,7 @@ library
5556 import: language
5657
5758 build-depends: base <5
59+ , containers
5860 , exceptions
5961 , ghc-prim
6062 , monad-control
examples/FileSystem.hs+6−6
@@ -32,14 +32,14 @@ instance Exception FsError
3232-- Operations
3333
3434-- | Read contents of a file.
35−readFile :: (FileSystem :> es, Error FsError :> es) => FilePath -> String -> Eff es ()
36−readFile path contents = stateEffectM $ \FileSystem{..} -> do
37− fs <- _writeFile _fs path contents
38− pure ((), FileSystem { _fs = fs, .. })
35+readFile :: (FileSystem :> es, Error FsError :> es) => FilePath -> Eff es String
36+readFile path = readerEffectM $ \FileSystem{..} -> _readFile _fs path
3937
4038-- | Write contents to a file.
41−writeFile :: (FileSystem :> es, Error FsError :> es) => FilePath -> Eff es String
42−writeFile path = readerEffectM $ \FileSystem{..} -> _readFile _fs path
39+writeFile :: (FileSystem :> es, Error FsError :> es) => FilePath -> String -> Eff es ()
40+writeFile path contents = stateEffectM $ \FileSystem{..} -> do
41+ fs <- _writeFile _fs path contents
42+ pure ((), FileSystem { _fs = fs, .. })
4343
4444----------------------------------------
4545-- Handlers