summaryrefslogtreecommitdiff
path: root/src/Hakyll/Core/Util
diff options
context:
space:
mode:
Diffstat (limited to 'src/Hakyll/Core/Util')
-rw-r--r--src/Hakyll/Core/Util/Arrow.hs37
1 files changed, 17 insertions, 20 deletions
diff --git a/src/Hakyll/Core/Util/Arrow.hs b/src/Hakyll/Core/Util/Arrow.hs
index d25bc28..1896e11 100644
--- a/src/Hakyll/Core/Util/Arrow.hs
+++ b/src/Hakyll/Core/Util/Arrow.hs
@@ -1,28 +1,25 @@
-- | Various arrow utility functions
--
module Hakyll.Core.Util.Arrow
- ( sequenceArr
- , unitArr
- , withUnitArr
+ ( constA
+ , sequenceA
+ , unitA
) where
-import Prelude hiding (id)
-import Control.Arrow (Arrow, (&&&), (>>>), arr, (***))
-import Control.Category (id)
+import Control.Arrow (Arrow, (&&&), arr, (>>^))
-sequenceArr :: Arrow a
- => [a b c]
- -> a b [c]
-sequenceArr = foldl reduce $ arr $ const []
- where
- reduce la xa = xa &&& la >>> arr (uncurry (:))
+constA :: Arrow a
+ => c
+ -> a b c
+constA = arr . const
-unitArr :: Arrow a
- => a b ()
-unitArr = arr (const ())
+sequenceA :: Arrow a
+ => [a b c]
+ -> a b [c]
+sequenceA = foldl reduce $ constA []
+ where
+ reduce la xa = xa &&& la >>^ arr (uncurry (:))
-withUnitArr :: Arrow a
- => a b c
- -> a () d
- -> a b (c, d)
-withUnitArr a1 a2 = a1 &&& unitArr >>> id *** a2
+unitA :: Arrow a
+ => a b ()
+unitA = constA ()