    module Util where
    import           Data.Char

    convertDosLineEndings :: String -> String
    convertDosLineEndings :: String -> String
    convertDosLineEndings = String -> String
    go
      where
        go :: String -> String
    go String
    input = case String
    input of
          Char
    '\r':Char
    '\n':String
    xs -> Char
    '\n' Char -> String -> String
    forall a. a -> [a] -> [a]
    : String -> String
    go String
    xs

          -- Haddock comments from source files with dos line endings end with a
          -- CR, so we strip that, too.
          String
    "\r"         -> String
    ""

          Char
    x:String
    xs         -> Char
    x Char -> String -> String
    forall a. a -> [a] -> [a]
    : String -> String
    go String
    xs
          String
    ""           -> String
    ""

    -- | Return the longest suffix of elements that satisfy a given predicate.
    takeWhileEnd :: (a -> Bool) -> [a] -> [a]
    takeWhileEnd :: forall a. (a -> Bool) -> [a] -> [a]
    takeWhileEnd a -> Bool
    p = [a] -> [a]
    forall a. [a] -> [a]
    reverse ([a] -> [a]) -> ([a] -> [a]) -> [a] -> [a]
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (a -> Bool) -> [a] -> [a]
    forall a. (a -> Bool) -> [a] -> [a]
    takeWhile a -> Bool
    p ([a] -> [a]) -> ([a] -> [a]) -> [a] -> [a]
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [a] -> [a]
    forall a. [a] -> [a]
    reverse

    -- | Remove trailing white space from a string.
    --
    -- >>> stripEnd "foo   "
    -- "foo"
    stripEnd :: String -> String
    stripEnd :: String -> String
    stripEnd = String -> String
    forall a. [a] -> [a]
    reverse (String -> String) -> (String -> String) -> String -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (Char -> Bool) -> String -> String
    forall a. (a -> Bool) -> [a] -> [a]
    dropWhile Char -> Bool
    isSpace (String -> String) -> (String -> String) -> String -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . String -> String
    forall a. [a] -> [a]
    reverse