module Argo.Internal.Type.Config where

import qualified Argo.Internal.Type.Indent as Indent

data Config = Config
    { Config -> Indent
indent :: Indent.Indent
    , Config -> Int
level :: Int
    }
    deriving (Config -> Config -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Config -> Config -> Bool
$c/= :: Config -> Config -> Bool
== :: Config -> Config -> Bool
$c== :: Config -> Config -> Bool
Eq, Int -> Config -> ShowS
[Config] -> ShowS
Config -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Config] -> ShowS
$cshowList :: [Config] -> ShowS
show :: Config -> String
$cshow :: Config -> String
showsPrec :: Int -> Config -> ShowS
$cshowsPrec :: Int -> Config -> ShowS
Show)

initial :: Config
initial :: Config
initial = Config { indent :: Indent
indent = Int -> Indent
Indent.Spaces Int
0, level :: Int
level = Int
0 }

hasIndent :: Config -> Bool
hasIndent :: Config -> Bool
hasIndent Config
x = case Config -> Indent
indent Config
x of
    Indent.Spaces Int
y -> Int
y forall a. Ord a => a -> a -> Bool
> Int
0
    Indent
Indent.Tab -> Bool
True

increaseLevel :: Config -> Config
increaseLevel :: Config -> Config
increaseLevel Config
x = Config
x { level :: Int
level = Config -> Int
level Config
x forall a. Num a => a -> a -> a
+ Int
1 }