Skip to content

Commit

Permalink
Prepare for hackage release
Browse files Browse the repository at this point in the history
  • Loading branch information
qwbarch committed Jun 24, 2023
1 parent 3d1696c commit c94bac7
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 22 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Changelog

## [0.1.0.0] - 6/24/2023

- First release of optics-operators.
- Provides only (+=), (-=), (*=), (//=) operators for now.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ Necessary language extensions and imports for the example:
```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:
Expand All @@ -32,10 +31,10 @@ newtype Person = Person
{ 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
```

Expand All @@ -45,7 +44,7 @@ person :: Person
person = Person 50

main :: IO ()
main = print <=< flip execStateT person $ do
main = print . flip execState person $ do
addAge 10
subtractAge 20
#age *= 2
Expand Down
20 changes: 16 additions & 4 deletions optics-operators.cabal
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cabal-version: 1.12
cabal-version: 1.18

-- This file has been generated from package.yaml by hpack version 0.34.7.
--
Expand All @@ -8,13 +8,26 @@ name: optics-operators
version: 0.1.0.0
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:
.
> 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}
category: Data, Optics, Lenses
homepage: https://github.com/qwbarch/optics-operators
bug-reports: https://github.com/qwbarch/optics-operators/issues
author: qwbarch
maintainer: qwbarch <qwbarch@gmail.com>
license: MIT
license-file: LICENSE
build-type: Simple
extra-doc-files:
CHANGELOG.md

library
exposed-modules:
Expand All @@ -23,7 +36,6 @@ library
Paths_optics_operators
hs-source-dirs:
src
ghc-options: -threaded -rtsopts -with-rtsopts=-N -O2 -flate-specialise -fspecialise-aggressively -Wall -Wno-name-shadowing
build-depends:
base >=4.10 && <5
, mtl ==2.*
Expand All @@ -38,7 +50,7 @@ executable readme
hs-source-dirs:
./
src
ghc-options: -threaded -rtsopts -with-rtsopts=-N -O2 -flate-specialise -fspecialise-aggressively -Wall -Wno-name-shadowing -pgmL markdown-unlit
ghc-options: -threaded -rtsopts -with-rtsopts=-N -flate-specialise -fspecialise-aggressively -Wall -Wno-name-shadowing -pgmL markdown-unlit
build-depends:
base >=4.10 && <5
, mtl ==2.*
Expand All @@ -54,7 +66,7 @@ test-suite unit-test
hs-source-dirs:
src
test
ghc-options: -threaded -rtsopts -with-rtsopts=-N -O2 -flate-specialise -fspecialise-aggressively -Wall -Wno-name-shadowing
ghc-options: -threaded -rtsopts -with-rtsopts=-N -flate-specialise -fspecialise-aggressively -Wall -Wno-name-shadowing
build-depends:
base >=4.10 && <5
, mtl ==2.*
Expand Down
46 changes: 33 additions & 13 deletions package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,26 @@ name: optics-operators
version: 0.1.0.0
license: MIT
license-file: LICENSE
author: qwbarch
maintainer: qwbarch <qwbarch@gmail.com>
category: Data, Optics, Lenses
synopsis: A tiny package containing operators missing from the official package.
description: A tiny package containing operators missing from the official package.
homepage: https://github.com/qwbarch/optics-operators
bug-reports: https://github.com/qwbarch/optics-operators/issues
extra-doc-files: CHANGELOG.md

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:
> 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}
library:
source-dirs:
Expand All @@ -19,7 +33,15 @@ executables:
source-dirs:
- .
- src
ghc-options: -pgmL markdown-unlit
ghc-options:
- -threaded
- -rtsopts
- -with-rtsopts=-N
- -flate-specialise
- -fspecialise-aggressively
- -Wall
- -Wno-name-shadowing
- -pgmL markdown-unlit

tests:
unit-test:
Expand All @@ -30,16 +52,14 @@ tests:
dependencies:
- tasty >= 1.4.3 && < 1.5
- tasty-quickcheck >= 0.10.2 && < 0.11

ghc-options:
- -threaded
- -rtsopts
- -with-rtsopts=-N
- -O2
- -flate-specialise
- -fspecialise-aggressively
- -Wall
- -Wno-name-shadowing
ghc-options:
- -threaded
- -rtsopts
- -with-rtsopts=-N
- -flate-specialise
- -fspecialise-aggressively
- -Wall
- -Wno-name-shadowing

dependencies:
- base >= 4.10 && < 5
Expand Down

0 comments on commit c94bac7

Please # to comment.