--- |> parseWWWFormURLEncoded "aaa=bbb&ccc=ddd"
--- > ==> [("aaa", "bbb"), ("ccc", "ddd")]
-parseWWWFormURLEncoded :: String -> [(String, String)]
-parseWWWFormURLEncoded src
- | src == "" = []
- | otherwise = do pairStr <- splitBy (\ c -> c == ';' || c == '&') src
- let (key, value) = break (== '=') pairStr
- return ( unEscapeString key
- , unEscapeString $ case value of
- ('=':val) -> val
- "" -> ""
- )
+infixr 5 ⋈
+-- | (C8;) = ('><')
+--
+-- U+22C8, BOWTIE
+(⋈) ∷ Sequence α a ⇒ α → α → α
+(⋈) = (><)
+
+-- |Generalised @mapM@ from any 'Foldable' to 'Unfoldable'. Why isn't
+-- this in the @collections-api@?
+mapM ∷ (Foldable α a, Unfoldable β b, Functor m, Monad m)
+ ⇒ (a → m b) → α → m β
+{-# INLINE mapM #-}
+mapM = flip foldrM empty ∘ (flip ((<$>) ∘ flip insert) ∘)
+
+-- |Get the modification time of a given file.
+getLastModified ∷ FilePath → IO UTCTime
+getLastModified = (clockTimeToUTC <$>) ∘ getModificationTime
+ where
+ clockTimeToUTC ∷ ClockTime → UTCTime
+ clockTimeToUTC (TOD sec picoSec)
+ = posixSecondsToUTCTime ∘ fromRational
+ $ sec % 1 + picoSec % (1000 ⋅ 1000 ⋅ 1000 ⋅ 1000)