summaryrefslogtreecommitdiff
path: root/src/Hakyll/Core/Util/Arrow.hs
blob: f46d083eb203e06271bd1c66afeb1a01da58a135 (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 = foldr reduce $ constA []
  where
    reduce xa la = xa &&& la >>^ arr (uncurry (:))

unitA :: Arrow a
      => a b ()
unitA = constA ()