packages feed

flow 2.0.0.1 → 2.0.0.2

raw patch · 4 files changed

+60/−47 lines, 4 filesdep ~basePVP ok

version bump matches the API change (PVP)

Dependency ranges changed: base

API changes (from Hackage documentation)

Files

LICENSE.markdown view
@@ -1,6 +1,6 @@ MIT License -Copyright (c) 2022 Taylor Fausak+Copyright (c) 2023 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
flow.cabal view
@@ -1,7 +1,7 @@ cabal-version: 2.2  name: flow-version: 2.0.0.1+version: 2.0.0.2  synopsis: Write more understandable Haskell. description: Flow provides operators for writing more understandable Haskell.@@ -24,23 +24,20 @@  common library   build-depends:-    , base >= 4.13.0 && < 4.18+    , base >= 4.15.0 && < 4.18   default-language: Haskell2010   ghc-options:     -Weverything     -Wno-all-missed-specialisations     -Wno-implicit-prelude     -Wno-missing-exported-signatures+    -Wno-missing-safe-haskell-mode+    -Wno-prepositive-qualified-module     -Wno-safe    if flag(pedantic)     ghc-options: -Werror -  if impl(ghc >= 8.10)-    ghc-options:-      -Wno-missing-safe-haskell-mode-      -Wno-prepositive-qualified-module- common executable   import: library @@ -56,7 +53,7 @@   exposed-modules: Flow   hs-source-dirs: source/library -test-suite test+test-suite flow-test-suite   import: executable    build-depends:
source/library/Flow.hs view
@@ -32,14 +32,23 @@ -- 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,+module Flow+  ( -- * Function application+    (|>),+    (<|),+    apply,+     -- * Function composition-    (.>), (<.), compose,+    (.>),+    (<.),+    compose,+     -- * Strict function application-    (!>), (<!), apply',-) where+    (!>),+    (<!),+    apply',+  )+where  import Prelude (seq) @@ -56,6 +65,7 @@ -- -- prop> \ x -> (x |> f |> g) == g (f x) infixl 0 |>+ (|>) :: a -> (a -> b) -> b x |> f = apply x f @@ -79,6 +89,7 @@ -- -- prop> \ x -> (g <| f <| x) == g (f x) infixr 0 <|+ (<|) :: (a -> b) -> a -> b f <| x = apply x f @@ -116,6 +127,7 @@ -- -- prop> \ x -> (f .> g .> h) x == h (g (f x)) infixl 9 .>+ (.>) :: (a -> b) -> (b -> c) -> (a -> c) f .> g = compose f g @@ -140,6 +152,7 @@ -- -- prop> \ x -> (h <. g <. f) x == h (g (f x)) infixr 9 <.+ (<.) :: (b -> c) -> (a -> b) -> (a -> c) g <. f = compose f g @@ -184,6 +197,7 @@ -- -- prop> \ x -> (x !> f !> g) == let y = seq x (f x) in seq y (g y) infixl 0 !>+ (!>) :: a -> (a -> b) -> b x !> f = apply' x f @@ -214,6 +228,7 @@ -- -- prop> \ x -> (g <! f <! x) == let y = seq x (f x) in seq y (g y) infixr 0 <!+ (<!) :: (a -> b) -> a -> b f <! x = apply' x f 
source/test-suite/Main.hs view
@@ -5,37 +5,38 @@  main :: IO () main = do-  counts <- Test.runTestTT $ Test.TestList-    [ True Test.~?= True-    , (3 Flow.|> succ Flow.|> recip Flow.|> negate) Test.~?= (-0.25 :: Double)-    , (negate Flow.<| recip Flow.<| succ Flow.<| 3) Test.~?= (-0.25 :: Double)-    , fmap (Flow.apply 2) [succ, recip, negate] Test.~?= [3, 0.5, -2 :: Double]-    , fmap (2 Flow.|>) [succ, recip, negate] Test.~?= [3, 0.5, -2 :: Double]-    , fmap (2 Flow.|>) [succ, recip, negate] Test.~?= [3, 0.5, -2 :: Double]-    , fmap (Flow.<| 2) [succ, recip, negate] Test.~?= [3, 0.5, -2 :: Double]-    , fmap (Flow.apply 3 . Flow.compose succ) [recip, negate]-      Test.~?= [0.25, -4 :: Double]-    , (succ Flow..> recip Flow..> negate) 3 Test.~?= (-0.25 :: Double)-    , (negate Flow.<. recip Flow.<. succ) 3 Test.~?= (-0.25 :: Double)-    , fmap ((\f -> f 3) . (succ Flow..>)) [recip, negate]-      Test.~?= [0.25, -4 :: Double]-    , fmap ((\f -> f 3) . (succ Flow..>)) [recip, negate]-      Test.~?= [0.25, -4 :: Double]-    , fmap ((\f -> f 3) . (Flow.<. succ)) [recip, negate]-      Test.~?= [0.25, -4 :: Double]-    , (3 Flow.!> succ Flow.!> recip Flow.!> negate) Test.~?= (-0.25 :: Double)-    , (undefined Flow.|> const True) Test.~?= True-    , (negate Flow.<! recip Flow.<! succ Flow.<! 3) Test.~?= (-0.25 :: Double)-    , (const True Flow.<| undefined) Test.~?= True-    , fmap (Flow.apply' 2) [succ, recip, negate]-      Test.~?= [3, 0.5, -2 :: Double]-    , Flow.apply undefined (const True) Test.~?= True-    , fmap (2 Flow.!>) [succ, recip, negate] Test.~?= [3, 0.5, -2 :: Double]-    , fmap (2 Flow.!>) [succ, recip, negate] Test.~?= [3, 0.5, -2 :: Double]-    , fmap (Flow.<! 2) [succ, recip, negate] Test.~?= [3, 0.5, -2 :: Double]-    ]+  counts <-+    Test.runTestTT $+      Test.TestList+        [ True Test.~?= True,+          (3 Flow.|> succ Flow.|> recip Flow.|> negate) Test.~?= (-0.25 :: Double),+          (negate Flow.<| recip Flow.<| succ Flow.<| 3) Test.~?= (-0.25 :: Double),+          fmap (Flow.apply 2) [succ, recip, negate] Test.~?= [3, 0.5, -2 :: Double],+          fmap (2 Flow.|>) [succ, recip, negate] Test.~?= [3, 0.5, -2 :: Double],+          fmap (2 Flow.|>) [succ, recip, negate] Test.~?= [3, 0.5, -2 :: Double],+          fmap (Flow.<| 2) [succ, recip, negate] Test.~?= [3, 0.5, -2 :: Double],+          fmap (Flow.apply 3 . Flow.compose succ) [recip, negate]+            Test.~?= [0.25, -4 :: Double],+          (succ Flow..> recip Flow..> negate) 3 Test.~?= (-0.25 :: Double),+          (negate Flow.<. recip Flow.<. succ) 3 Test.~?= (-0.25 :: Double),+          fmap ((\f -> f 3) . (succ Flow..>)) [recip, negate]+            Test.~?= [0.25, -4 :: Double],+          fmap ((\f -> f 3) . (succ Flow..>)) [recip, negate]+            Test.~?= [0.25, -4 :: Double],+          fmap ((\f -> f 3) . (Flow.<. succ)) [recip, negate]+            Test.~?= [0.25, -4 :: Double],+          (3 Flow.!> succ Flow.!> recip Flow.!> negate) Test.~?= (-0.25 :: Double),+          (undefined Flow.|> const True) Test.~?= True,+          (negate Flow.<! recip Flow.<! succ Flow.<! 3) Test.~?= (-0.25 :: Double),+          (const True Flow.<| undefined) Test.~?= True,+          fmap (Flow.apply' 2) [succ, recip, negate]+            Test.~?= [3, 0.5, -2 :: Double],+          Flow.apply undefined (const True) Test.~?= True,+          fmap (2 Flow.!>) [succ, recip, negate] Test.~?= [3, 0.5, -2 :: Double],+          fmap (2 Flow.!>) [succ, recip, negate] Test.~?= [3, 0.5, -2 :: Double],+          fmap (Flow.<! 2) [succ, recip, negate] Test.~?= [3, 0.5, -2 :: Double]+        ] -  let-    hasErrors = Test.errors counts /= 0-    hasFailures = Test.failures counts /= 0+  let hasErrors = Test.errors counts /= 0+      hasFailures = Test.failures counts /= 0   Monad.when (hasErrors || hasFailures) Exit.exitFailure