packages feed

compose-ltr (empty) → 0.1.1

raw patch · 6 files changed

+120/−0 lines, 6 filesdep +QuickCheckdep +basedep +compose-ltrsetup-changed

Dependencies added: QuickCheck, base, compose-ltr, hspec

Files

+ LICENSE view
@@ -0,0 +1,20 @@+Copyright (c) 2015 Milán Nagy++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 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.
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ compose-ltr.cabal view
@@ -0,0 +1,39 @@+-- Initial compose-ltr.cabal generated by cabal init.  For further+-- documentation, see http://haskell.org/cabal/users-guide/++name:                compose-ltr+version:             0.1.1+synopsis:            More intuitive, left-to-right function composition.+description:         More intuitive, left-to-right function composition.+-- description:+license:             MIT+license-file:        LICENSE+author:              Milán Nagy+maintainer:          123.wizek@gmail.com+-- copyright:+category:            Data+build-type:          Simple+-- extra-source-files:+cabal-version:       >=1.10++source-repository head+  type: git+  location: git://github.com/Wizek/compose-ltr.git++library+  exposed-modules:     Data.Function.Compose.LeftToRight, ComposeLTR+  -- other-modules:+  -- other-extensions:+  build-depends:       base >4 && <5+  hs-source-dirs:      src+  default-language:    Haskell2010++test-suite spec+  type:                exitcode-stdio-1.0+  main-is:             Spec.hs+  build-depends:       QuickCheck ==2.8.1+                     , base >4 && <5+                     , hspec ==2.2.0+                     , compose-ltr+  hs-source-dirs:      spec+  default-language:    Haskell2010
+ spec/Spec.hs view
@@ -0,0 +1,43 @@+import Test.Hspec+import Test.QuickCheck+import Test.QuickCheck.Function+-- import Data.Function.Compose.LeftToRight+import ComposeLTR++prop1 f g = (f $ g) == (g $> f)+prop2 f g = ((g . f) 1) == (1 $> (f .> g))++main = hspec $ do+  describe "compose-ltr" $ do++    describe "$>" $ do+      it "should compose" $ do++        (1 $> (+2) $> (*2)) `shouldBe` 6++        "Hello World"+          $> reverse+          $> ("!" ++)+          $> take <$ 1 + 5+          $> (`shouldBe` "!dlroW")++        let+          fn = id+            .> reverse+            .> ("!" ++)+            .> (take <$ 1 + 5)++        (fn "Hello World") `shouldBe` "!dlroW"++      it "should work just like the Prelude version" $ do+        let+          prop :: (Fun Int Int) -> Int -> Bool+          prop (Fun _ f) g = prop1 f g+        property prop++    describe ".>" $ do+      it "should work just like the Prelude version" $ do+        let+          prop :: (Fun Int Int) -> (Fun Int Int) -> Bool+          prop (Fun _ f) (Fun _ g) = prop2 f g+        property prop
+ src/ComposeLTR.hs view
@@ -0,0 +1,3 @@+-- Shorthand import+module ComposeLTR (module Data.Function.Compose.LeftToRight) where+import Data.Function.Compose.LeftToRight
+ src/Data/Function/Compose/LeftToRight.hs view
@@ -0,0 +1,13 @@+module Data.Function.Compose.LeftToRight (($>), (.>), (<$), (<.)) where++(.>) = flip (.)+infixl 9 .>++($>) = flip ($)+infixl 0 $>++(<$) = ($)+infixl 1 <$++(<.) = (.)+infixl 9 <.