between

Function combinator "between" and derived combinators https://github.com/trskop/between

LTS Haskell 8.15:0.11.0.0
Stackage Nightly 2017-05-24:0.11.0.0
Latest on Hackage:0.11.0.0
BSD3 licensed by Peter Trško

Between

Hackage Hackage Dependencies Haskell Programming Language [BSD3 License][tl;dr Legal: BSD3]

Build

Description

It turns out that this combinator

Haskell 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:

Haskell 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:

Haskell 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).

https://hackage.haskell.org/package/between
http://hackage.haskell.org/package/lens

http://www.haskell.org "The Haskell Programming Language" [tl;dr Legal: BSD3]: https://tldrlegal.com/license/bsd-3-clause-license-%28revised%29 "BSD 3-Clause License (Revised)" [LICENSE]: https://github.com/trskop/between/blob/master/LICENSE "License of between package."

Changes

ChangeLog / ReleaseNotes

Version 0.11.0.0

  • New function application combinators (new):
    • inbetween :: a -> b -> (a -> b -> r) -> r
    • (~$~) :: a -> b -> (a -> b -> r) -> r
    • (~$$~) :: b -> a -> (a -> b -> r) -> r
    • withIn :: ((a -> b -> r) -> r) -> (a -> b -> r) -> r
    • withReIn :: ((b -> a -> r) -> r) -> (a -> b -> r) -> r
  • Precursors to Iso, Lens and Prism (new):
    • type PreIso r s t a b = ((b -> t) -> (s -> a) -> r) -> r
    • type PreIso' r s a = PreIso r s s a a
    • type PreLens r s t a b = ((b -> s -> t) -> (s -> a) -> r) -> r
    • type PreLens' r s a = PreLens r s s a a
    • type PrePrism r s t a b = ((b -> t) -> (s -> Either t a) -> r) -> r
    • type PrePrism' r s a = PrePrism r s s a a
  • Uploaded to Hackage: http://hackage.haskell.org/package/between-0.11.0.0

Version 0.10.0.0

  • Original implementation moved to module Data.Function.Between.Lazy and is now reexported by Data.Function.Between. (new)
  • Implementation of strict variants of all functions defined in Data.Function.Between.Lazy module. These new functions use (f . g) x = f '$!' g '$!' x as definition for function composition where $! is strict application. (new)
  • Uploaded to Hackage: http://hackage.haskell.org/package/between-0.10.0.0

Version 0.9.0.2

Version 0.9.0.1

Version 0.9.0.0

http://hackage.haskell.org/ "HackageDB (or just Hackage) is a collection of releases of Haskell packages." [Haskell Platform]: http://www.haskell.org/platform/ "The Haskell Platform" [ghc-core]: http://hackage.haskell.org/package/ghc-core "Display GHC's core and assembly output in a pager"

Depends on:
Used by 2 packages:
comments powered byDisqus