packages feed

flow 1.0.2 → 1.0.4

raw patch · 9 files changed

+93/−349 lines, 9 filesdep −criteriondep ~basesetup-changed

Dependencies removed: criterion

Dependency ranges changed: base

Files

CHANGELOG.md view
@@ -1,22 +1,7 @@ # Change log  Flow uses [Semantic Versioning][].--## v1.0.2 (2015-10-04)---   Updated documentation.--## v1.0.1 (2015-06-04)---   Updated documentation.--   Supported doctest 0.10.--## v1.0.0 (2015-04-01)---   Initially released.--## v0.0.0 (2015-04-01)---   Initially created.+The change log is available through the [releases on GitHub][]. -[semantic versioning]: http://semver.org/spec/v2.0.0.html+[Semantic Versioning]: http://semver.org/spec/v2.0.0.html+[releases on GitHub]: https://github.com/tfausak/flow/releases
− Flow.hs
@@ -1,226 +0,0 @@-{- |-    Flow provides operators for writing more understandable Haskell. It is an-    alternative to some common idioms like ('Prelude.$') for function-    application and ('Prelude..') for function composition.--    Flow is designed to be imported unqualified. It does not export anything-    that conflicts with the base package.--    >>> import Flow--    == Rationale--    I think that Haskell can be hard to read. It has two operators for applying-    functions. Both are not really necessary and only serve to reduce-    parentheses. But they make code hard to read. People who do not already-    know Haskell have no chance of guessing what @foo $ bar@ or @baz & qux@-    mean.--    Those that do know Haskell are forced to read lines forwards and backwards-    at the same time, thanks to function composition. Even something simple,-    like finding the minimum element, bounces around: @f = head . sort@.--    I think we can do better. By using directional operators, we can allow-    readers to move their eye in only one direction, be that left-to-right or-    right-to-left. And by using idioms common in other programming languages,-    we can allow people who aren't familiar with Haskell to guess at the-    meaning.--    So instead of ('Prelude.$'), I propose ('<|'). It is a pipe, which anyone-    who has touched a Unix system should be familiar with. And it points in the-    direction it sends arguments along. Similarly, replace ('Prelude.&') with-    ('|>'). And for composition, ('<.') replaces ('Prelude..'). I would have-    preferred @<<@, but its counterpart @>>@ is taken by Haskell's syntax.-    So-called "backwards" composition is normally expressed with-    ('Control.Category.>>>'), which Flow provides as ('.>').--}-module Flow (-    -- * Function application-    (|>), (<|), apply,-    -- * Function composition-    (.>), (<.), compose,-    -- * Strict function application-    (!>), (<!), apply',-) where--import Prelude (seq)--{- $setup-    >>> import Prelude-    >>> let f = (+ 3)-    >>> let g = (* 3)-    >>> let h = (^ 3)--}--{- |-    prop> (x |> f) == f x--    prop> (x |> f |> g) == g (f x)--    Left-associative 'apply' operator. Read as "apply forward" or "pipe into".-    Use this to create long chains of computation that suggest which direction-    things move in.--    >>> 3 |> succ |> recip |> negate-    -0.25--    Or use it anywhere you would use ('Prelude.&').--}-infixl 0 |>-(|>) :: a -> (a -> b) -> b-x |> f = apply x f--{- |-    prop> (f <| x) == f x--    prop> (g <| f <| x) == g (f x)--    Right-associative 'apply' operator. Read as "apply backward" or "pipe-    from". Use this to create long chains of computation that suggest which-    direction things move in. You may prefer this operator over ('|>') for-    'Prelude.IO' actions since it puts the last function first.--    >>> print <| negate <| recip <| succ <| 3-    -0.25--    Or use it anywhere you would use ('Prelude.$').--}-infixr 0 <|-(<|) :: (a -> b) -> a -> b-f <| x = apply x f--{- |-    prop> apply x f == f x--    Function application. This function usually isn't necessary, but it can be-    more readable than some alternatives when used with higher-order functions-    like 'Prelude.map'.--    >>> map (apply 2) [succ, recip, negate]-    [3.0,0.5,-2.0]--}-apply :: a -> (a -> b) -> b-apply x f = f x--{- |-    prop> (f .> g) x == g (f x)--    prop> (f .> g .> h) x == h (g (f x))--    Left-associative 'compose' operator. Read as "compose forward" or "and-    then". Use this to create long chains of computation that suggest which-    direction things move in.--    >>> let f = succ .> recip .> negate-    >>> f 3-    -0.25--    Or use it anywhere you would use ('Control.Category.>>>').--}-infixl 9 .>-(.>) :: (a -> b) -> (b -> c) -> (a -> c)-f .> g = compose f g--{- |-    prop> (g <. f) x == g (f x)--    prop> (h <. g <. f) x == h (g (f x))--    Right-associative 'compose' operator. Read as "compose backward" or "but-    first". Use this to create long chains of computation that suggest which-    direction things move in. You may prefer this operator over ('.>') for-    'Prelude.IO' actions since it puts the last function first.--    >>> let f = print <. negate <. recip <. succ-    >>> f 3-    -0.25--    Or use it anywhere you would use ('Prelude..').--}-infixr 9 <.-(<.) :: (b -> c) -> (a -> b) -> (a -> c)-g <. f = compose f g--{- |-    prop> compose f g x == g (f x)--    Function composition. This function usually isn't necessary, but it can be-    more readable than some alternatives when used with higher-order functions-    like 'Prelude.map'.--    >>> let fs = map (compose succ) [recip, negate]-    >>> map (apply 3) fs-    [0.25,-4.0]--}-compose :: (a -> b) -> (b -> c) -> (a -> c)-compose f g = \ x -> g (f x)--{- |-    prop> (x !> f) == seq x (f x)--    prop> (x !> f !> g) == let y = seq x (f x) in seq y (g y)--    Left-associative 'apply'' operator. Read as "strict apply forward" or-    "strict pipe info". Use this to create long chains of computation that-    suggest which direction things move in.--    >>> 3 !> succ !> recip !> negate-    -0.25--    The difference between this and ('|>') is that this evaluates its argument-    before passing it to the function.--    >>> undefined |> const True-    True-    >>> undefined !> const True-    *** Exception: Prelude.undefined--}-infixl 0 !>-(!>) :: a -> (a -> b) -> b-x !> f = apply' x f--{- |-    prop> (f <! x) == seq x (f x)--    prop> (g <! f <! x) == let y = seq x (f x) in seq y (g y)--    Right-associative 'apply'' operator. Read as "strict apply backward" or-    "strict pipe from". Use this to create long chains of computation that-    suggest which direction things move in. You may prefer this operator over-    ('!>') for 'Prelude.IO' actions since it puts the last function first.--    >>> print <! negate <! recip <! succ <! 3-    -0.25--    The difference between this and ('<|') is that this evaluates its argument-    before passing it to the function.--    >>> const True <| undefined-    True-    >>> const True <! undefined-    *** Exception: Prelude.undefined--}-infixr 0 <!-(<!) :: (a -> b) -> a -> b-f <! x = apply' x f--{- |-    prop> apply' x f == seq x (f x)--    Strict function application. This function usually isn't necessary, but it-    can be more readable than some alternatives when used with higher-order-    functions like 'Prelude.map'.--    >>> map (apply' 2) [succ, recip, negate]-    [3.0,0.5,-2.0]--    The different between this and 'apply' is that this evaluates its argument-    before passing it to the function.--    >>> apply undefined (const True)-    True-    >>> apply' undefined (const True)-    *** Exception: Prelude.undefined--}-apply' :: a -> (a -> b) -> b-apply' x f = seq x (apply x f)
− FlowBench.hs
@@ -1,35 +0,0 @@-module Main (main) where--import Criterion.Main-import Flow--main :: IO ()-main = defaultMain-    [ bgroup "application"-        [ bench "f x" (whnf f x)-        , bench "apply x f" (whnf (apply x) f)-        , bench "x |> f" (whnf (x |>) f)-        , bench "f <| x" (whnf (<| x) f)-        ]-    , bgroup "composition"-        [ bench "f . g" (whnf (f .) g)-        , bench "compose f g" (whnf (compose f) g)-        , bench "f .> g" (whnf (f .>) g)-        , bench "g <. f" (whnf (<. f) g)-        ]-    , bgroup "strict application"-        [ bench "seq x (f x)" (whnf (seq x) (f x))-        , bench "apply' x f" (whnf (apply' x) f)-        , bench "x !> f" (whnf (x !>) f)-        , bench "f <! x" (whnf (<! x) f)-        ]-    ]--x :: Int-x = 3--f :: Int -> Int-f y = y + 3--g :: Int -> Int-g y = y * 3
LICENSE.md view
@@ -1,21 +1,23 @@-The MIT License (MIT)+[The MIT License (MIT)][] -Copyright (c) 2015 Taylor Fausak <taylor@fausak.me>+Copyright (c) 2016 Taylor Fausak -Permission is hereby granted, free of charge, to any person obtaining a copy-of this software and associated documentation files (the "Software"), to deal-in the Software without restriction, including without limitation the rights-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell-copies of the Software, and to permit persons to whom the Software is-furnished to do so, subject to the following conditions:+Permission is hereby granted, free of charge, to any person obtaining a copy of+this software and associated documentation files (the "Software"), to deal in+the Software without restriction, including without limitation the rights to+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies+of the Software, and to permit persons to whom the Software is furnished to do+so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in-all copies or substantial portions of the Software.+The above copyright notice and this permission notice shall be included in all+copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN-THE SOFTWARE.+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE+SOFTWARE.++[The MIT License (MIT)]: https://opensource.org/licenses/MIT
README.md view
@@ -2,11 +2,8 @@  Write more understandable Haskell. -[![Version][]](https://hackage.haskell.org/package/flow)-[![Build][]](https://travis-ci.org/tfausak/flow)-[![Dependencies][]](http://packdeps.haskellers.com/feed?needle=flow)-----+[![Version badge][]][version]+[![Build badge][]][build]  Flow is a package that provides functions and operators for writing more understandable Haskell. It is an alternative to some common idioms like@@ -58,10 +55,11 @@  For more information about Flow, please read [the Haddock documentation][]. -[flow]: http://taylor.fausak.me/flow/-[version]: https://img.shields.io/hackage/v/flow.svg?label=version-[build]: https://img.shields.io/travis/tfausak/flow/master.svg?label=build-[dependencies]: https://img.shields.io/hackage-deps/v/flow.svg?label=dependencies+[Flow]: http://taylor.fausak.me/flow/+[Version badge]: https://www.stackage.org/package/flow/badge/nightly?label=version+[version]: https://www.stackage.org/package/flow+[Build badge]: https://travis-ci.org/tfausak/flow.svg?branch=master+[build]: https://travis-ci.org/tfausak/flow [`($)`]: http://hackage.haskell.org/package/base-4.8.0.0/docs/Prelude.html#v:-36- [`(.)`]: http://hackage.haskell.org/package/base-4.8.0.0/docs/Prelude.html#v:. [the change log]: CHANGELOG.md
Setup.hs view
@@ -1,6 +1,4 @@-module Main (main) where--import Distribution.Simple (defaultMain)+import qualified Distribution.Simple  main :: IO ()-main = defaultMain+main = Distribution.Simple.defaultMain
flow.cabal view
@@ -1,53 +1,44 @@-name: flow-version: 1.0.2-cabal-version: >=1.8-build-type: Simple-license: MIT-license-file: LICENSE.md-copyright: 2015 Taylor Fausak <taylor@fausak.me>-maintainer: Taylor Fausak <taylor@fausak.me>-homepage: http://taylor.fausak.me/flow/-bug-reports: https://github.com/tfausak/flow/issues-synopsis: Write more understandable Haskell.-description:-    Flow provides operators for writing more understandable Haskell. It is an-    alternative to some common idioms like (@$@) for function application and-    (@.@) for function composition.-category: Combinators, Functions, Utility-author: Taylor Fausak <taylor@fausak.me>+-- This file has been generated from package.yaml by hpack version 0.9.0.+--+-- see: https://github.com/sol/hpack++name:           flow+version:        1.0.4+synopsis:       Write more understandable Haskell.+description:    Flow provides operators for writing more understandable Haskell.+category:       Combinators, Functions, Utility+homepage:       https://github.com/tfausak/flow#readme+bug-reports:    https://github.com/tfausak/flow/issues+maintainer:     Taylor Fausak+license:        MIT+build-type:     Simple+cabal-version:  >= 1.10+ extra-source-files:     CHANGELOG.md+    LICENSE.md+    package.yaml     README.md+    stack.yaml  source-repository head-    type: git-    location: https://github.com/tfausak/flow+  type: git+  location: https://github.com/tfausak/flow  library-    exposed-modules:-        Flow-    build-depends:-        base <5-    ghc-options: -Wall--test-suite test-    type: exitcode-stdio-1.0-    main-is: FlowTest.hs-    build-depends:-        base -any,-        flow -any,-        doctest >=0.9 && <0.11,-        QuickCheck ==2.*,-        template-haskell ==2.*-    ghc-options: -Wall+  ghc-options: -Wall+  build-depends:+      base <5+  default-language: Haskell2010 -benchmark bench-    type: exitcode-stdio-1.0-    main-is: FlowBench.hs-    build-depends:-        base -any,-        flow -any,-        criterion ==1.*-    other-modules:-        Flow-    ghc-options: -Wall+test-suite flow-test-suite+  type: exitcode-stdio-1.0+  main-is: FlowTest.hs+  ghc-options: -Wall+  build-depends:+      base+    , doctest >=0.9 && <0.11+    , flow+    , QuickCheck ==2.*+    , template-haskell ==2.*+  default-language: Haskell2010
+ package.yaml view
@@ -0,0 +1,28 @@+category: Combinators, Functions, Utility+description: Flow provides operators for writing more understandable Haskell.+extra-source-files:+- CHANGELOG.md+- LICENSE.md+- package.yaml+- README.md+- stack.yaml+ghc-options:+- -Wall+github: tfausak/flow+library:+  dependencies:+  - base <5+license: MIT+maintainer: Taylor Fausak+name: flow+synopsis: Write more understandable Haskell.+tests:+  flow-test-suite:+    dependencies:+    - base+    - doctest >=0.9 && <0.11+    - flow+    - QuickCheck ==2.*+    - template-haskell ==2.*+    main: FlowTest.hs+version: '1.0.4'
+ stack.yaml view
@@ -0,0 +1,3 @@+install-ghc: true+require-stack-version: ! '>=1.0.4'+resolver: lts-5.8