module DDC.Core.Flow.Transform.Schedule.Error
(Error (..))
where
import DDC.Core.Flow.Exp
import DDC.Core.Flow.Prim
import DDC.Core.Flow.Process.Operator
import DDC.Core.Transform.Annotate
import DDC.Core.Pretty
import qualified DDC.Core.Flow.Transform.Slurp.Error as Slurp
data Error
= ErrorNoRateParameters
| ErrorNoSeriesParameters
| ErrorMultipleRates
| ErrorPrimaryRateMismatch
| ErrorCannotLiftExp (Exp () Name)
| ErrorCannotLiftType (Type Name)
| ErrorUnsupported Operator
| ErrorSlurpError Slurp.Error
deriving Show
instance Pretty Error where
ppr err
= case err of
ErrorNoRateParameters
-> vcat [ text "Series process has no rate parameters." ]
ErrorNoSeriesParameters
-> vcat [ text "Series process has no series parameters."]
ErrorMultipleRates
-> vcat [ text "Series process has multiple rate parameters."]
ErrorPrimaryRateMismatch
-> vcat [ text "Series process primary rate mismatch."]
ErrorCannotLiftExp x
-> vcat [ text "Cannot lift expression in series process."
, empty
, indent 4 $ ppr (annotate () x) ]
ErrorCannotLiftType t
-> vcat [ text "Cannot lift type in series process."
, empty
, indent 4 $ ppr t ]
ErrorUnsupported _
-> vcat [ text "Cannot lower series operator with this method."]
ErrorSlurpError errSlurp
-> vcat [ text "Error slurping series process."
, indent 2 $ ppr errSlurp ]