module Proteome.Data.ResolveError where

import Exon (exon)
import Log (Severity (Warn))
import Ribosome (Report (Report), Reportable (toReport))

newtype ResolveError =
  ParsePath Text
  deriving stock (ResolveError -> ResolveError -> Bool
(ResolveError -> ResolveError -> Bool)
-> (ResolveError -> ResolveError -> Bool) -> Eq ResolveError
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResolveError -> ResolveError -> Bool
$c/= :: ResolveError -> ResolveError -> Bool
== :: ResolveError -> ResolveError -> Bool
$c== :: ResolveError -> ResolveError -> Bool
Eq, Int -> ResolveError -> ShowS
[ResolveError] -> ShowS
ResolveError -> String
(Int -> ResolveError -> ShowS)
-> (ResolveError -> String)
-> ([ResolveError] -> ShowS)
-> Show ResolveError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResolveError] -> ShowS
$cshowList :: [ResolveError] -> ShowS
show :: ResolveError -> String
$cshow :: ResolveError -> String
showsPrec :: Int -> ResolveError -> ShowS
$cshowsPrec :: Int -> ResolveError -> ShowS
Show)

instance Reportable ResolveError where
  toReport :: ResolveError -> Report
toReport (ParsePath Text
path) =
    HasCallStack => Text -> [Text] -> Severity -> Report
Text -> [Text] -> Severity -> Report
Report [exon|invalid path: #{path}|] [Item [Text]
"ResolveError.ParsePath:", Text
Item [Text]
path] Severity
Warn