{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE StrictData        #-}

{-|
Module      : Headroom.FileSupport.TemplateData
Description : Custom data specific to file support implementations
Copyright   : (c) 2019-2021 Vaclav Svejcar
License     : BSD-3-Clause
Maintainer  : vaclav.svejcar@gmail.com
Stability   : experimental
Portability : POSIX

Because each implementation of file support might require some custom data
extracted for example from the template file, this module exposes data types
specific for individual implementations.
-}

module Headroom.FileSupport.TemplateData
  ( TemplateData(..)
  , HaddockOffsets(..)
  , HaskellTemplateData'(..)
  )
where
import           RIO


-- | Additional template data extracted from the template file.
data TemplateData
  = HaskellTemplateData HaskellTemplateData'
  -- ^ additional template data for /Haskell/
  | NoTemplateData
  -- ^ no additional template data provided
  deriving (TemplateData -> TemplateData -> Bool
(TemplateData -> TemplateData -> Bool)
-> (TemplateData -> TemplateData -> Bool) -> Eq TemplateData
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TemplateData -> TemplateData -> Bool
$c/= :: TemplateData -> TemplateData -> Bool
== :: TemplateData -> TemplateData -> Bool
$c== :: TemplateData -> TemplateData -> Bool
Eq, Int -> TemplateData -> ShowS
[TemplateData] -> ShowS
TemplateData -> String
(Int -> TemplateData -> ShowS)
-> (TemplateData -> String)
-> ([TemplateData] -> ShowS)
-> Show TemplateData
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TemplateData] -> ShowS
$cshowList :: [TemplateData] -> ShowS
show :: TemplateData -> String
$cshow :: TemplateData -> String
showsPrec :: Int -> TemplateData -> ShowS
$cshowsPrec :: Int -> TemplateData -> ShowS
Show)

-- | Offsets for selected fields extracted from /Haddock module header/.
data HaddockOffsets = HaddockOffsets
  { HaddockOffsets -> Maybe Int
hoCopyright :: Maybe Int
  -- ^ offset for /Copyright/ field
  }
  deriving (HaddockOffsets -> HaddockOffsets -> Bool
(HaddockOffsets -> HaddockOffsets -> Bool)
-> (HaddockOffsets -> HaddockOffsets -> Bool) -> Eq HaddockOffsets
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HaddockOffsets -> HaddockOffsets -> Bool
$c/= :: HaddockOffsets -> HaddockOffsets -> Bool
== :: HaddockOffsets -> HaddockOffsets -> Bool
$c== :: HaddockOffsets -> HaddockOffsets -> Bool
Eq, Int -> HaddockOffsets -> ShowS
[HaddockOffsets] -> ShowS
HaddockOffsets -> String
(Int -> HaddockOffsets -> ShowS)
-> (HaddockOffsets -> String)
-> ([HaddockOffsets] -> ShowS)
-> Show HaddockOffsets
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HaddockOffsets] -> ShowS
$cshowList :: [HaddockOffsets] -> ShowS
show :: HaddockOffsets -> String
$cshow :: HaddockOffsets -> String
showsPrec :: Int -> HaddockOffsets -> ShowS
$cshowsPrec :: Int -> HaddockOffsets -> ShowS
Show)


-- | Additional template data required by /Haskell/ file support
data HaskellTemplateData' = HaskellTemplateData'
  { HaskellTemplateData' -> HaddockOffsets
htdHaddockOffsets :: HaddockOffsets
  -- ^ offsets for /Haddock/ fields
  }
  deriving (HaskellTemplateData' -> HaskellTemplateData' -> Bool
(HaskellTemplateData' -> HaskellTemplateData' -> Bool)
-> (HaskellTemplateData' -> HaskellTemplateData' -> Bool)
-> Eq HaskellTemplateData'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HaskellTemplateData' -> HaskellTemplateData' -> Bool
$c/= :: HaskellTemplateData' -> HaskellTemplateData' -> Bool
== :: HaskellTemplateData' -> HaskellTemplateData' -> Bool
$c== :: HaskellTemplateData' -> HaskellTemplateData' -> Bool
Eq, Int -> HaskellTemplateData' -> ShowS
[HaskellTemplateData'] -> ShowS
HaskellTemplateData' -> String
(Int -> HaskellTemplateData' -> ShowS)
-> (HaskellTemplateData' -> String)
-> ([HaskellTemplateData'] -> ShowS)
-> Show HaskellTemplateData'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HaskellTemplateData'] -> ShowS
$cshowList :: [HaskellTemplateData'] -> ShowS
show :: HaskellTemplateData' -> String
$cshow :: HaskellTemplateData' -> String
showsPrec :: Int -> HaskellTemplateData' -> ShowS
$cshowsPrec :: Int -> HaskellTemplateData' -> ShowS
Show)