blob: 1896e110c47ed25647176324ab2fa9966833ab08 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
-- | Various arrow utility functions
--
module Hakyll.Core.Util.Arrow
( constA
, sequenceA
, unitA
) where
import Control.Arrow (Arrow, (&&&), arr, (>>^))
constA :: Arrow a
=> c
-> a b c
constA = arr . const
sequenceA :: Arrow a
=> [a b c]
-> a b [c]
sequenceA = foldl reduce $ constA []
where
reduce la xa = xa &&& la >>^ arr (uncurry (:))
unitA :: Arrow a
=> a b ()
unitA = constA ()
|