on master help sign in
Added MonadError's instance for Compiler.
commit617322ae8ce039fcd36a7a7629a822522454a1af authorIvan N. Veselov <veselov@gmail.com> dateFri 3 May 2013, 19:10 (13 years ago) parent51d5242
1 file changed+8
src/Hakyll/Core/Compiler/Internal.hs+8
src/Hakyll/Core/Compiler/Internal.hs+8
@@ -2,6 +2,8 @@
22-- | Internally used compiler module
33{-# LANGUAGE GADTs #-}
44{-# LANGUAGE GeneralizedNewtypeDeriving #-}
5+{-# LANGUAGE FlexibleInstances #-}
6+{-# LANGUAGE MultiParamTypeClasses #-}
57module Hakyll.Core.Compiler.Internal
68 ( -- * Types
79 CompilerRead (..)
@@ -29,6 +31,7 @@ import Control.Applicative (Alternative (..),
2931 Applicative (..), (<$>))
3032import Control.Exception (SomeException, handle)
3133import Control.Monad (forM_)
34+import Control.Monad.Error
3235import Data.Monoid (Monoid (..))
3336import Data.Set (Set)
3437import qualified Data.Set as S
@@ -146,6 +149,11 @@ instance MonadMetadata Compiler where
146149 getMetadata = compilerGetMetadata
147150 getMatches = compilerGetMatches
148151
152+--------------------------------------------------------------------------------
153+instance MonadError [String] Compiler where
154+ throwError = compilerThrow
155+ catchError = compilerCatch
156+
149157
150158--------------------------------------------------------------------------------
151159runCompiler :: Compiler a -> CompilerRead -> IO (CompilerResult a)