]> gitweb @ CieloNegro.org - blackboard-dns.git/blob - DDNS/Utils.hs
Split commands off
[blackboard-dns.git] / DDNS / Utils.hs
1 module DDNS.Utils
2     ( trim
3     )
4     where
5
6 trim :: Maybe String -> Maybe String
7 trim Nothing   = Nothing
8 trim (Just xs) = case trimTail $ trimHead xs of
9                    "" -> Nothing
10                    ys -> Just ys
11     where
12       trimHead []       = []
13       trimHead (' ':ys) = trimHead ys
14       trimHead ys       = ys
15
16       trimTail = reverse . trimHead . reverse