packages feed

cabal-gild-1.1.0.0: source/library/CabalGild/Type/Input.hs

module CabalGild.Type.Input where

-- | Represents an input stream, which can either be standard input (STDIN) or
-- a file.
data Input
  = Stdin
  | File FilePath
  deriving (Eq, Ord, Show)

-- | Converts a string into an input. The string @"-"@ will be converted into
-- 'Stdin', and any other string will be converted into 'File'.
fromString :: String -> Input
fromString s = case s of
  "-" -> Stdin
  _ -> File s