BSD-3-Clause licensed by Peter Trško
Maintained by [email protected]
This version can be pinned in stack with:between-0.11.0.0@sha256:05c82afced3a60a6e7d624d6c1d410f6b1d3de264a663cc53237bef4b63e0322,2463
Depends on 1 package(full list with versions):
Used by 1 package in lts-13.11(full list with versions):

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

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