module Chiasma.Data.DecodeError where

import Text.ParserCombinators.Parsec (ParseError)

data DecodeFailure =
  ParseFailure Text ParseError
  |
  IntParsingFailure Text
  |
  BoolParsingFailure Text
  |
  TooFewFields
  |
  TooManyFields [Text]
  |
  TooManyRecords [Text]
  |
  TargetMissing
  deriving stock (DecodeFailure -> DecodeFailure -> Bool
(DecodeFailure -> DecodeFailure -> Bool)
-> (DecodeFailure -> DecodeFailure -> Bool) -> Eq DecodeFailure
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DecodeFailure -> DecodeFailure -> Bool
$c/= :: DecodeFailure -> DecodeFailure -> Bool
== :: DecodeFailure -> DecodeFailure -> Bool
$c== :: DecodeFailure -> DecodeFailure -> Bool
Eq, Int -> DecodeFailure -> ShowS
[DecodeFailure] -> ShowS
DecodeFailure -> String
(Int -> DecodeFailure -> ShowS)
-> (DecodeFailure -> String)
-> ([DecodeFailure] -> ShowS)
-> Show DecodeFailure
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DecodeFailure] -> ShowS
$cshowList :: [DecodeFailure] -> ShowS
show :: DecodeFailure -> String
$cshow :: DecodeFailure -> String
showsPrec :: Int -> DecodeFailure -> ShowS
$cshowsPrec :: Int -> DecodeFailure -> ShowS
Show)

data DecodeError =
  DecodeError {
    DecodeError -> [Text]
output :: [Text],
    DecodeError -> DecodeFailure
failure :: DecodeFailure
  }
  deriving stock (DecodeError -> DecodeError -> Bool
(DecodeError -> DecodeError -> Bool)
-> (DecodeError -> DecodeError -> Bool) -> Eq DecodeError
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DecodeError -> DecodeError -> Bool
$c/= :: DecodeError -> DecodeError -> Bool
== :: DecodeError -> DecodeError -> Bool
$c== :: DecodeError -> DecodeError -> Bool
Eq, Int -> DecodeError -> ShowS
[DecodeError] -> ShowS
DecodeError -> String
(Int -> DecodeError -> ShowS)
-> (DecodeError -> String)
-> ([DecodeError] -> ShowS)
-> Show DecodeError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DecodeError] -> ShowS
$cshowList :: [DecodeError] -> ShowS
show :: DecodeError -> String
$cshow :: DecodeError -> String
showsPrec :: Int -> DecodeError -> ShowS
$cshowsPrec :: Int -> DecodeError -> ShowS
Show)