{-# LANGUAGE ScopedTypeVariables, StandaloneDeriving, TemplateHaskell #-}
module Debian.Loc
    ( __LOC__
    , mapExn
    ) where

import Control.Applicative ((<$>), (<*>), pure)
import Control.Exception (Exception, throw)
import Control.Monad.Catch (MonadCatch, catch)
import Language.Haskell.TH

__LOC__ :: Q Exp
__LOC__ :: Q Exp
__LOC__ = Q Loc
location forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \ Loc
x ->
             forall (m :: * -> *). Quote m => Name -> [m (Name, Exp)] -> m Exp
recConE 'Loc [ (,) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (forall (f :: * -> *) a. Applicative f => a -> f a
pure 'loc_filename) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall (m :: * -> *). Quote m => Lit -> m Exp
litE (String -> Lit
stringL (Loc -> String
loc_filename Loc
x))
                          , (,) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (forall (f :: * -> *) a. Applicative f => a -> f a
pure 'loc_package) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall (m :: * -> *). Quote m => Lit -> m Exp
litE (String -> Lit
stringL (Loc -> String
loc_package Loc
x))
                          , (,) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (forall (f :: * -> *) a. Applicative f => a -> f a
pure 'loc_module) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall (m :: * -> *). Quote m => Lit -> m Exp
litE (String -> Lit
stringL (Loc -> String
loc_module Loc
x))
                          , (,) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (forall (f :: * -> *) a. Applicative f => a -> f a
pure 'loc_start) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> [|($(litE (integerL (fromIntegral (fst (loc_start x))))),
                                                             $(litE (integerL (fromIntegral (snd (loc_start x)))))) :: (Int, Int)|]
                          , (,) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (forall (f :: * -> *) a. Applicative f => a -> f a
pure 'loc_end) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> [|($(litE (integerL (fromIntegral (fst (loc_end x))))),
                                                           $(litE (integerL (fromIntegral (snd (loc_end x)))))) :: (Int, Int)|] ]

mapExn :: forall e m a. (MonadCatch m, Exception e) => m a -> (e -> e) -> m a
mapExn :: forall e (m :: * -> *) a.
(MonadCatch m, Exception e) =>
m a -> (e -> e) -> m a
mapExn m a
task e -> e
f = m a
task forall (m :: * -> *) e a.
(MonadCatch m, Exception e) =>
m a -> (e -> m a) -> m a
`catch` (\ (e
e :: e) -> forall a e. Exception e => e -> a
throw (e -> e
f e
e))