packages feed

hfmt-0.1.0: app/Types.hs

module Types
  ( Action(..)
  , InputFile(..)
  , InputFileWithSource(..)
  , ErrorString
  , ReformatResult(..)
  , HaskellSourceFilePath
  , HaskellSource(..)
  ) where

import Language.Haskell.Format
import Language.Haskell.Source.Enumerator (HaskellSourceFilePath)

data Action
  = PrintDiffs
  | PrintSources
  | PrintFilePaths
  | WriteSources

data InputFile
  = InputFilePath HaskellSourceFilePath
  | InputFromStdIn

instance Show InputFile where
  show (InputFilePath path) = path
  show InputFromStdIn       = "-"

data InputFileWithSource =
  InputFileWithSource InputFile
                      HaskellSource

type ErrorString = String

data ReformatResult
  = InvalidReformat InputFile
                    ErrorString
  | Reformat InputFile
             HaskellSource
             Reformatted