add some more instances

This commit is contained in:
Andrew Martin 2016-06-24 09:21:02 -04:00
parent af6e520b36
commit 3a4d54c8c8

View File

@ -28,7 +28,6 @@ newtype Headed a = Headed { getHeaded :: a }
data Headless a = Headless
deriving (Eq,Ord,Functor,Show,Read)
-- | Isomorphic to @'Const' 'Int'@
data Indexed f a = Indexed
{ indexedIndex :: Int
, indexedHeading :: f a
@ -46,20 +45,19 @@ instance Monoid (HeadingErrors content) where
mappend (HeadingErrors a1 b1) (HeadingErrors a2 b2) = HeadingErrors
(a1 Vector.++ a2) (b1 Vector.++ b2)
data DecodingError f content = DecodingError
{ decodingErrorContent :: content
, decodingErrorHeader :: Indexed f content
, decodingErrorMessage :: String
} -- deriving (Show,Read)
} deriving (Show,Read)
-- instance (Show content, Typeable content) => Exception (DecodingError f content)
-- instance (Show (f content), Typeable content) => Exception (DecodingError f content)
newtype DecodingErrors f content = DecodingErrors
{ getDecodingErrors :: Vector (DecodingError f content)
} deriving (Monoid)
} deriving (Monoid,Show,Read)
-- instance (Show content, Typeable content) => Exception (DecodingErrors f content)
-- instance (Show (f content), Typeable content) => Exception (DecodingErrors f content)
instance Contravariant Headless where
contramap _ Headless = Headless