module Proteome.Data.AddError where import Exon (exon) import Log (Severity (Info)) import Ribosome (Report (Report), Reportable (toReport)) data AddError = InvalidProjectSpec Text | Directory Text deriving stock (AddError -> AddError -> Bool (AddError -> AddError -> Bool) -> (AddError -> AddError -> Bool) -> Eq AddError forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a /= :: AddError -> AddError -> Bool $c/= :: AddError -> AddError -> Bool == :: AddError -> AddError -> Bool $c== :: AddError -> AddError -> Bool Eq, Int -> AddError -> ShowS [AddError] -> ShowS AddError -> String (Int -> AddError -> ShowS) -> (AddError -> String) -> ([AddError] -> ShowS) -> Show AddError forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a showList :: [AddError] -> ShowS $cshowList :: [AddError] -> ShowS show :: AddError -> String $cshow :: AddError -> String showsPrec :: Int -> AddError -> ShowS $cshowsPrec :: Int -> AddError -> ShowS Show) instance Reportable AddError where toReport :: AddError -> Report toReport = \case InvalidProjectSpec Text spec -> HasCallStack => Text -> [Text] -> Severity -> Report Text -> [Text] -> Severity -> Report Report [exon|no such project: #{spec}|] [Item [Text] "AddError.InvalidProjectSpec:", Text Item [Text] spec] Severity Info Directory Text msg -> HasCallStack => Text -> [Text] -> Severity -> Report Text -> [Text] -> Severity -> Report Report [exon|Listing directories: #{msg}|] [Item [Text] "AddError.Directory:", Text Item [Text] msg] Severity Info