module Stan.Category
(
Category (..)
, prettyShowCategory
, stanCategories
, antiPattern
, infinite
, list
, partial
, spaceLeak
, syntax
, unsafe
) where
import Colourista (formatWith, magentaBg)
import Data.Aeson.Micro (ToJSON)
newtype Category = Category
{ Category -> Text
unCategory :: Text
} deriving newtype (Int -> Category -> ShowS
[Category] -> ShowS
Category -> String
(Int -> Category -> ShowS)
-> (Category -> String) -> ([Category] -> ShowS) -> Show Category
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Category -> ShowS
showsPrec :: Int -> Category -> ShowS
$cshow :: Category -> String
show :: Category -> String
$cshowList :: [Category] -> ShowS
showList :: [Category] -> ShowS
Show, Category -> Category -> Bool
(Category -> Category -> Bool)
-> (Category -> Category -> Bool) -> Eq Category
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Category -> Category -> Bool
== :: Category -> Category -> Bool
$c/= :: Category -> Category -> Bool
/= :: Category -> Category -> Bool
Eq, Eq Category
Eq Category =>
(Int -> Category -> Int) -> (Category -> Int) -> Hashable Category
Int -> Category -> Int
Category -> Int
forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> Category -> Int
hashWithSalt :: Int -> Category -> Int
$chash :: Category -> Int
hash :: Category -> Int
Hashable, Category -> Value
(Category -> Value) -> ToJSON Category
forall a. (a -> Value) -> ToJSON a
$ctoJSON :: Category -> Value
toJSON :: Category -> Value
ToJSON)
prettyShowCategory :: Category -> Text
prettyShowCategory :: Category -> Text
prettyShowCategory Category
cat = [Text] -> Text -> Text
forall str. (IsString str, Semigroup str) => [str] -> str -> str
formatWith [Text
forall str. IsString str => str
magentaBg] (Text -> Text) -> Text -> Text
forall a b. (a -> b) -> a -> b
$ Text
"#" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Category -> Text
unCategory Category
cat
list :: Category
list :: Category
list = Text -> Category
Category Text
"List"
partial :: Category
partial :: Category
partial = Text -> Category
Category Text
"Partial"
infinite :: Category
infinite :: Category
infinite = Text -> Category
Category Text
"Infinite"
antiPattern :: Category
antiPattern :: Category
antiPattern = Text -> Category
Category Text
"AntiPattern"
spaceLeak :: Category
spaceLeak :: Category
spaceLeak = Text -> Category
Category Text
"SpaceLeak"
syntax :: Category
syntax :: Category
syntax = Text -> Category
Category Text
"Syntax"
unsafe :: Category
unsafe :: Category
unsafe = Text -> Category
Category Text
"Unsafe"
stanCategories :: [Category]
stanCategories :: [Category]
stanCategories =
[ Category
antiPattern
, Category
infinite
, Category
list
, Category
partial
, Category
spaceLeak
, Category
syntax
, Category
unsafe
]