The between package

[ Tags: bsd3, data, library ] [ Propose Tags ]

It turns out that this combinator

f ~@~ g = (f .) . (. g)

is a powerful thing. It was abstracted from following (commonly used) pattern f . h . g where f and g are fixed.

This library not only defines ~@~ combinator, but also some derived combinators that can help us easily define a lot of things including lenses. See lens package for detais on what lenses are.

Function Data.Function.on can be implemented using ~@~ as:

on :: (b -> b -> c) -> (a -> b) -> a -> a -> c
on f g = (id ~@~ g ~@~ g) f

If function on3 existed in base then it could be defined as:

on3 :: (b -> b -> b -> d) -> (a -> b) -> a -> a -> a -> d
on3 f g = (id ~@~ g ~@~ g ~@~ g) f

Other usage examples and documentation can be found in Data.Function.Between module.


[Skip to Readme]

Properties

Versions 0.9.0.0, 0.9.0.1, 0.9.0.2, 0.10.0.0, 0.11.0.0
Change log ChangeLog.md
Dependencies base (>3 && <5) [details]
License BSD3
Copyright (c) 2013-2016, Peter Trško
Author Peter Trško
Maintainer peter.trsko@gmail.com
Category Data
Home page https://github.com/trskop/between
Bug tracker https://github.com/trskop/between/issues
Source repository head: git clone git://github.com/trskop/between.git
this: git clone git://github.com/trskop/between.git(tag v0.11.0.0)
Uploaded Sat Jan 9 12:06:16 UTC 2016 by PeterTrsko
Distributions LTSHaskell:0.11.0.0, NixOS:0.11.0.0, Stackage:0.11.0.0, Tumbleweed:0.11.0.0
Downloads 1041 total (8 in the last 30 days)
Rating 0.0 (0 ratings) [clear rating]
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2016-01-09 [all 1 reports]
Hackage Matrix CI

Modules

[Index]

Flags

NameDescriptionDefaultType
pedantic

Pass additional warning flags to GHC.

DisabledManual

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Maintainer's Corner

For package maintainers and hackage trustees


Readme for between-0.11.0.0

[back to package description]

Between

Hackage Hackage Dependencies Haskell Programming Language BSD3 License

Build

Description

It turns out that this combinator

f ~@~ g = (f .) . (. g)

is a powerful thing. It was abstracted from following (commonly used) pattern f . h . g where f and g are fixed.

This library not only define ~@~ combinator, but also some derived combinators that can help us to easily define a lot of things including lenses. See lens package for detais on what lenses are.

Function Data.Function.on can be implemented using ~@~ as:

on :: (b -> b -> c) -> (a -> b) -> a -> a -> c
on f g = (id ~@~ g ~@~ g) f

If function @on3@ existed in /base/ then it could be defined as:

on3 :: (b -> b -> b -> d) -> (a -> b) -> a -> a -> a -> d
on3 f g = (id ~@~ g ~@~ g ~@~ g) f

For more examples see documentation.

Documentation

Stable releases with API documentation are available on Hackage.

Building Options

  • -fpedantic (disabled by default)

    Pass additional warning flags to GHC.

License

The BSD 3-Clause License, see LICENSE file for details.

Contributions

Contributions, pull requests and bug reports are welcome! Please don't be afraid to contact author using GitHub or by e-mail (see .cabal file for that).