-- | This module defines the 'Comment' data type.
module CabalGild.Unstable.Type.Comment where

import qualified CabalGild.Unstable.Extra.String as String
import qualified Data.ByteString as ByteString

-- | A comment with corresponding annotation. Leading blank space is preserved,
-- but trailing blank space is not.
data Comment a = Comment
  { forall a. Comment a -> a
annotation :: a,
    -- | Does /not/ include the 'delimiter'.
    forall a. Comment a -> ByteString
value :: ByteString.ByteString
  }
  deriving (Comment a -> Comment a -> Bool
(Comment a -> Comment a -> Bool)
-> (Comment a -> Comment a -> Bool) -> Eq (Comment a)
forall a. Eq a => Comment a -> Comment a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: forall a. Eq a => Comment a -> Comment a -> Bool
== :: Comment a -> Comment a -> Bool
$c/= :: forall a. Eq a => Comment a -> Comment a -> Bool
/= :: Comment a -> Comment a -> Bool
Eq, Int -> Comment a -> ShowS
[Comment a] -> ShowS
Comment a -> String
(Int -> Comment a -> ShowS)
-> (Comment a -> String)
-> ([Comment a] -> ShowS)
-> Show (Comment a)
forall a. Show a => Int -> Comment a -> ShowS
forall a. Show a => [Comment a] -> ShowS
forall a. Show a => Comment a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall a. Show a => Int -> Comment a -> ShowS
showsPrec :: Int -> Comment a -> ShowS
$cshow :: forall a. Show a => Comment a -> String
show :: Comment a -> String
$cshowList :: forall a. Show a => [Comment a] -> ShowS
showList :: [Comment a] -> ShowS
Show)

-- | The start of a comment, which is @--@.
delimiter :: ByteString.ByteString
delimiter :: ByteString
delimiter = String -> ByteString
String.toUtf8 String
"--"