packages feed

eternal 0.0.7 → 0.0.8

raw patch · 3 files changed

+19/−1 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Control.Eternal.String: trim :: String -> String

Files

eternal.cabal view
@@ -1,6 +1,6 @@ name:       eternal
 category:   Control
-version:    0.0.7
+version:    0.0.8
 author:        Heather Cynede
 maintainer:    Heather Cynede <Cynede@Gentoo.org>
 license: BSD3
@@ -20,6 +20,7 @@     Control.Eternal
     
     Control.Eternal.Syntax
+    Control.Eternal.String
     Control.Eternal.System
     Control.Eternal.Algorithms
     
src/Control/Eternal.hs view
@@ -1,9 +1,11 @@ module Control.Eternal
   ( module Control.Eternal.Syntax
+  , module Control.Eternal.String
   , module Control.Eternal.System
   , module Control.Eternal.Algorithms
   ) where
 
 import Control.Eternal.Syntax
+import Control.Eternal.String
 import Control.Eternal.System
 import Control.Eternal.Algorithms
+ src/Control/Eternal/String.hs view
@@ -0,0 +1,15 @@+module Control.Eternal.String
+  ( trim
+  ) where
+
+import Data.Char (isSpace)
+
+trim :: String -> String
+trim xs = dropSpaceTail "" $ dropWhile isSpace xs
+
+dropSpaceTail :: String -> String -> String
+dropSpaceTail maybeStuff "" = ""
+dropSpaceTail maybeStuff (x:xs)
+        | isSpace x = dropSpaceTail (x:maybeStuff) xs
+        | null maybeStuff = x : dropSpaceTail "" xs
+        | otherwise       = reverse maybeStuff ++ x : dropSpaceTail "" xs