summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Hakyll/Core/Util/Arrow.hs4
-rw-r--r--tests/Hakyll/Core/Util/Arrow/Tests.hs14
-rw-r--r--tests/TestSuite.hs3
3 files changed, 19 insertions, 2 deletions
diff --git a/src/Hakyll/Core/Util/Arrow.hs b/src/Hakyll/Core/Util/Arrow.hs
index 1896e11..f46d083 100644
--- a/src/Hakyll/Core/Util/Arrow.hs
+++ b/src/Hakyll/Core/Util/Arrow.hs
@@ -16,9 +16,9 @@ constA = arr . const
sequenceA :: Arrow a
=> [a b c]
-> a b [c]
-sequenceA = foldl reduce $ constA []
+sequenceA = foldr reduce $ constA []
where
- reduce la xa = xa &&& la >>^ arr (uncurry (:))
+ reduce xa la = xa &&& la >>^ arr (uncurry (:))
unitA :: Arrow a
=> a b ()
diff --git a/tests/Hakyll/Core/Util/Arrow/Tests.hs b/tests/Hakyll/Core/Util/Arrow/Tests.hs
new file mode 100644
index 0000000..c0c7eaa
--- /dev/null
+++ b/tests/Hakyll/Core/Util/Arrow/Tests.hs
@@ -0,0 +1,14 @@
+module Hakyll.Core.Util.Arrow.Tests
+ ( tests
+ ) where
+
+import Test.Framework (Test)
+import Test.HUnit ((@=?))
+
+import Hakyll.Core.Util.Arrow
+import TestSuite.Util
+
+tests :: [Test]
+tests = fromAssertions "sequenceA"
+ [ [8, 20, 1] @=? sequenceA [(+ 4), (* 5), signum] (4 :: Int)
+ ]
diff --git a/tests/TestSuite.hs b/tests/TestSuite.hs
index fdd5e56..d9ba854 100644
--- a/tests/TestSuite.hs
+++ b/tests/TestSuite.hs
@@ -8,6 +8,7 @@ import qualified Hakyll.Core.Routes.Tests
import qualified Hakyll.Core.Rules.Tests
import qualified Hakyll.Core.Store.Tests
import qualified Hakyll.Core.UnixFilter.Tests
+import qualified Hakyll.Core.Util.Arrow.Tests
import qualified Hakyll.Web.Page.Tests
import qualified Hakyll.Web.Page.Metadata.Tests
import qualified Hakyll.Web.Template.Tests
@@ -29,6 +30,8 @@ main = defaultMain
Hakyll.Core.Store.Tests.tests
, testGroup "Hakyll.Core.UnixFilter.Tests"
Hakyll.Core.UnixFilter.Tests.tests
+ , testGroup "Hakyll.Core.Util.Arrow.Tests"
+ Hakyll.Core.Util.Arrow.Tests.tests
, testGroup "Hakyll.Web.Page.Tests"
Hakyll.Web.Page.Tests.tests
, testGroup "Hakyll.Web.Page.Metadata.Tests"