optics-operators 0.1.0.0 → 0.1.0.1
raw patch · 2 files changed
+13/−7 lines, 2 filesdep ~tasty
Dependency ranges changed: tasty
Files
- README.lhs +5/−6
- optics-operators.cabal +8/−1
README.lhs view
@@ -1,6 +1,6 @@ # optics-operators -[](https://github.com/qwbarch/optics-operators/actions/workflows/build.yml) [](https://opensource.org/licenses/MIT)+[](https://github.com/qwbarch/optics-operators/actions/workflows/build.yml) [](https://opensource.org/licenses/MIT) [](https://hackage.haskell.org/package/optics-operators) A tiny package containing operators missing from the official package. @@ -21,9 +21,8 @@ ```haskell {-# LANGUAGE DeriveGeneric, OverloadedLabels #-} import GHC.Generics (Generic)-import Control.Monad.State (StateT, execStateT)+import Control.Monad.State (State, execState) import Data.Optics.Operators ((+=), (-=), (*=))-import Control.Monad ((<=<)) ``` Basic example using state operators:@@ -32,10 +31,10 @@ { age :: Int } deriving (Show, Generic) -addAge :: Int -> StateT Person IO ()+addAge :: Int -> State Person () addAge age = #age += age -subtractAge :: Int -> StateT Person IO ()+subtractAge :: Int -> State Person () subtractAge age = #age -= age ``` @@ -45,7 +44,7 @@ person = Person 50 main :: IO ()-main = print <=< flip execStateT person $ do+main = print . flip execState person $ do addAge 10 subtractAge 20 #age *= 2
optics-operators.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack name: optics-operators-version: 0.1.0.0+version: 0.1.0.1 synopsis: A tiny package containing operators missing from the official package. description: A tiny package containing operators missing from the official package. Basic example using state operators:@@ -29,6 +29,11 @@ extra-doc-files: CHANGELOG.md +flag build-readme+ description: Build the literate haskell README example.+ manual: False+ default: False+ library exposed-modules: Data.Optics.Operators@@ -55,6 +60,8 @@ base >=4.10 && <5 , mtl ==2.* , optics-core >=0.4 && <1+ if !flag(build-readme)+ buildable: False default-language: Haskell2010 test-suite unit-test