From ca1d4d3d4371c8175ea6addb1ca1b09c3b56a7bb Mon Sep 17 00:00:00 2001 From: Chris Wells Date: Sat, 25 Jan 2025 14:33:21 -0600 Subject: Adding templates and cleaning up --- src/Hakyll/Error.hs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/Hakyll/Error.hs') diff --git a/src/Hakyll/Error.hs b/src/Hakyll/Error.hs index 35102d4..7495b4d 100644 --- a/src/Hakyll/Error.hs +++ b/src/Hakyll/Error.hs @@ -14,17 +14,17 @@ class ErrorConv c err where type CompilerError c = ErrorConv c [String] -instance ErrorCnv err err where +instance ErrorConv err err where toErr = id -instance Exception c => ErrorCnv c SomeException where +instance Exception c => ErrorConv c SomeException where toErr = SomeException --- instance Functor f => ErrorCnv c err => ErrorCnv (f c) (f err) where +-- instance Functor f => ErrorConv c err => ErrorConv (f c) (f err) where -- toErr = fmap toErr -instance (Applicative f, ErrorCnv c err) => ErrorCnv c (f err) where - toErr = pure . toErr +-- instance (Applicative f, ErrorConv c err) => ErrorConv c (f err) where +-- toErr = pure . toErr throwErr :: (MonadError err m, ErrorConv c err) => c -> m a throwErr = throwError . toErr @@ -38,6 +38,12 @@ squashErr = (>>= liftErr) instance ErrorConv Message String where toErr = messageString +instance ErrorConv String [String] where + toErr = pure + +instance ErrorConv Message [String] where + toErr = pure . messageString + instance ErrorConv ParseError [String] where toErr = fmap messageString . errorMessages -- cgit v1.2.3