X-Git-Url: http://git.cielonegro.org/gitweb.cgi?a=blobdiff_plain;f=Rakka%2FUtils.hs;h=9f2873c9ae328d626d9679b2ac0c777750c1e50e;hb=859d4378c2e2a1ccc8028821a37eeaa43aaa23fb;hp=92f3b1232f51eacb51cdddefeaa15c6db36258db;hpb=885faf1cabc3f79c90e1885268e2a9138b1ddefb;p=Rakka.git diff --git a/Rakka/Utils.hs b/Rakka/Utils.hs index 92f3b12..9f2873c 100644 --- a/Rakka/Utils.hs +++ b/Rakka/Utils.hs @@ -2,9 +2,9 @@ module Rakka.Utils ( yesOrNo , parseYesOrNo , maybeA - , defaultTo , deleteIfEmpty , formatW3CDateTime + , chomp ) where @@ -35,13 +35,6 @@ maybeA a = listA a (x:_) -> returnA -< Just x -defaultTo :: ArrowChoice a => b -> a (Maybe b) b -defaultTo def - = proc m -> case m of - Nothing -> returnA -< def - Just x -> returnA -< x - - deleteIfEmpty :: (ArrowList a, ArrowChoice a) => a String String deleteIfEmpty = proc str -> do case str of @@ -79,4 +72,8 @@ formatW3CDateTime time show2 :: Int -> String show2 n | n < 10 = '0':(show n) - | otherwise = show n \ No newline at end of file + | otherwise = show n + + +chomp :: String -> String +chomp = reverse . snd . break (/= '\n') . reverse