-- | Provides a type for distinguishing different path types.
--
-- @since 0.1
module FileSystem.PathType
  ( PathType (..),
    displayPathType,
  )
where

import Control.DeepSeq (NFData)
import Data.String (IsString)
import GHC.Generics (Generic)

-- | Path type.
--
-- @since 0.1
data PathType
  = -- | @since 0.1
    PathTypeFile
  | -- | @since 0.1
    PathTypeDirectory
  | -- | @since 0.1
    PathTypeSymbolicLink
  | -- | @since 0.1
    PathTypeOther
  deriving stock
    ( -- | @since 0.1
      PathType
PathType -> PathType -> Bounded PathType
forall a. a -> a -> Bounded a
$cminBound :: PathType
minBound :: PathType
$cmaxBound :: PathType
maxBound :: PathType
Bounded,
      -- | @since 0.1
      Int -> PathType
PathType -> Int
PathType -> [PathType]
PathType -> PathType
PathType -> PathType -> [PathType]
PathType -> PathType -> PathType -> [PathType]
(PathType -> PathType)
-> (PathType -> PathType)
-> (Int -> PathType)
-> (PathType -> Int)
-> (PathType -> [PathType])
-> (PathType -> PathType -> [PathType])
-> (PathType -> PathType -> [PathType])
-> (PathType -> PathType -> PathType -> [PathType])
-> Enum PathType
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: PathType -> PathType
succ :: PathType -> PathType
$cpred :: PathType -> PathType
pred :: PathType -> PathType
$ctoEnum :: Int -> PathType
toEnum :: Int -> PathType
$cfromEnum :: PathType -> Int
fromEnum :: PathType -> Int
$cenumFrom :: PathType -> [PathType]
enumFrom :: PathType -> [PathType]
$cenumFromThen :: PathType -> PathType -> [PathType]
enumFromThen :: PathType -> PathType -> [PathType]
$cenumFromTo :: PathType -> PathType -> [PathType]
enumFromTo :: PathType -> PathType -> [PathType]
$cenumFromThenTo :: PathType -> PathType -> PathType -> [PathType]
enumFromThenTo :: PathType -> PathType -> PathType -> [PathType]
Enum,
      -- | @since 0.1
      PathType -> PathType -> Bool
(PathType -> PathType -> Bool)
-> (PathType -> PathType -> Bool) -> Eq PathType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PathType -> PathType -> Bool
== :: PathType -> PathType -> Bool
$c/= :: PathType -> PathType -> Bool
/= :: PathType -> PathType -> Bool
Eq,
      -- | @since 0.1
      (forall x. PathType -> Rep PathType x)
-> (forall x. Rep PathType x -> PathType) -> Generic PathType
forall x. Rep PathType x -> PathType
forall x. PathType -> Rep PathType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. PathType -> Rep PathType x
from :: forall x. PathType -> Rep PathType x
$cto :: forall x. Rep PathType x -> PathType
to :: forall x. Rep PathType x -> PathType
Generic,
      -- | @since 0.1
      Eq PathType
Eq PathType =>
(PathType -> PathType -> Ordering)
-> (PathType -> PathType -> Bool)
-> (PathType -> PathType -> Bool)
-> (PathType -> PathType -> Bool)
-> (PathType -> PathType -> Bool)
-> (PathType -> PathType -> PathType)
-> (PathType -> PathType -> PathType)
-> Ord PathType
PathType -> PathType -> Bool
PathType -> PathType -> Ordering
PathType -> PathType -> PathType
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: PathType -> PathType -> Ordering
compare :: PathType -> PathType -> Ordering
$c< :: PathType -> PathType -> Bool
< :: PathType -> PathType -> Bool
$c<= :: PathType -> PathType -> Bool
<= :: PathType -> PathType -> Bool
$c> :: PathType -> PathType -> Bool
> :: PathType -> PathType -> Bool
$c>= :: PathType -> PathType -> Bool
>= :: PathType -> PathType -> Bool
$cmax :: PathType -> PathType -> PathType
max :: PathType -> PathType -> PathType
$cmin :: PathType -> PathType -> PathType
min :: PathType -> PathType -> PathType
Ord,
      -- | @since 0.1
      Int -> PathType -> [Char] -> [Char]
[PathType] -> [Char] -> [Char]
PathType -> [Char]
(Int -> PathType -> [Char] -> [Char])
-> (PathType -> [Char])
-> ([PathType] -> [Char] -> [Char])
-> Show PathType
forall a.
(Int -> a -> [Char] -> [Char])
-> (a -> [Char]) -> ([a] -> [Char] -> [Char]) -> Show a
$cshowsPrec :: Int -> PathType -> [Char] -> [Char]
showsPrec :: Int -> PathType -> [Char] -> [Char]
$cshow :: PathType -> [Char]
show :: PathType -> [Char]
$cshowList :: [PathType] -> [Char] -> [Char]
showList :: [PathType] -> [Char] -> [Char]
Show
    )
  deriving anyclass
    ( -- | @since 0.1
      PathType -> ()
(PathType -> ()) -> NFData PathType
forall a. (a -> ()) -> NFData a
$crnf :: PathType -> ()
rnf :: PathType -> ()
NFData
    )

-- | String representation of 'PathType'.
--
-- @since 0.1
displayPathType :: (IsString a) => PathType -> a
displayPathType :: forall a. IsString a => PathType -> a
displayPathType PathType
PathTypeFile = a
"file"
displayPathType PathType
PathTypeDirectory = a
"directory"
displayPathType PathType
PathTypeSymbolicLink = a
"symlink"
displayPathType PathType
PathTypeOther = a
"other"