module Hedgehog.Extras.Stock.String
( strip
, lastLine
, firstLine
) where
import Data.Function
import Data.String
import qualified Data.List as L
import qualified Data.Text as T
strip :: String -> String
strip :: String -> String
strip = Text -> String
T.unpack forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Text
T.strip forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Text
T.pack
lastLine :: String -> String
lastLine :: String -> String
lastLine = String -> String
strip forall b c a. (b -> c) -> (a -> b) -> a -> c
. [String] -> String
L.unlines forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. [a] -> [a]
L.reverse forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Int -> [a] -> [a]
L.take Int
1 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. [a] -> [a]
L.reverse forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> [String]
L.lines
firstLine :: String -> String
firstLine :: String -> String
firstLine = String -> String
strip forall b c a. (b -> c) -> (a -> b) -> a -> c
. [String] -> String
L.unlines forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Int -> [a] -> [a]
L.take Int
1 forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> [String]
L.lines