@hackage / optics-operators

A tiny package containing operators missing from the official package.

Latest0.1.0.1

About

Metadata

  • Last updated , by qwbarch
  • License MIT
  • Categories Lenses
  • Maintained by: qwbarch <qwbarch@gmail.com>

  • Lottery factor: 0

Links

Installation

Package Flags

Use the -f option with cabal commands to enable flags

    build-readme (off by default)

    Build the literate haskell README example.

Readme

A tiny package containing operators missing from the official package. Basic example using state operators:

newtype Person = Person { age :: Int } deriving (Show, Generic)

main :: IO ()
main = print <=< flip execStateT (Person 0) $ do
  #age += 50
  #age -= 20

-- Output: Person {age = 30}