{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE StrictData #-}
module Headroom.Types
(
HeadroomError(..)
, fromHeadroomError
, toHeadroomError
, TemplateMeta(..)
, HaddockFieldOffsets(..)
, CurrentYear(..)
)
where
import Data.Default.Class ( Default(..) )
import Data.Typeable ( cast )
import RIO
data HeadroomError = forall e . Exception e => HeadroomError e
instance Show HeadroomError where
show :: HeadroomError -> String
show (HeadroomError e
he) = e -> String
forall a. Show a => a -> String
show e
he
instance Exception HeadroomError where
displayException :: HeadroomError -> String
displayException (HeadroomError e
he) = e -> String
forall e. Exception e => e -> String
displayException e
he
toHeadroomError :: Exception e
=> e
-> SomeException
toHeadroomError :: e -> SomeException
toHeadroomError = HeadroomError -> SomeException
forall e. Exception e => e -> SomeException
toException (HeadroomError -> SomeException)
-> (e -> HeadroomError) -> e -> SomeException
forall b c a. (b -> c) -> (a -> b) -> a -> c
. e -> HeadroomError
forall e. Exception e => e -> HeadroomError
HeadroomError
fromHeadroomError :: Exception e
=> SomeException
-> Maybe e
fromHeadroomError :: SomeException -> Maybe e
fromHeadroomError SomeException
e = do
HeadroomError e
he <- SomeException -> Maybe HeadroomError
forall e. Exception e => SomeException -> Maybe e
fromException SomeException
e
e -> Maybe e
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast e
he
newtype CurrentYear = CurrentYear
{ CurrentYear -> Integer
unCurrentYear :: Integer
}
deriving (CurrentYear -> CurrentYear -> Bool
(CurrentYear -> CurrentYear -> Bool)
-> (CurrentYear -> CurrentYear -> Bool) -> Eq CurrentYear
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CurrentYear -> CurrentYear -> Bool
$c/= :: CurrentYear -> CurrentYear -> Bool
== :: CurrentYear -> CurrentYear -> Bool
$c== :: CurrentYear -> CurrentYear -> Bool
Eq, Int -> CurrentYear -> ShowS
[CurrentYear] -> ShowS
CurrentYear -> String
(Int -> CurrentYear -> ShowS)
-> (CurrentYear -> String)
-> ([CurrentYear] -> ShowS)
-> Show CurrentYear
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CurrentYear] -> ShowS
$cshowList :: [CurrentYear] -> ShowS
show :: CurrentYear -> String
$cshow :: CurrentYear -> String
showsPrec :: Int -> CurrentYear -> ShowS
$cshowsPrec :: Int -> CurrentYear -> ShowS
Show)
data HaddockFieldOffsets = HaddockFieldOffsets
{ HaddockFieldOffsets -> Maybe Int
hfoCopyright :: Maybe Int
}
deriving (HaddockFieldOffsets -> HaddockFieldOffsets -> Bool
(HaddockFieldOffsets -> HaddockFieldOffsets -> Bool)
-> (HaddockFieldOffsets -> HaddockFieldOffsets -> Bool)
-> Eq HaddockFieldOffsets
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HaddockFieldOffsets -> HaddockFieldOffsets -> Bool
$c/= :: HaddockFieldOffsets -> HaddockFieldOffsets -> Bool
== :: HaddockFieldOffsets -> HaddockFieldOffsets -> Bool
$c== :: HaddockFieldOffsets -> HaddockFieldOffsets -> Bool
Eq, Int -> HaddockFieldOffsets -> ShowS
[HaddockFieldOffsets] -> ShowS
HaddockFieldOffsets -> String
(Int -> HaddockFieldOffsets -> ShowS)
-> (HaddockFieldOffsets -> String)
-> ([HaddockFieldOffsets] -> ShowS)
-> Show HaddockFieldOffsets
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HaddockFieldOffsets] -> ShowS
$cshowList :: [HaddockFieldOffsets] -> ShowS
show :: HaddockFieldOffsets -> String
$cshow :: HaddockFieldOffsets -> String
showsPrec :: Int -> HaddockFieldOffsets -> ShowS
$cshowsPrec :: Int -> HaddockFieldOffsets -> ShowS
Show)
instance Default HaddockFieldOffsets where
def :: HaddockFieldOffsets
def = HaddockFieldOffsets :: Maybe Int -> HaddockFieldOffsets
HaddockFieldOffsets { hfoCopyright :: Maybe Int
hfoCopyright = Maybe Int
forall a. Maybe a
Nothing }
data TemplateMeta = HaskellTemplateMeta HaddockFieldOffsets
deriving (TemplateMeta -> TemplateMeta -> Bool
(TemplateMeta -> TemplateMeta -> Bool)
-> (TemplateMeta -> TemplateMeta -> Bool) -> Eq TemplateMeta
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TemplateMeta -> TemplateMeta -> Bool
$c/= :: TemplateMeta -> TemplateMeta -> Bool
== :: TemplateMeta -> TemplateMeta -> Bool
$c== :: TemplateMeta -> TemplateMeta -> Bool
Eq, Int -> TemplateMeta -> ShowS
[TemplateMeta] -> ShowS
TemplateMeta -> String
(Int -> TemplateMeta -> ShowS)
-> (TemplateMeta -> String)
-> ([TemplateMeta] -> ShowS)
-> Show TemplateMeta
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TemplateMeta] -> ShowS
$cshowList :: [TemplateMeta] -> ShowS
show :: TemplateMeta -> String
$cshow :: TemplateMeta -> String
showsPrec :: Int -> TemplateMeta -> ShowS
$cshowsPrec :: Int -> TemplateMeta -> ShowS
Show)