{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -fno-warn-name-shadowing #-}
module PlutusTx.Coverage ( CoverageAnnotation(..)
, CoverageIndex(..)
, CoverageMetadata(..)
, Metadata(..)
, CoverageData(..)
, CoverageReport(..)
, CovLoc(..)
, covLocFile
, covLocStartLine
, covLocEndLine
, covLocStartCol
, covLocEndCol
, metadataSet
, coverageAnnotations
, ignoredAnnotations
, coverageMetadata
, coveredAnnotations
, addCoverageMetadata
, addLocationToCoverageIndex
, addBoolCaseToCoverageIndex
, coverageDataFromLogMsg
) where
import Control.Lens
import Codec.Extras.FlatViaSerialise
import Codec.Serialise
import Flat hiding (to)
import Control.DeepSeq
import Data.Aeson (FromJSON, FromJSONKey, ToJSON, ToJSONKey)
import Data.Foldable
import Data.Map (Map)
import Data.Map qualified as Map
import Data.Set (Set)
import Data.Set qualified as Set
import Data.String
import Text.Read
import Control.Monad.Writer
import Prettyprinter
import Prelude
data CovLoc = CovLoc { CovLoc -> String
_covLocFile :: String
, CovLoc -> Int
_covLocStartLine :: Int
, CovLoc -> Int
_covLocEndLine :: Int
, CovLoc -> Int
_covLocStartCol :: Int
, CovLoc -> Int
_covLocEndCol :: Int }
deriving stock (Eq CovLoc
Eq CovLoc =>
(CovLoc -> CovLoc -> Ordering)
-> (CovLoc -> CovLoc -> Bool)
-> (CovLoc -> CovLoc -> Bool)
-> (CovLoc -> CovLoc -> Bool)
-> (CovLoc -> CovLoc -> Bool)
-> (CovLoc -> CovLoc -> CovLoc)
-> (CovLoc -> CovLoc -> CovLoc)
-> Ord CovLoc
CovLoc -> CovLoc -> Bool
CovLoc -> CovLoc -> Ordering
CovLoc -> CovLoc -> CovLoc
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: CovLoc -> CovLoc -> Ordering
compare :: CovLoc -> CovLoc -> Ordering
$c< :: CovLoc -> CovLoc -> Bool
< :: CovLoc -> CovLoc -> Bool
$c<= :: CovLoc -> CovLoc -> Bool
<= :: CovLoc -> CovLoc -> Bool
$c> :: CovLoc -> CovLoc -> Bool
> :: CovLoc -> CovLoc -> Bool
$c>= :: CovLoc -> CovLoc -> Bool
>= :: CovLoc -> CovLoc -> Bool
$cmax :: CovLoc -> CovLoc -> CovLoc
max :: CovLoc -> CovLoc -> CovLoc
$cmin :: CovLoc -> CovLoc -> CovLoc
min :: CovLoc -> CovLoc -> CovLoc
Ord, CovLoc -> CovLoc -> Bool
(CovLoc -> CovLoc -> Bool)
-> (CovLoc -> CovLoc -> Bool) -> Eq CovLoc
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CovLoc -> CovLoc -> Bool
== :: CovLoc -> CovLoc -> Bool
$c/= :: CovLoc -> CovLoc -> Bool
/= :: CovLoc -> CovLoc -> Bool
Eq, Int -> CovLoc -> ShowS
[CovLoc] -> ShowS
CovLoc -> String
(Int -> CovLoc -> ShowS)
-> (CovLoc -> String) -> ([CovLoc] -> ShowS) -> Show CovLoc
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CovLoc -> ShowS
showsPrec :: Int -> CovLoc -> ShowS
$cshow :: CovLoc -> String
show :: CovLoc -> String
$cshowList :: [CovLoc] -> ShowS
showList :: [CovLoc] -> ShowS
Show, ReadPrec [CovLoc]
ReadPrec CovLoc
Int -> ReadS CovLoc
ReadS [CovLoc]
(Int -> ReadS CovLoc)
-> ReadS [CovLoc]
-> ReadPrec CovLoc
-> ReadPrec [CovLoc]
-> Read CovLoc
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS CovLoc
readsPrec :: Int -> ReadS CovLoc
$creadList :: ReadS [CovLoc]
readList :: ReadS [CovLoc]
$creadPrec :: ReadPrec CovLoc
readPrec :: ReadPrec CovLoc
$creadListPrec :: ReadPrec [CovLoc]
readListPrec :: ReadPrec [CovLoc]
Read, (forall x. CovLoc -> Rep CovLoc x)
-> (forall x. Rep CovLoc x -> CovLoc) -> Generic CovLoc
forall x. Rep CovLoc x -> CovLoc
forall x. CovLoc -> Rep CovLoc x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. CovLoc -> Rep CovLoc x
from :: forall x. CovLoc -> Rep CovLoc x
$cto :: forall x. Rep CovLoc x -> CovLoc
to :: forall x. Rep CovLoc x -> CovLoc
Generic)
deriving anyclass ([CovLoc] -> Encoding
CovLoc -> Encoding
(CovLoc -> Encoding)
-> (forall s. Decoder s CovLoc)
-> ([CovLoc] -> Encoding)
-> (forall s. Decoder s [CovLoc])
-> Serialise CovLoc
forall s. Decoder s [CovLoc]
forall s. Decoder s CovLoc
forall a.
(a -> Encoding)
-> (forall s. Decoder s a)
-> ([a] -> Encoding)
-> (forall s. Decoder s [a])
-> Serialise a
$cencode :: CovLoc -> Encoding
encode :: CovLoc -> Encoding
$cdecode :: forall s. Decoder s CovLoc
decode :: forall s. Decoder s CovLoc
$cencodeList :: [CovLoc] -> Encoding
encodeList :: [CovLoc] -> Encoding
$cdecodeList :: forall s. Decoder s [CovLoc]
decodeList :: forall s. Decoder s [CovLoc]
Serialise)
deriving Get CovLoc
CovLoc -> Encoding
CovLoc -> Int -> Int
(CovLoc -> Encoding)
-> Get CovLoc -> (CovLoc -> Int -> Int) -> Flat CovLoc
forall a. (a -> Encoding) -> Get a -> (a -> Int -> Int) -> Flat a
$cencode :: CovLoc -> Encoding
encode :: CovLoc -> Encoding
$cdecode :: Get CovLoc
decode :: Get CovLoc
$csize :: CovLoc -> Int -> Int
size :: CovLoc -> Int -> Int
Flat via (FlatViaSerialise CovLoc)
deriving anyclass (CovLoc -> ()
(CovLoc -> ()) -> NFData CovLoc
forall a. (a -> ()) -> NFData a
$crnf :: CovLoc -> ()
rnf :: CovLoc -> ()
NFData, [CovLoc] -> Encoding
[CovLoc] -> Value
CovLoc -> Bool
CovLoc -> Encoding
CovLoc -> Value
(CovLoc -> Value)
-> (CovLoc -> Encoding)
-> ([CovLoc] -> Value)
-> ([CovLoc] -> Encoding)
-> (CovLoc -> Bool)
-> ToJSON CovLoc
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: CovLoc -> Value
toJSON :: CovLoc -> Value
$ctoEncoding :: CovLoc -> Encoding
toEncoding :: CovLoc -> Encoding
$ctoJSONList :: [CovLoc] -> Value
toJSONList :: [CovLoc] -> Value
$ctoEncodingList :: [CovLoc] -> Encoding
toEncodingList :: [CovLoc] -> Encoding
$comitField :: CovLoc -> Bool
omitField :: CovLoc -> Bool
ToJSON, Maybe CovLoc
Value -> Parser [CovLoc]
Value -> Parser CovLoc
(Value -> Parser CovLoc)
-> (Value -> Parser [CovLoc]) -> Maybe CovLoc -> FromJSON CovLoc
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser CovLoc
parseJSON :: Value -> Parser CovLoc
$cparseJSONList :: Value -> Parser [CovLoc]
parseJSONList :: Value -> Parser [CovLoc]
$comittedField :: Maybe CovLoc
omittedField :: Maybe CovLoc
FromJSON)
makeLenses ''CovLoc
instance Pretty CovLoc where
pretty :: forall ann. CovLoc -> Doc ann
pretty (CovLoc String
file Int
l1 Int
l2 Int
c1 Int
c2) =
[Doc ann] -> Doc ann
forall a. Monoid a => [a] -> a
mconcat [ String -> Doc ann
forall ann. String -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty String
file, Doc ann
":", Int -> Doc ann
forall ann. Int -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty Int
l1, Doc ann
",", Int -> Doc ann
forall ann. Int -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty Int
c1, Doc ann
"-", Int -> Doc ann
forall ann. Int -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty Int
l2, Doc ann
",", Int -> Doc ann
forall ann. Int -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty Int
c2]
data CoverageAnnotation = CoverLocation CovLoc
| CoverBool CovLoc Bool
deriving stock (Eq CoverageAnnotation
Eq CoverageAnnotation =>
(CoverageAnnotation -> CoverageAnnotation -> Ordering)
-> (CoverageAnnotation -> CoverageAnnotation -> Bool)
-> (CoverageAnnotation -> CoverageAnnotation -> Bool)
-> (CoverageAnnotation -> CoverageAnnotation -> Bool)
-> (CoverageAnnotation -> CoverageAnnotation -> Bool)
-> (CoverageAnnotation -> CoverageAnnotation -> CoverageAnnotation)
-> (CoverageAnnotation -> CoverageAnnotation -> CoverageAnnotation)
-> Ord CoverageAnnotation
CoverageAnnotation -> CoverageAnnotation -> Bool
CoverageAnnotation -> CoverageAnnotation -> Ordering
CoverageAnnotation -> CoverageAnnotation -> CoverageAnnotation
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: CoverageAnnotation -> CoverageAnnotation -> Ordering
compare :: CoverageAnnotation -> CoverageAnnotation -> Ordering
$c< :: CoverageAnnotation -> CoverageAnnotation -> Bool
< :: CoverageAnnotation -> CoverageAnnotation -> Bool
$c<= :: CoverageAnnotation -> CoverageAnnotation -> Bool
<= :: CoverageAnnotation -> CoverageAnnotation -> Bool
$c> :: CoverageAnnotation -> CoverageAnnotation -> Bool
> :: CoverageAnnotation -> CoverageAnnotation -> Bool
$c>= :: CoverageAnnotation -> CoverageAnnotation -> Bool
>= :: CoverageAnnotation -> CoverageAnnotation -> Bool
$cmax :: CoverageAnnotation -> CoverageAnnotation -> CoverageAnnotation
max :: CoverageAnnotation -> CoverageAnnotation -> CoverageAnnotation
$cmin :: CoverageAnnotation -> CoverageAnnotation -> CoverageAnnotation
min :: CoverageAnnotation -> CoverageAnnotation -> CoverageAnnotation
Ord, CoverageAnnotation -> CoverageAnnotation -> Bool
(CoverageAnnotation -> CoverageAnnotation -> Bool)
-> (CoverageAnnotation -> CoverageAnnotation -> Bool)
-> Eq CoverageAnnotation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CoverageAnnotation -> CoverageAnnotation -> Bool
== :: CoverageAnnotation -> CoverageAnnotation -> Bool
$c/= :: CoverageAnnotation -> CoverageAnnotation -> Bool
/= :: CoverageAnnotation -> CoverageAnnotation -> Bool
Eq, Int -> CoverageAnnotation -> ShowS
[CoverageAnnotation] -> ShowS
CoverageAnnotation -> String
(Int -> CoverageAnnotation -> ShowS)
-> (CoverageAnnotation -> String)
-> ([CoverageAnnotation] -> ShowS)
-> Show CoverageAnnotation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CoverageAnnotation -> ShowS
showsPrec :: Int -> CoverageAnnotation -> ShowS
$cshow :: CoverageAnnotation -> String
show :: CoverageAnnotation -> String
$cshowList :: [CoverageAnnotation] -> ShowS
showList :: [CoverageAnnotation] -> ShowS
Show, ReadPrec [CoverageAnnotation]
ReadPrec CoverageAnnotation
Int -> ReadS CoverageAnnotation
ReadS [CoverageAnnotation]
(Int -> ReadS CoverageAnnotation)
-> ReadS [CoverageAnnotation]
-> ReadPrec CoverageAnnotation
-> ReadPrec [CoverageAnnotation]
-> Read CoverageAnnotation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS CoverageAnnotation
readsPrec :: Int -> ReadS CoverageAnnotation
$creadList :: ReadS [CoverageAnnotation]
readList :: ReadS [CoverageAnnotation]
$creadPrec :: ReadPrec CoverageAnnotation
readPrec :: ReadPrec CoverageAnnotation
$creadListPrec :: ReadPrec [CoverageAnnotation]
readListPrec :: ReadPrec [CoverageAnnotation]
Read, (forall x. CoverageAnnotation -> Rep CoverageAnnotation x)
-> (forall x. Rep CoverageAnnotation x -> CoverageAnnotation)
-> Generic CoverageAnnotation
forall x. Rep CoverageAnnotation x -> CoverageAnnotation
forall x. CoverageAnnotation -> Rep CoverageAnnotation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. CoverageAnnotation -> Rep CoverageAnnotation x
from :: forall x. CoverageAnnotation -> Rep CoverageAnnotation x
$cto :: forall x. Rep CoverageAnnotation x -> CoverageAnnotation
to :: forall x. Rep CoverageAnnotation x -> CoverageAnnotation
Generic)
deriving anyclass ([CoverageAnnotation] -> Encoding
CoverageAnnotation -> Encoding
(CoverageAnnotation -> Encoding)
-> (forall s. Decoder s CoverageAnnotation)
-> ([CoverageAnnotation] -> Encoding)
-> (forall s. Decoder s [CoverageAnnotation])
-> Serialise CoverageAnnotation
forall s. Decoder s [CoverageAnnotation]
forall s. Decoder s CoverageAnnotation
forall a.
(a -> Encoding)
-> (forall s. Decoder s a)
-> ([a] -> Encoding)
-> (forall s. Decoder s [a])
-> Serialise a
$cencode :: CoverageAnnotation -> Encoding
encode :: CoverageAnnotation -> Encoding
$cdecode :: forall s. Decoder s CoverageAnnotation
decode :: forall s. Decoder s CoverageAnnotation
$cencodeList :: [CoverageAnnotation] -> Encoding
encodeList :: [CoverageAnnotation] -> Encoding
$cdecodeList :: forall s. Decoder s [CoverageAnnotation]
decodeList :: forall s. Decoder s [CoverageAnnotation]
Serialise)
deriving Get CoverageAnnotation
CoverageAnnotation -> Encoding
CoverageAnnotation -> Int -> Int
(CoverageAnnotation -> Encoding)
-> Get CoverageAnnotation
-> (CoverageAnnotation -> Int -> Int)
-> Flat CoverageAnnotation
forall a. (a -> Encoding) -> Get a -> (a -> Int -> Int) -> Flat a
$cencode :: CoverageAnnotation -> Encoding
encode :: CoverageAnnotation -> Encoding
$cdecode :: Get CoverageAnnotation
decode :: Get CoverageAnnotation
$csize :: CoverageAnnotation -> Int -> Int
size :: CoverageAnnotation -> Int -> Int
Flat via (FlatViaSerialise CoverageAnnotation)
deriving anyclass (CoverageAnnotation -> ()
(CoverageAnnotation -> ()) -> NFData CoverageAnnotation
forall a. (a -> ()) -> NFData a
$crnf :: CoverageAnnotation -> ()
rnf :: CoverageAnnotation -> ()
NFData, [CoverageAnnotation] -> Encoding
[CoverageAnnotation] -> Value
CoverageAnnotation -> Bool
CoverageAnnotation -> Encoding
CoverageAnnotation -> Value
(CoverageAnnotation -> Value)
-> (CoverageAnnotation -> Encoding)
-> ([CoverageAnnotation] -> Value)
-> ([CoverageAnnotation] -> Encoding)
-> (CoverageAnnotation -> Bool)
-> ToJSON CoverageAnnotation
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: CoverageAnnotation -> Value
toJSON :: CoverageAnnotation -> Value
$ctoEncoding :: CoverageAnnotation -> Encoding
toEncoding :: CoverageAnnotation -> Encoding
$ctoJSONList :: [CoverageAnnotation] -> Value
toJSONList :: [CoverageAnnotation] -> Value
$ctoEncodingList :: [CoverageAnnotation] -> Encoding
toEncodingList :: [CoverageAnnotation] -> Encoding
$comitField :: CoverageAnnotation -> Bool
omitField :: CoverageAnnotation -> Bool
ToJSON, Maybe CoverageAnnotation
Value -> Parser [CoverageAnnotation]
Value -> Parser CoverageAnnotation
(Value -> Parser CoverageAnnotation)
-> (Value -> Parser [CoverageAnnotation])
-> Maybe CoverageAnnotation
-> FromJSON CoverageAnnotation
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser CoverageAnnotation
parseJSON :: Value -> Parser CoverageAnnotation
$cparseJSONList :: Value -> Parser [CoverageAnnotation]
parseJSONList :: Value -> Parser [CoverageAnnotation]
$comittedField :: Maybe CoverageAnnotation
omittedField :: Maybe CoverageAnnotation
FromJSON, ToJSONKeyFunction [CoverageAnnotation]
ToJSONKeyFunction CoverageAnnotation
ToJSONKeyFunction CoverageAnnotation
-> ToJSONKeyFunction [CoverageAnnotation]
-> ToJSONKey CoverageAnnotation
forall a.
ToJSONKeyFunction a -> ToJSONKeyFunction [a] -> ToJSONKey a
$ctoJSONKey :: ToJSONKeyFunction CoverageAnnotation
toJSONKey :: ToJSONKeyFunction CoverageAnnotation
$ctoJSONKeyList :: ToJSONKeyFunction [CoverageAnnotation]
toJSONKeyList :: ToJSONKeyFunction [CoverageAnnotation]
ToJSONKey, FromJSONKeyFunction [CoverageAnnotation]
FromJSONKeyFunction CoverageAnnotation
FromJSONKeyFunction CoverageAnnotation
-> FromJSONKeyFunction [CoverageAnnotation]
-> FromJSONKey CoverageAnnotation
forall a.
FromJSONKeyFunction a -> FromJSONKeyFunction [a] -> FromJSONKey a
$cfromJSONKey :: FromJSONKeyFunction CoverageAnnotation
fromJSONKey :: FromJSONKeyFunction CoverageAnnotation
$cfromJSONKeyList :: FromJSONKeyFunction [CoverageAnnotation]
fromJSONKeyList :: FromJSONKeyFunction [CoverageAnnotation]
FromJSONKey)
instance Pretty CoverageAnnotation where
pretty :: forall ann. CoverageAnnotation -> Doc ann
pretty (CoverLocation CovLoc
loc) = CovLoc -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. CovLoc -> Doc ann
pretty CovLoc
loc
pretty (CoverBool CovLoc
loc Bool
b) = CovLoc -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. CovLoc -> Doc ann
pretty CovLoc
loc Doc ann -> Doc ann -> Doc ann
forall ann. Doc ann -> Doc ann -> Doc ann
<+> Doc ann
"=" Doc ann -> Doc ann -> Doc ann
forall ann. Doc ann -> Doc ann -> Doc ann
<+> Bool -> Doc ann
forall ann. Bool -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty Bool
b
data Metadata = ApplicationHeadSymbol String
| IgnoredAnnotation
deriving stock (Eq Metadata
Eq Metadata =>
(Metadata -> Metadata -> Ordering)
-> (Metadata -> Metadata -> Bool)
-> (Metadata -> Metadata -> Bool)
-> (Metadata -> Metadata -> Bool)
-> (Metadata -> Metadata -> Bool)
-> (Metadata -> Metadata -> Metadata)
-> (Metadata -> Metadata -> Metadata)
-> Ord Metadata
Metadata -> Metadata -> Bool
Metadata -> Metadata -> Ordering
Metadata -> Metadata -> Metadata
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: Metadata -> Metadata -> Ordering
compare :: Metadata -> Metadata -> Ordering
$c< :: Metadata -> Metadata -> Bool
< :: Metadata -> Metadata -> Bool
$c<= :: Metadata -> Metadata -> Bool
<= :: Metadata -> Metadata -> Bool
$c> :: Metadata -> Metadata -> Bool
> :: Metadata -> Metadata -> Bool
$c>= :: Metadata -> Metadata -> Bool
>= :: Metadata -> Metadata -> Bool
$cmax :: Metadata -> Metadata -> Metadata
max :: Metadata -> Metadata -> Metadata
$cmin :: Metadata -> Metadata -> Metadata
min :: Metadata -> Metadata -> Metadata
Ord, Metadata -> Metadata -> Bool
(Metadata -> Metadata -> Bool)
-> (Metadata -> Metadata -> Bool) -> Eq Metadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Metadata -> Metadata -> Bool
== :: Metadata -> Metadata -> Bool
$c/= :: Metadata -> Metadata -> Bool
/= :: Metadata -> Metadata -> Bool
Eq, Int -> Metadata -> ShowS
[Metadata] -> ShowS
Metadata -> String
(Int -> Metadata -> ShowS)
-> (Metadata -> String) -> ([Metadata] -> ShowS) -> Show Metadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Metadata -> ShowS
showsPrec :: Int -> Metadata -> ShowS
$cshow :: Metadata -> String
show :: Metadata -> String
$cshowList :: [Metadata] -> ShowS
showList :: [Metadata] -> ShowS
Show, (forall x. Metadata -> Rep Metadata x)
-> (forall x. Rep Metadata x -> Metadata) -> Generic Metadata
forall x. Rep Metadata x -> Metadata
forall x. Metadata -> Rep Metadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Metadata -> Rep Metadata x
from :: forall x. Metadata -> Rep Metadata x
$cto :: forall x. Rep Metadata x -> Metadata
to :: forall x. Rep Metadata x -> Metadata
Generic)
deriving anyclass ([Metadata] -> Encoding
Metadata -> Encoding
(Metadata -> Encoding)
-> (forall s. Decoder s Metadata)
-> ([Metadata] -> Encoding)
-> (forall s. Decoder s [Metadata])
-> Serialise Metadata
forall s. Decoder s [Metadata]
forall s. Decoder s Metadata
forall a.
(a -> Encoding)
-> (forall s. Decoder s a)
-> ([a] -> Encoding)
-> (forall s. Decoder s [a])
-> Serialise a
$cencode :: Metadata -> Encoding
encode :: Metadata -> Encoding
$cdecode :: forall s. Decoder s Metadata
decode :: forall s. Decoder s Metadata
$cencodeList :: [Metadata] -> Encoding
encodeList :: [Metadata] -> Encoding
$cdecodeList :: forall s. Decoder s [Metadata]
decodeList :: forall s. Decoder s [Metadata]
Serialise)
deriving Get Metadata
Metadata -> Encoding
Metadata -> Int -> Int
(Metadata -> Encoding)
-> Get Metadata -> (Metadata -> Int -> Int) -> Flat Metadata
forall a. (a -> Encoding) -> Get a -> (a -> Int -> Int) -> Flat a
$cencode :: Metadata -> Encoding
encode :: Metadata -> Encoding
$cdecode :: Get Metadata
decode :: Get Metadata
$csize :: Metadata -> Int -> Int
size :: Metadata -> Int -> Int
Flat via (FlatViaSerialise Metadata)
deriving anyclass (Metadata -> ()
(Metadata -> ()) -> NFData Metadata
forall a. (a -> ()) -> NFData a
$crnf :: Metadata -> ()
rnf :: Metadata -> ()
NFData, [Metadata] -> Encoding
[Metadata] -> Value
Metadata -> Bool
Metadata -> Encoding
Metadata -> Value
(Metadata -> Value)
-> (Metadata -> Encoding)
-> ([Metadata] -> Value)
-> ([Metadata] -> Encoding)
-> (Metadata -> Bool)
-> ToJSON Metadata
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: Metadata -> Value
toJSON :: Metadata -> Value
$ctoEncoding :: Metadata -> Encoding
toEncoding :: Metadata -> Encoding
$ctoJSONList :: [Metadata] -> Value
toJSONList :: [Metadata] -> Value
$ctoEncodingList :: [Metadata] -> Encoding
toEncodingList :: [Metadata] -> Encoding
$comitField :: Metadata -> Bool
omitField :: Metadata -> Bool
ToJSON, Maybe Metadata
Value -> Parser [Metadata]
Value -> Parser Metadata
(Value -> Parser Metadata)
-> (Value -> Parser [Metadata])
-> Maybe Metadata
-> FromJSON Metadata
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser Metadata
parseJSON :: Value -> Parser Metadata
$cparseJSONList :: Value -> Parser [Metadata]
parseJSONList :: Value -> Parser [Metadata]
$comittedField :: Maybe Metadata
omittedField :: Maybe Metadata
FromJSON)
instance Pretty Metadata where
pretty :: forall ann. Metadata -> Doc ann
pretty = Metadata -> Doc ann
forall a ann. Show a => a -> Doc ann
viaShow
newtype CoverageMetadata = CoverageMetadata { CoverageMetadata -> Set Metadata
_metadataSet :: Set Metadata }
deriving stock (Eq CoverageMetadata
Eq CoverageMetadata =>
(CoverageMetadata -> CoverageMetadata -> Ordering)
-> (CoverageMetadata -> CoverageMetadata -> Bool)
-> (CoverageMetadata -> CoverageMetadata -> Bool)
-> (CoverageMetadata -> CoverageMetadata -> Bool)
-> (CoverageMetadata -> CoverageMetadata -> Bool)
-> (CoverageMetadata -> CoverageMetadata -> CoverageMetadata)
-> (CoverageMetadata -> CoverageMetadata -> CoverageMetadata)
-> Ord CoverageMetadata
CoverageMetadata -> CoverageMetadata -> Bool
CoverageMetadata -> CoverageMetadata -> Ordering
CoverageMetadata -> CoverageMetadata -> CoverageMetadata
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: CoverageMetadata -> CoverageMetadata -> Ordering
compare :: CoverageMetadata -> CoverageMetadata -> Ordering
$c< :: CoverageMetadata -> CoverageMetadata -> Bool
< :: CoverageMetadata -> CoverageMetadata -> Bool
$c<= :: CoverageMetadata -> CoverageMetadata -> Bool
<= :: CoverageMetadata -> CoverageMetadata -> Bool
$c> :: CoverageMetadata -> CoverageMetadata -> Bool
> :: CoverageMetadata -> CoverageMetadata -> Bool
$c>= :: CoverageMetadata -> CoverageMetadata -> Bool
>= :: CoverageMetadata -> CoverageMetadata -> Bool
$cmax :: CoverageMetadata -> CoverageMetadata -> CoverageMetadata
max :: CoverageMetadata -> CoverageMetadata -> CoverageMetadata
$cmin :: CoverageMetadata -> CoverageMetadata -> CoverageMetadata
min :: CoverageMetadata -> CoverageMetadata -> CoverageMetadata
Ord, CoverageMetadata -> CoverageMetadata -> Bool
(CoverageMetadata -> CoverageMetadata -> Bool)
-> (CoverageMetadata -> CoverageMetadata -> Bool)
-> Eq CoverageMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CoverageMetadata -> CoverageMetadata -> Bool
== :: CoverageMetadata -> CoverageMetadata -> Bool
$c/= :: CoverageMetadata -> CoverageMetadata -> Bool
/= :: CoverageMetadata -> CoverageMetadata -> Bool
Eq, Int -> CoverageMetadata -> ShowS
[CoverageMetadata] -> ShowS
CoverageMetadata -> String
(Int -> CoverageMetadata -> ShowS)
-> (CoverageMetadata -> String)
-> ([CoverageMetadata] -> ShowS)
-> Show CoverageMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CoverageMetadata -> ShowS
showsPrec :: Int -> CoverageMetadata -> ShowS
$cshow :: CoverageMetadata -> String
show :: CoverageMetadata -> String
$cshowList :: [CoverageMetadata] -> ShowS
showList :: [CoverageMetadata] -> ShowS
Show, (forall x. CoverageMetadata -> Rep CoverageMetadata x)
-> (forall x. Rep CoverageMetadata x -> CoverageMetadata)
-> Generic CoverageMetadata
forall x. Rep CoverageMetadata x -> CoverageMetadata
forall x. CoverageMetadata -> Rep CoverageMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. CoverageMetadata -> Rep CoverageMetadata x
from :: forall x. CoverageMetadata -> Rep CoverageMetadata x
$cto :: forall x. Rep CoverageMetadata x -> CoverageMetadata
to :: forall x. Rep CoverageMetadata x -> CoverageMetadata
Generic)
deriving anyclass ([CoverageMetadata] -> Encoding
CoverageMetadata -> Encoding
(CoverageMetadata -> Encoding)
-> (forall s. Decoder s CoverageMetadata)
-> ([CoverageMetadata] -> Encoding)
-> (forall s. Decoder s [CoverageMetadata])
-> Serialise CoverageMetadata
forall s. Decoder s [CoverageMetadata]
forall s. Decoder s CoverageMetadata
forall a.
(a -> Encoding)
-> (forall s. Decoder s a)
-> ([a] -> Encoding)
-> (forall s. Decoder s [a])
-> Serialise a
$cencode :: CoverageMetadata -> Encoding
encode :: CoverageMetadata -> Encoding
$cdecode :: forall s. Decoder s CoverageMetadata
decode :: forall s. Decoder s CoverageMetadata
$cencodeList :: [CoverageMetadata] -> Encoding
encodeList :: [CoverageMetadata] -> Encoding
$cdecodeList :: forall s. Decoder s [CoverageMetadata]
decodeList :: forall s. Decoder s [CoverageMetadata]
Serialise, CoverageMetadata -> ()
(CoverageMetadata -> ()) -> NFData CoverageMetadata
forall a. (a -> ()) -> NFData a
$crnf :: CoverageMetadata -> ()
rnf :: CoverageMetadata -> ()
NFData, [CoverageMetadata] -> Encoding
[CoverageMetadata] -> Value
CoverageMetadata -> Bool
CoverageMetadata -> Encoding
CoverageMetadata -> Value
(CoverageMetadata -> Value)
-> (CoverageMetadata -> Encoding)
-> ([CoverageMetadata] -> Value)
-> ([CoverageMetadata] -> Encoding)
-> (CoverageMetadata -> Bool)
-> ToJSON CoverageMetadata
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: CoverageMetadata -> Value
toJSON :: CoverageMetadata -> Value
$ctoEncoding :: CoverageMetadata -> Encoding
toEncoding :: CoverageMetadata -> Encoding
$ctoJSONList :: [CoverageMetadata] -> Value
toJSONList :: [CoverageMetadata] -> Value
$ctoEncodingList :: [CoverageMetadata] -> Encoding
toEncodingList :: [CoverageMetadata] -> Encoding
$comitField :: CoverageMetadata -> Bool
omitField :: CoverageMetadata -> Bool
ToJSON, Maybe CoverageMetadata
Value -> Parser [CoverageMetadata]
Value -> Parser CoverageMetadata
(Value -> Parser CoverageMetadata)
-> (Value -> Parser [CoverageMetadata])
-> Maybe CoverageMetadata
-> FromJSON CoverageMetadata
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser CoverageMetadata
parseJSON :: Value -> Parser CoverageMetadata
$cparseJSONList :: Value -> Parser [CoverageMetadata]
parseJSONList :: Value -> Parser [CoverageMetadata]
$comittedField :: Maybe CoverageMetadata
omittedField :: Maybe CoverageMetadata
FromJSON)
deriving newtype (NonEmpty CoverageMetadata -> CoverageMetadata
CoverageMetadata -> CoverageMetadata -> CoverageMetadata
(CoverageMetadata -> CoverageMetadata -> CoverageMetadata)
-> (NonEmpty CoverageMetadata -> CoverageMetadata)
-> (forall b.
Integral b =>
b -> CoverageMetadata -> CoverageMetadata)
-> Semigroup CoverageMetadata
forall b. Integral b => b -> CoverageMetadata -> CoverageMetadata
forall a.
(a -> a -> a)
-> (NonEmpty a -> a)
-> (forall b. Integral b => b -> a -> a)
-> Semigroup a
$c<> :: CoverageMetadata -> CoverageMetadata -> CoverageMetadata
<> :: CoverageMetadata -> CoverageMetadata -> CoverageMetadata
$csconcat :: NonEmpty CoverageMetadata -> CoverageMetadata
sconcat :: NonEmpty CoverageMetadata -> CoverageMetadata
$cstimes :: forall b. Integral b => b -> CoverageMetadata -> CoverageMetadata
stimes :: forall b. Integral b => b -> CoverageMetadata -> CoverageMetadata
Semigroup, Semigroup CoverageMetadata
CoverageMetadata
Semigroup CoverageMetadata =>
CoverageMetadata
-> (CoverageMetadata -> CoverageMetadata -> CoverageMetadata)
-> ([CoverageMetadata] -> CoverageMetadata)
-> Monoid CoverageMetadata
[CoverageMetadata] -> CoverageMetadata
CoverageMetadata -> CoverageMetadata -> CoverageMetadata
forall a.
Semigroup a =>
a -> (a -> a -> a) -> ([a] -> a) -> Monoid a
$cmempty :: CoverageMetadata
mempty :: CoverageMetadata
$cmappend :: CoverageMetadata -> CoverageMetadata -> CoverageMetadata
mappend :: CoverageMetadata -> CoverageMetadata -> CoverageMetadata
$cmconcat :: [CoverageMetadata] -> CoverageMetadata
mconcat :: [CoverageMetadata] -> CoverageMetadata
Monoid)
deriving Get CoverageMetadata
CoverageMetadata -> Encoding
CoverageMetadata -> Int -> Int
(CoverageMetadata -> Encoding)
-> Get CoverageMetadata
-> (CoverageMetadata -> Int -> Int)
-> Flat CoverageMetadata
forall a. (a -> Encoding) -> Get a -> (a -> Int -> Int) -> Flat a
$cencode :: CoverageMetadata -> Encoding
encode :: CoverageMetadata -> Encoding
$cdecode :: Get CoverageMetadata
decode :: Get CoverageMetadata
$csize :: CoverageMetadata -> Int -> Int
size :: CoverageMetadata -> Int -> Int
Flat via (FlatViaSerialise CoverageMetadata)
makeLenses ''CoverageMetadata
instance Pretty CoverageMetadata where
pretty :: forall ann. CoverageMetadata -> Doc ann
pretty (CoverageMetadata Set Metadata
s) = [Doc ann] -> Doc ann
forall ann. [Doc ann] -> Doc ann
vsep ([Doc ann] -> Doc ann)
-> (Set Metadata -> [Doc ann]) -> Set Metadata -> Doc ann
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Metadata -> Doc ann) -> [Metadata] -> [Doc ann]
forall a b. (a -> b) -> [a] -> [b]
map Metadata -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. Metadata -> Doc ann
pretty ([Metadata] -> [Doc ann])
-> (Set Metadata -> [Metadata]) -> Set Metadata -> [Doc ann]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Set Metadata -> [Metadata]
forall a. Set a -> [a]
Set.toList (Set Metadata -> Doc ann) -> Set Metadata -> Doc ann
forall a b. (a -> b) -> a -> b
$ Set Metadata
s
newtype CoverageIndex = CoverageIndex
{ CoverageIndex -> Map CoverageAnnotation CoverageMetadata
_coverageMetadata :: Map CoverageAnnotation CoverageMetadata }
deriving stock (Eq CoverageIndex
Eq CoverageIndex =>
(CoverageIndex -> CoverageIndex -> Ordering)
-> (CoverageIndex -> CoverageIndex -> Bool)
-> (CoverageIndex -> CoverageIndex -> Bool)
-> (CoverageIndex -> CoverageIndex -> Bool)
-> (CoverageIndex -> CoverageIndex -> Bool)
-> (CoverageIndex -> CoverageIndex -> CoverageIndex)
-> (CoverageIndex -> CoverageIndex -> CoverageIndex)
-> Ord CoverageIndex
CoverageIndex -> CoverageIndex -> Bool
CoverageIndex -> CoverageIndex -> Ordering
CoverageIndex -> CoverageIndex -> CoverageIndex
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: CoverageIndex -> CoverageIndex -> Ordering
compare :: CoverageIndex -> CoverageIndex -> Ordering
$c< :: CoverageIndex -> CoverageIndex -> Bool
< :: CoverageIndex -> CoverageIndex -> Bool
$c<= :: CoverageIndex -> CoverageIndex -> Bool
<= :: CoverageIndex -> CoverageIndex -> Bool
$c> :: CoverageIndex -> CoverageIndex -> Bool
> :: CoverageIndex -> CoverageIndex -> Bool
$c>= :: CoverageIndex -> CoverageIndex -> Bool
>= :: CoverageIndex -> CoverageIndex -> Bool
$cmax :: CoverageIndex -> CoverageIndex -> CoverageIndex
max :: CoverageIndex -> CoverageIndex -> CoverageIndex
$cmin :: CoverageIndex -> CoverageIndex -> CoverageIndex
min :: CoverageIndex -> CoverageIndex -> CoverageIndex
Ord, CoverageIndex -> CoverageIndex -> Bool
(CoverageIndex -> CoverageIndex -> Bool)
-> (CoverageIndex -> CoverageIndex -> Bool) -> Eq CoverageIndex
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CoverageIndex -> CoverageIndex -> Bool
== :: CoverageIndex -> CoverageIndex -> Bool
$c/= :: CoverageIndex -> CoverageIndex -> Bool
/= :: CoverageIndex -> CoverageIndex -> Bool
Eq, Int -> CoverageIndex -> ShowS
[CoverageIndex] -> ShowS
CoverageIndex -> String
(Int -> CoverageIndex -> ShowS)
-> (CoverageIndex -> String)
-> ([CoverageIndex] -> ShowS)
-> Show CoverageIndex
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CoverageIndex -> ShowS
showsPrec :: Int -> CoverageIndex -> ShowS
$cshow :: CoverageIndex -> String
show :: CoverageIndex -> String
$cshowList :: [CoverageIndex] -> ShowS
showList :: [CoverageIndex] -> ShowS
Show, (forall x. CoverageIndex -> Rep CoverageIndex x)
-> (forall x. Rep CoverageIndex x -> CoverageIndex)
-> Generic CoverageIndex
forall x. Rep CoverageIndex x -> CoverageIndex
forall x. CoverageIndex -> Rep CoverageIndex x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. CoverageIndex -> Rep CoverageIndex x
from :: forall x. CoverageIndex -> Rep CoverageIndex x
$cto :: forall x. Rep CoverageIndex x -> CoverageIndex
to :: forall x. Rep CoverageIndex x -> CoverageIndex
Generic)
deriving anyclass ([CoverageIndex] -> Encoding
CoverageIndex -> Encoding
(CoverageIndex -> Encoding)
-> (forall s. Decoder s CoverageIndex)
-> ([CoverageIndex] -> Encoding)
-> (forall s. Decoder s [CoverageIndex])
-> Serialise CoverageIndex
forall s. Decoder s [CoverageIndex]
forall s. Decoder s CoverageIndex
forall a.
(a -> Encoding)
-> (forall s. Decoder s a)
-> ([a] -> Encoding)
-> (forall s. Decoder s [a])
-> Serialise a
$cencode :: CoverageIndex -> Encoding
encode :: CoverageIndex -> Encoding
$cdecode :: forall s. Decoder s CoverageIndex
decode :: forall s. Decoder s CoverageIndex
$cencodeList :: [CoverageIndex] -> Encoding
encodeList :: [CoverageIndex] -> Encoding
$cdecodeList :: forall s. Decoder s [CoverageIndex]
decodeList :: forall s. Decoder s [CoverageIndex]
Serialise)
deriving Get CoverageIndex
CoverageIndex -> Encoding
CoverageIndex -> Int -> Int
(CoverageIndex -> Encoding)
-> Get CoverageIndex
-> (CoverageIndex -> Int -> Int)
-> Flat CoverageIndex
forall a. (a -> Encoding) -> Get a -> (a -> Int -> Int) -> Flat a
$cencode :: CoverageIndex -> Encoding
encode :: CoverageIndex -> Encoding
$cdecode :: Get CoverageIndex
decode :: Get CoverageIndex
$csize :: CoverageIndex -> Int -> Int
size :: CoverageIndex -> Int -> Int
Flat via (FlatViaSerialise CoverageIndex)
deriving anyclass (CoverageIndex -> ()
(CoverageIndex -> ()) -> NFData CoverageIndex
forall a. (a -> ()) -> NFData a
$crnf :: CoverageIndex -> ()
rnf :: CoverageIndex -> ()
NFData, [CoverageIndex] -> Encoding
[CoverageIndex] -> Value
CoverageIndex -> Bool
CoverageIndex -> Encoding
CoverageIndex -> Value
(CoverageIndex -> Value)
-> (CoverageIndex -> Encoding)
-> ([CoverageIndex] -> Value)
-> ([CoverageIndex] -> Encoding)
-> (CoverageIndex -> Bool)
-> ToJSON CoverageIndex
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: CoverageIndex -> Value
toJSON :: CoverageIndex -> Value
$ctoEncoding :: CoverageIndex -> Encoding
toEncoding :: CoverageIndex -> Encoding
$ctoJSONList :: [CoverageIndex] -> Value
toJSONList :: [CoverageIndex] -> Value
$ctoEncodingList :: [CoverageIndex] -> Encoding
toEncodingList :: [CoverageIndex] -> Encoding
$comitField :: CoverageIndex -> Bool
omitField :: CoverageIndex -> Bool
ToJSON, Maybe CoverageIndex
Value -> Parser [CoverageIndex]
Value -> Parser CoverageIndex
(Value -> Parser CoverageIndex)
-> (Value -> Parser [CoverageIndex])
-> Maybe CoverageIndex
-> FromJSON CoverageIndex
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser CoverageIndex
parseJSON :: Value -> Parser CoverageIndex
$cparseJSONList :: Value -> Parser [CoverageIndex]
parseJSONList :: Value -> Parser [CoverageIndex]
$comittedField :: Maybe CoverageIndex
omittedField :: Maybe CoverageIndex
FromJSON)
makeLenses ''CoverageIndex
coverageAnnotations :: Getter CoverageIndex (Set CoverageAnnotation)
coverageAnnotations :: Getter CoverageIndex (Set CoverageAnnotation)
coverageAnnotations = (Map CoverageAnnotation CoverageMetadata
-> f (Map CoverageAnnotation CoverageMetadata))
-> CoverageIndex -> f CoverageIndex
Iso' CoverageIndex (Map CoverageAnnotation CoverageMetadata)
coverageMetadata ((Map CoverageAnnotation CoverageMetadata
-> f (Map CoverageAnnotation CoverageMetadata))
-> CoverageIndex -> f CoverageIndex)
-> ((Set CoverageAnnotation -> f (Set CoverageAnnotation))
-> Map CoverageAnnotation CoverageMetadata
-> f (Map CoverageAnnotation CoverageMetadata))
-> (Set CoverageAnnotation -> f (Set CoverageAnnotation))
-> CoverageIndex
-> f CoverageIndex
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Map CoverageAnnotation CoverageMetadata -> Set CoverageAnnotation)
-> (Set CoverageAnnotation -> f (Set CoverageAnnotation))
-> Map CoverageAnnotation CoverageMetadata
-> f (Map CoverageAnnotation CoverageMetadata)
forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
to Map CoverageAnnotation CoverageMetadata -> Set CoverageAnnotation
forall k a. Map k a -> Set k
Map.keysSet
ignoredAnnotations :: Getter CoverageIndex (Set CoverageAnnotation)
ignoredAnnotations :: Getter CoverageIndex (Set CoverageAnnotation)
ignoredAnnotations = (Map CoverageAnnotation CoverageMetadata
-> f (Map CoverageAnnotation CoverageMetadata))
-> CoverageIndex -> f CoverageIndex
Iso' CoverageIndex (Map CoverageAnnotation CoverageMetadata)
coverageMetadata
((Map CoverageAnnotation CoverageMetadata
-> f (Map CoverageAnnotation CoverageMetadata))
-> CoverageIndex -> f CoverageIndex)
-> ((Set CoverageAnnotation -> f (Set CoverageAnnotation))
-> Map CoverageAnnotation CoverageMetadata
-> f (Map CoverageAnnotation CoverageMetadata))
-> (Set CoverageAnnotation -> f (Set CoverageAnnotation))
-> CoverageIndex
-> f CoverageIndex
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Map CoverageAnnotation CoverageMetadata -> Set CoverageAnnotation)
-> (Set CoverageAnnotation -> f (Set CoverageAnnotation))
-> Map CoverageAnnotation CoverageMetadata
-> f (Map CoverageAnnotation CoverageMetadata)
forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
to (Map CoverageAnnotation CoverageMetadata -> Set CoverageAnnotation
forall k a. Map k a -> Set k
Map.keysSet (Map CoverageAnnotation CoverageMetadata -> Set CoverageAnnotation)
-> (Map CoverageAnnotation CoverageMetadata
-> Map CoverageAnnotation CoverageMetadata)
-> Map CoverageAnnotation CoverageMetadata
-> Set CoverageAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (CoverageMetadata -> Bool)
-> Map CoverageAnnotation CoverageMetadata
-> Map CoverageAnnotation CoverageMetadata
forall a k. (a -> Bool) -> Map k a -> Map k a
Map.filter (Metadata -> Set Metadata -> Bool
forall a. Ord a => a -> Set a -> Bool
Set.member Metadata
IgnoredAnnotation (Set Metadata -> Bool)
-> (CoverageMetadata -> Set Metadata) -> CoverageMetadata -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CoverageMetadata -> Set Metadata
_metadataSet))
instance Semigroup CoverageIndex where
CoverageIndex
ci <> :: CoverageIndex -> CoverageIndex -> CoverageIndex
<> CoverageIndex
ci' = Map CoverageAnnotation CoverageMetadata -> CoverageIndex
CoverageIndex ((CoverageMetadata -> CoverageMetadata -> CoverageMetadata)
-> Map CoverageAnnotation CoverageMetadata
-> Map CoverageAnnotation CoverageMetadata
-> Map CoverageAnnotation CoverageMetadata
forall k a. Ord k => (a -> a -> a) -> Map k a -> Map k a -> Map k a
Map.unionWith CoverageMetadata -> CoverageMetadata -> CoverageMetadata
forall a. Semigroup a => a -> a -> a
(<>) (CoverageIndex -> Map CoverageAnnotation CoverageMetadata
_coverageMetadata CoverageIndex
ci) (CoverageIndex -> Map CoverageAnnotation CoverageMetadata
_coverageMetadata CoverageIndex
ci'))
instance Monoid CoverageIndex where
mempty :: CoverageIndex
mempty = Map CoverageAnnotation CoverageMetadata -> CoverageIndex
CoverageIndex Map CoverageAnnotation CoverageMetadata
forall k a. Map k a
Map.empty
addLocationToCoverageIndex :: MonadWriter CoverageIndex m => CovLoc -> m CoverageAnnotation
addLocationToCoverageIndex :: forall (m :: * -> *).
MonadWriter CoverageIndex m =>
CovLoc -> m CoverageAnnotation
addLocationToCoverageIndex CovLoc
src = do
let ann :: CoverageAnnotation
ann = CovLoc -> CoverageAnnotation
CoverLocation CovLoc
src
CoverageIndex -> m ()
forall w (m :: * -> *). MonadWriter w m => w -> m ()
tell (CoverageIndex -> m ()) -> CoverageIndex -> m ()
forall a b. (a -> b) -> a -> b
$ Map CoverageAnnotation CoverageMetadata -> CoverageIndex
CoverageIndex (Map CoverageAnnotation CoverageMetadata -> CoverageIndex)
-> Map CoverageAnnotation CoverageMetadata -> CoverageIndex
forall a b. (a -> b) -> a -> b
$ CoverageAnnotation
-> CoverageMetadata -> Map CoverageAnnotation CoverageMetadata
forall k a. k -> a -> Map k a
Map.singleton CoverageAnnotation
ann CoverageMetadata
forall a. Monoid a => a
mempty
CoverageAnnotation -> m CoverageAnnotation
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure CoverageAnnotation
ann
addBoolCaseToCoverageIndex :: MonadWriter CoverageIndex m
=> CovLoc -> Bool -> CoverageMetadata -> m CoverageAnnotation
addBoolCaseToCoverageIndex :: forall (m :: * -> *).
MonadWriter CoverageIndex m =>
CovLoc -> Bool -> CoverageMetadata -> m CoverageAnnotation
addBoolCaseToCoverageIndex CovLoc
src Bool
b CoverageMetadata
meta = do
let ann :: CoverageAnnotation
ann = CovLoc -> Bool -> CoverageAnnotation
CoverBool CovLoc
src Bool
b
CoverageIndex -> m ()
forall w (m :: * -> *). MonadWriter w m => w -> m ()
tell (CoverageIndex -> m ()) -> CoverageIndex -> m ()
forall a b. (a -> b) -> a -> b
$ Map CoverageAnnotation CoverageMetadata -> CoverageIndex
CoverageIndex (CoverageAnnotation
-> CoverageMetadata -> Map CoverageAnnotation CoverageMetadata
forall k a. k -> a -> Map k a
Map.singleton CoverageAnnotation
ann CoverageMetadata
meta)
CoverageAnnotation -> m CoverageAnnotation
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure CoverageAnnotation
ann
addCoverageMetadata :: CoverageAnnotation -> Metadata -> CoverageIndex -> CoverageIndex
addCoverageMetadata :: CoverageAnnotation -> Metadata -> CoverageIndex -> CoverageIndex
addCoverageMetadata CoverageAnnotation
ann Metadata
meta CoverageIndex
idx = CoverageIndex
idx
CoverageIndex -> (CoverageIndex -> CoverageIndex) -> CoverageIndex
forall a b. a -> (a -> b) -> b
& (Map CoverageAnnotation CoverageMetadata
-> Identity (Map CoverageAnnotation CoverageMetadata))
-> CoverageIndex -> Identity CoverageIndex
Iso' CoverageIndex (Map CoverageAnnotation CoverageMetadata)
coverageMetadata
((Map CoverageAnnotation CoverageMetadata
-> Identity (Map CoverageAnnotation CoverageMetadata))
-> CoverageIndex -> Identity CoverageIndex)
-> ((Set Metadata -> Identity (Set Metadata))
-> Map CoverageAnnotation CoverageMetadata
-> Identity (Map CoverageAnnotation CoverageMetadata))
-> (Set Metadata -> Identity (Set Metadata))
-> CoverageIndex
-> Identity CoverageIndex
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Index (Map CoverageAnnotation CoverageMetadata)
-> Lens'
(Map CoverageAnnotation CoverageMetadata)
(Maybe (IxValue (Map CoverageAnnotation CoverageMetadata)))
forall m. At m => Index m -> Lens' m (Maybe (IxValue m))
at Index (Map CoverageAnnotation CoverageMetadata)
CoverageAnnotation
ann
((Maybe CoverageMetadata -> Identity (Maybe CoverageMetadata))
-> Map CoverageAnnotation CoverageMetadata
-> Identity (Map CoverageAnnotation CoverageMetadata))
-> ((Set Metadata -> Identity (Set Metadata))
-> Maybe CoverageMetadata -> Identity (Maybe CoverageMetadata))
-> (Set Metadata -> Identity (Set Metadata))
-> Map CoverageAnnotation CoverageMetadata
-> Identity (Map CoverageAnnotation CoverageMetadata)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (CoverageMetadata -> Identity CoverageMetadata)
-> Maybe CoverageMetadata -> Identity (Maybe CoverageMetadata)
forall a b (p :: * -> * -> *) (f :: * -> *).
(Choice p, Applicative f) =>
p a (f b) -> p (Maybe a) (f (Maybe b))
_Just
((CoverageMetadata -> Identity CoverageMetadata)
-> Maybe CoverageMetadata -> Identity (Maybe CoverageMetadata))
-> ((Set Metadata -> Identity (Set Metadata))
-> CoverageMetadata -> Identity CoverageMetadata)
-> (Set Metadata -> Identity (Set Metadata))
-> Maybe CoverageMetadata
-> Identity (Maybe CoverageMetadata)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Set Metadata -> Identity (Set Metadata))
-> CoverageMetadata -> Identity CoverageMetadata
Iso' CoverageMetadata (Set Metadata)
metadataSet
((Set Metadata -> Identity (Set Metadata))
-> CoverageIndex -> Identity CoverageIndex)
-> (Set Metadata -> Set Metadata) -> CoverageIndex -> CoverageIndex
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ Metadata -> Set Metadata -> Set Metadata
forall a. Ord a => a -> Set a -> Set a
Set.insert Metadata
meta
newtype CoverageData = CoverageData { CoverageData -> Set CoverageAnnotation
_coveredAnnotations :: Set CoverageAnnotation }
deriving stock (Eq CoverageData
Eq CoverageData =>
(CoverageData -> CoverageData -> Ordering)
-> (CoverageData -> CoverageData -> Bool)
-> (CoverageData -> CoverageData -> Bool)
-> (CoverageData -> CoverageData -> Bool)
-> (CoverageData -> CoverageData -> Bool)
-> (CoverageData -> CoverageData -> CoverageData)
-> (CoverageData -> CoverageData -> CoverageData)
-> Ord CoverageData
CoverageData -> CoverageData -> Bool
CoverageData -> CoverageData -> Ordering
CoverageData -> CoverageData -> CoverageData
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: CoverageData -> CoverageData -> Ordering
compare :: CoverageData -> CoverageData -> Ordering
$c< :: CoverageData -> CoverageData -> Bool
< :: CoverageData -> CoverageData -> Bool
$c<= :: CoverageData -> CoverageData -> Bool
<= :: CoverageData -> CoverageData -> Bool
$c> :: CoverageData -> CoverageData -> Bool
> :: CoverageData -> CoverageData -> Bool
$c>= :: CoverageData -> CoverageData -> Bool
>= :: CoverageData -> CoverageData -> Bool
$cmax :: CoverageData -> CoverageData -> CoverageData
max :: CoverageData -> CoverageData -> CoverageData
$cmin :: CoverageData -> CoverageData -> CoverageData
min :: CoverageData -> CoverageData -> CoverageData
Ord, CoverageData -> CoverageData -> Bool
(CoverageData -> CoverageData -> Bool)
-> (CoverageData -> CoverageData -> Bool) -> Eq CoverageData
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CoverageData -> CoverageData -> Bool
== :: CoverageData -> CoverageData -> Bool
$c/= :: CoverageData -> CoverageData -> Bool
/= :: CoverageData -> CoverageData -> Bool
Eq, Int -> CoverageData -> ShowS
[CoverageData] -> ShowS
CoverageData -> String
(Int -> CoverageData -> ShowS)
-> (CoverageData -> String)
-> ([CoverageData] -> ShowS)
-> Show CoverageData
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CoverageData -> ShowS
showsPrec :: Int -> CoverageData -> ShowS
$cshow :: CoverageData -> String
show :: CoverageData -> String
$cshowList :: [CoverageData] -> ShowS
showList :: [CoverageData] -> ShowS
Show, (forall x. CoverageData -> Rep CoverageData x)
-> (forall x. Rep CoverageData x -> CoverageData)
-> Generic CoverageData
forall x. Rep CoverageData x -> CoverageData
forall x. CoverageData -> Rep CoverageData x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. CoverageData -> Rep CoverageData x
from :: forall x. CoverageData -> Rep CoverageData x
$cto :: forall x. Rep CoverageData x -> CoverageData
to :: forall x. Rep CoverageData x -> CoverageData
Generic)
deriving newtype (NonEmpty CoverageData -> CoverageData
CoverageData -> CoverageData -> CoverageData
(CoverageData -> CoverageData -> CoverageData)
-> (NonEmpty CoverageData -> CoverageData)
-> (forall b. Integral b => b -> CoverageData -> CoverageData)
-> Semigroup CoverageData
forall b. Integral b => b -> CoverageData -> CoverageData
forall a.
(a -> a -> a)
-> (NonEmpty a -> a)
-> (forall b. Integral b => b -> a -> a)
-> Semigroup a
$c<> :: CoverageData -> CoverageData -> CoverageData
<> :: CoverageData -> CoverageData -> CoverageData
$csconcat :: NonEmpty CoverageData -> CoverageData
sconcat :: NonEmpty CoverageData -> CoverageData
$cstimes :: forall b. Integral b => b -> CoverageData -> CoverageData
stimes :: forall b. Integral b => b -> CoverageData -> CoverageData
Semigroup, Semigroup CoverageData
CoverageData
Semigroup CoverageData =>
CoverageData
-> (CoverageData -> CoverageData -> CoverageData)
-> ([CoverageData] -> CoverageData)
-> Monoid CoverageData
[CoverageData] -> CoverageData
CoverageData -> CoverageData -> CoverageData
forall a.
Semigroup a =>
a -> (a -> a -> a) -> ([a] -> a) -> Monoid a
$cmempty :: CoverageData
mempty :: CoverageData
$cmappend :: CoverageData -> CoverageData -> CoverageData
mappend :: CoverageData -> CoverageData -> CoverageData
$cmconcat :: [CoverageData] -> CoverageData
mconcat :: [CoverageData] -> CoverageData
Monoid)
deriving anyclass (CoverageData -> ()
(CoverageData -> ()) -> NFData CoverageData
forall a. (a -> ()) -> NFData a
$crnf :: CoverageData -> ()
rnf :: CoverageData -> ()
NFData, [CoverageData] -> Encoding
[CoverageData] -> Value
CoverageData -> Bool
CoverageData -> Encoding
CoverageData -> Value
(CoverageData -> Value)
-> (CoverageData -> Encoding)
-> ([CoverageData] -> Value)
-> ([CoverageData] -> Encoding)
-> (CoverageData -> Bool)
-> ToJSON CoverageData
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: CoverageData -> Value
toJSON :: CoverageData -> Value
$ctoEncoding :: CoverageData -> Encoding
toEncoding :: CoverageData -> Encoding
$ctoJSONList :: [CoverageData] -> Value
toJSONList :: [CoverageData] -> Value
$ctoEncodingList :: [CoverageData] -> Encoding
toEncodingList :: [CoverageData] -> Encoding
$comitField :: CoverageData -> Bool
omitField :: CoverageData -> Bool
ToJSON, Maybe CoverageData
Value -> Parser [CoverageData]
Value -> Parser CoverageData
(Value -> Parser CoverageData)
-> (Value -> Parser [CoverageData])
-> Maybe CoverageData
-> FromJSON CoverageData
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser CoverageData
parseJSON :: Value -> Parser CoverageData
$cparseJSONList :: Value -> Parser [CoverageData]
parseJSONList :: Value -> Parser [CoverageData]
$comittedField :: Maybe CoverageData
omittedField :: Maybe CoverageData
FromJSON)
makeLenses ''CoverageData
data CoverageReport = CoverageReport { CoverageReport -> CoverageIndex
_coverageIndex :: CoverageIndex
, CoverageReport -> CoverageData
_coverageData :: CoverageData }
deriving stock (Eq CoverageReport
Eq CoverageReport =>
(CoverageReport -> CoverageReport -> Ordering)
-> (CoverageReport -> CoverageReport -> Bool)
-> (CoverageReport -> CoverageReport -> Bool)
-> (CoverageReport -> CoverageReport -> Bool)
-> (CoverageReport -> CoverageReport -> Bool)
-> (CoverageReport -> CoverageReport -> CoverageReport)
-> (CoverageReport -> CoverageReport -> CoverageReport)
-> Ord CoverageReport
CoverageReport -> CoverageReport -> Bool
CoverageReport -> CoverageReport -> Ordering
CoverageReport -> CoverageReport -> CoverageReport
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: CoverageReport -> CoverageReport -> Ordering
compare :: CoverageReport -> CoverageReport -> Ordering
$c< :: CoverageReport -> CoverageReport -> Bool
< :: CoverageReport -> CoverageReport -> Bool
$c<= :: CoverageReport -> CoverageReport -> Bool
<= :: CoverageReport -> CoverageReport -> Bool
$c> :: CoverageReport -> CoverageReport -> Bool
> :: CoverageReport -> CoverageReport -> Bool
$c>= :: CoverageReport -> CoverageReport -> Bool
>= :: CoverageReport -> CoverageReport -> Bool
$cmax :: CoverageReport -> CoverageReport -> CoverageReport
max :: CoverageReport -> CoverageReport -> CoverageReport
$cmin :: CoverageReport -> CoverageReport -> CoverageReport
min :: CoverageReport -> CoverageReport -> CoverageReport
Ord, CoverageReport -> CoverageReport -> Bool
(CoverageReport -> CoverageReport -> Bool)
-> (CoverageReport -> CoverageReport -> Bool) -> Eq CoverageReport
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CoverageReport -> CoverageReport -> Bool
== :: CoverageReport -> CoverageReport -> Bool
$c/= :: CoverageReport -> CoverageReport -> Bool
/= :: CoverageReport -> CoverageReport -> Bool
Eq, Int -> CoverageReport -> ShowS
[CoverageReport] -> ShowS
CoverageReport -> String
(Int -> CoverageReport -> ShowS)
-> (CoverageReport -> String)
-> ([CoverageReport] -> ShowS)
-> Show CoverageReport
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CoverageReport -> ShowS
showsPrec :: Int -> CoverageReport -> ShowS
$cshow :: CoverageReport -> String
show :: CoverageReport -> String
$cshowList :: [CoverageReport] -> ShowS
showList :: [CoverageReport] -> ShowS
Show, (forall x. CoverageReport -> Rep CoverageReport x)
-> (forall x. Rep CoverageReport x -> CoverageReport)
-> Generic CoverageReport
forall x. Rep CoverageReport x -> CoverageReport
forall x. CoverageReport -> Rep CoverageReport x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. CoverageReport -> Rep CoverageReport x
from :: forall x. CoverageReport -> Rep CoverageReport x
$cto :: forall x. Rep CoverageReport x -> CoverageReport
to :: forall x. Rep CoverageReport x -> CoverageReport
Generic)
deriving anyclass (CoverageReport -> ()
(CoverageReport -> ()) -> NFData CoverageReport
forall a. (a -> ()) -> NFData a
$crnf :: CoverageReport -> ()
rnf :: CoverageReport -> ()
NFData, [CoverageReport] -> Encoding
[CoverageReport] -> Value
CoverageReport -> Bool
CoverageReport -> Encoding
CoverageReport -> Value
(CoverageReport -> Value)
-> (CoverageReport -> Encoding)
-> ([CoverageReport] -> Value)
-> ([CoverageReport] -> Encoding)
-> (CoverageReport -> Bool)
-> ToJSON CoverageReport
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: CoverageReport -> Value
toJSON :: CoverageReport -> Value
$ctoEncoding :: CoverageReport -> Encoding
toEncoding :: CoverageReport -> Encoding
$ctoJSONList :: [CoverageReport] -> Value
toJSONList :: [CoverageReport] -> Value
$ctoEncodingList :: [CoverageReport] -> Encoding
toEncodingList :: [CoverageReport] -> Encoding
$comitField :: CoverageReport -> Bool
omitField :: CoverageReport -> Bool
ToJSON, Maybe CoverageReport
Value -> Parser [CoverageReport]
Value -> Parser CoverageReport
(Value -> Parser CoverageReport)
-> (Value -> Parser [CoverageReport])
-> Maybe CoverageReport
-> FromJSON CoverageReport
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser CoverageReport
parseJSON :: Value -> Parser CoverageReport
$cparseJSONList :: Value -> Parser [CoverageReport]
parseJSONList :: Value -> Parser [CoverageReport]
$comittedField :: Maybe CoverageReport
omittedField :: Maybe CoverageReport
FromJSON)
makeLenses ''CoverageReport
instance Semigroup CoverageReport where
CoverageReport CoverageIndex
i1 CoverageData
d1 <> :: CoverageReport -> CoverageReport -> CoverageReport
<> CoverageReport CoverageIndex
i2 CoverageData
d2 = CoverageIndex -> CoverageData -> CoverageReport
CoverageReport (CoverageIndex
i1 CoverageIndex -> CoverageIndex -> CoverageIndex
forall a. Semigroup a => a -> a -> a
<> CoverageIndex
i2) (CoverageData
d1 CoverageData -> CoverageData -> CoverageData
forall a. Semigroup a => a -> a -> a
<> CoverageData
d2)
instance Monoid CoverageReport where
mempty :: CoverageReport
mempty = CoverageIndex -> CoverageData -> CoverageReport
CoverageReport CoverageIndex
forall a. Monoid a => a
mempty CoverageData
forall a. Monoid a => a
mempty
mappend :: CoverageReport -> CoverageReport -> CoverageReport
mappend = CoverageReport -> CoverageReport -> CoverageReport
forall a. Semigroup a => a -> a -> a
(<>)
coverageDataFromLogMsg :: String -> CoverageData
coverageDataFromLogMsg :: String -> CoverageData
coverageDataFromLogMsg = (CoverageAnnotation -> CoverageData)
-> Maybe CoverageAnnotation -> CoverageData
forall m a. Monoid m => (a -> m) -> Maybe a -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap (Set CoverageAnnotation -> CoverageData
CoverageData (Set CoverageAnnotation -> CoverageData)
-> (CoverageAnnotation -> Set CoverageAnnotation)
-> CoverageAnnotation
-> CoverageData
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CoverageAnnotation -> Set CoverageAnnotation
forall a. a -> Set a
Set.singleton) (Maybe CoverageAnnotation -> CoverageData)
-> (String -> Maybe CoverageAnnotation) -> String -> CoverageData
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Maybe CoverageAnnotation
forall a. Read a => String -> Maybe a
readMaybe
instance Pretty CoverageReport where
pretty :: forall ann. CoverageReport -> Doc ann
pretty CoverageReport
report = [Doc ann] -> Doc ann
forall ann. [Doc ann] -> Doc ann
vsep ([Doc ann] -> Doc ann) -> [Doc ann] -> Doc ann
forall a b. (a -> b) -> a -> b
$
[Doc ann
"=========[COVERED]=========="] [Doc ann] -> [Doc ann] -> [Doc ann]
forall a. [a] -> [a] -> [a]
++
[ Int -> Doc ann -> Doc ann
forall ann. Int -> Doc ann -> Doc ann
nest Int
4 (Doc ann -> Doc ann) -> Doc ann -> Doc ann
forall a b. (a -> b) -> a -> b
$ [Doc ann] -> Doc ann
forall ann. [Doc ann] -> Doc ann
vsep (CoverageAnnotation -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. CoverageAnnotation -> Doc ann
pretty CoverageAnnotation
ann Doc ann -> [Doc ann] -> [Doc ann]
forall a. a -> [a] -> [a]
: ((Metadata -> Doc ann) -> [Metadata] -> [Doc ann]
forall a b. (a -> b) -> [a] -> [b]
map Metadata -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. Metadata -> Doc ann
pretty ([Metadata] -> [Doc ann])
-> (Maybe CoverageMetadata -> [Metadata])
-> Maybe CoverageMetadata
-> [Doc ann]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Set Metadata -> [Metadata]
forall a. Set a -> [a]
Set.toList (Set Metadata -> [Metadata])
-> (Maybe CoverageMetadata -> Set Metadata)
-> Maybe CoverageMetadata
-> [Metadata]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (CoverageMetadata -> Set Metadata)
-> Maybe CoverageMetadata -> Set Metadata
forall m a. Monoid m => (a -> m) -> Maybe a -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap CoverageMetadata -> Set Metadata
_metadataSet (Maybe CoverageMetadata -> [Doc ann])
-> Maybe CoverageMetadata -> [Doc ann]
forall a b. (a -> b) -> a -> b
$ CoverageAnnotation -> Maybe CoverageMetadata
metadata CoverageAnnotation
ann))
| CoverageAnnotation
ann <- Set CoverageAnnotation -> [CoverageAnnotation]
forall a. Set a -> [a]
Set.toList (Set CoverageAnnotation -> [CoverageAnnotation])
-> Set CoverageAnnotation -> [CoverageAnnotation]
forall a b. (a -> b) -> a -> b
$ Set CoverageAnnotation
allAnns Set CoverageAnnotation
-> Set CoverageAnnotation -> Set CoverageAnnotation
forall a. Ord a => Set a -> Set a -> Set a
`Set.intersection` Set CoverageAnnotation
coveredAnns ] [Doc ann] -> [Doc ann] -> [Doc ann]
forall a. [a] -> [a] -> [a]
++
[Doc ann
"========[UNCOVERED]========="] [Doc ann] -> [Doc ann] -> [Doc ann]
forall a. [a] -> [a] -> [a]
++
((CoverageAnnotation -> Doc ann)
-> [CoverageAnnotation] -> [Doc ann]
forall a b. (a -> b) -> [a] -> [b]
map CoverageAnnotation -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. CoverageAnnotation -> Doc ann
pretty ([CoverageAnnotation] -> [Doc ann])
-> (Set CoverageAnnotation -> [CoverageAnnotation])
-> Set CoverageAnnotation
-> [Doc ann]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Set CoverageAnnotation -> [CoverageAnnotation]
forall a. Set a -> [a]
Set.toList (Set CoverageAnnotation -> [Doc ann])
-> Set CoverageAnnotation -> [Doc ann]
forall a b. (a -> b) -> a -> b
$ Set CoverageAnnotation
uncoveredAnns) [Doc ann] -> [Doc ann] -> [Doc ann]
forall a. [a] -> [a] -> [a]
++
[Doc ann
"=========[IGNORED]=========="] [Doc ann] -> [Doc ann] -> [Doc ann]
forall a. [a] -> [a] -> [a]
++
((CoverageAnnotation -> Doc ann)
-> [CoverageAnnotation] -> [Doc ann]
forall a b. (a -> b) -> [a] -> [b]
map CoverageAnnotation -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. CoverageAnnotation -> Doc ann
pretty ([CoverageAnnotation] -> [Doc ann])
-> (Set CoverageAnnotation -> [CoverageAnnotation])
-> Set CoverageAnnotation
-> [Doc ann]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Set CoverageAnnotation -> [CoverageAnnotation]
forall a. Set a -> [a]
Set.toList (Set CoverageAnnotation -> [Doc ann])
-> Set CoverageAnnotation -> [Doc ann]
forall a b. (a -> b) -> a -> b
$ Set CoverageAnnotation
ignoredAnns Set CoverageAnnotation
-> Set CoverageAnnotation -> Set CoverageAnnotation
forall a. Ord a => Set a -> Set a -> Set a
Set.\\ Set CoverageAnnotation
coveredAnns)
where
allAnns :: Set CoverageAnnotation
allAnns = CoverageReport
report CoverageReport
-> Getting
(Set CoverageAnnotation) CoverageReport (Set CoverageAnnotation)
-> Set CoverageAnnotation
forall s a. s -> Getting a s a -> a
^. (CoverageIndex -> Const (Set CoverageAnnotation) CoverageIndex)
-> CoverageReport -> Const (Set CoverageAnnotation) CoverageReport
Lens' CoverageReport CoverageIndex
coverageIndex ((CoverageIndex -> Const (Set CoverageAnnotation) CoverageIndex)
-> CoverageReport -> Const (Set CoverageAnnotation) CoverageReport)
-> ((Set CoverageAnnotation
-> Const (Set CoverageAnnotation) (Set CoverageAnnotation))
-> CoverageIndex -> Const (Set CoverageAnnotation) CoverageIndex)
-> Getting
(Set CoverageAnnotation) CoverageReport (Set CoverageAnnotation)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Set CoverageAnnotation
-> Const (Set CoverageAnnotation) (Set CoverageAnnotation))
-> CoverageIndex -> Const (Set CoverageAnnotation) CoverageIndex
Getter CoverageIndex (Set CoverageAnnotation)
coverageAnnotations
coveredAnns :: Set CoverageAnnotation
coveredAnns = CoverageReport
report CoverageReport
-> Getting
(Set CoverageAnnotation) CoverageReport (Set CoverageAnnotation)
-> Set CoverageAnnotation
forall s a. s -> Getting a s a -> a
^. (CoverageData -> Const (Set CoverageAnnotation) CoverageData)
-> CoverageReport -> Const (Set CoverageAnnotation) CoverageReport
Lens' CoverageReport CoverageData
coverageData ((CoverageData -> Const (Set CoverageAnnotation) CoverageData)
-> CoverageReport -> Const (Set CoverageAnnotation) CoverageReport)
-> ((Set CoverageAnnotation
-> Const (Set CoverageAnnotation) (Set CoverageAnnotation))
-> CoverageData -> Const (Set CoverageAnnotation) CoverageData)
-> Getting
(Set CoverageAnnotation) CoverageReport (Set CoverageAnnotation)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Set CoverageAnnotation
-> Const (Set CoverageAnnotation) (Set CoverageAnnotation))
-> CoverageData -> Const (Set CoverageAnnotation) CoverageData
Iso' CoverageData (Set CoverageAnnotation)
coveredAnnotations
ignoredAnns :: Set CoverageAnnotation
ignoredAnns = CoverageReport
report CoverageReport
-> Getting
(Set CoverageAnnotation) CoverageReport (Set CoverageAnnotation)
-> Set CoverageAnnotation
forall s a. s -> Getting a s a -> a
^. (CoverageIndex -> Const (Set CoverageAnnotation) CoverageIndex)
-> CoverageReport -> Const (Set CoverageAnnotation) CoverageReport
Lens' CoverageReport CoverageIndex
coverageIndex ((CoverageIndex -> Const (Set CoverageAnnotation) CoverageIndex)
-> CoverageReport -> Const (Set CoverageAnnotation) CoverageReport)
-> ((Set CoverageAnnotation
-> Const (Set CoverageAnnotation) (Set CoverageAnnotation))
-> CoverageIndex -> Const (Set CoverageAnnotation) CoverageIndex)
-> Getting
(Set CoverageAnnotation) CoverageReport (Set CoverageAnnotation)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Set CoverageAnnotation
-> Const (Set CoverageAnnotation) (Set CoverageAnnotation))
-> CoverageIndex -> Const (Set CoverageAnnotation) CoverageIndex
Getter CoverageIndex (Set CoverageAnnotation)
ignoredAnnotations
uncoveredAnns :: Set CoverageAnnotation
uncoveredAnns = Set CoverageAnnotation
allAnns Set CoverageAnnotation
-> Set CoverageAnnotation -> Set CoverageAnnotation
forall a. Ord a => Set a -> Set a -> Set a
Set.\\ (Set CoverageAnnotation
coveredAnns Set CoverageAnnotation
-> Set CoverageAnnotation -> Set CoverageAnnotation
forall a. Semigroup a => a -> a -> a
<> Set CoverageAnnotation
ignoredAnns)
metadata :: CoverageAnnotation -> Maybe CoverageMetadata
metadata CoverageAnnotation
ann = CoverageAnnotation
-> Map CoverageAnnotation CoverageMetadata
-> Maybe CoverageMetadata
forall k a. Ord k => k -> Map k a -> Maybe a
Map.lookup CoverageAnnotation
ann (CoverageReport
report CoverageReport
-> Getting
(Map CoverageAnnotation CoverageMetadata)
CoverageReport
(Map CoverageAnnotation CoverageMetadata)
-> Map CoverageAnnotation CoverageMetadata
forall s a. s -> Getting a s a -> a
^. (CoverageIndex
-> Const (Map CoverageAnnotation CoverageMetadata) CoverageIndex)
-> CoverageReport
-> Const (Map CoverageAnnotation CoverageMetadata) CoverageReport
Lens' CoverageReport CoverageIndex
coverageIndex ((CoverageIndex
-> Const (Map CoverageAnnotation CoverageMetadata) CoverageIndex)
-> CoverageReport
-> Const (Map CoverageAnnotation CoverageMetadata) CoverageReport)
-> ((Map CoverageAnnotation CoverageMetadata
-> Const
(Map CoverageAnnotation CoverageMetadata)
(Map CoverageAnnotation CoverageMetadata))
-> CoverageIndex
-> Const (Map CoverageAnnotation CoverageMetadata) CoverageIndex)
-> Getting
(Map CoverageAnnotation CoverageMetadata)
CoverageReport
(Map CoverageAnnotation CoverageMetadata)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Map CoverageAnnotation CoverageMetadata
-> Const
(Map CoverageAnnotation CoverageMetadata)
(Map CoverageAnnotation CoverageMetadata))
-> CoverageIndex
-> Const (Map CoverageAnnotation CoverageMetadata) CoverageIndex
Iso' CoverageIndex (Map CoverageAnnotation CoverageMetadata)
coverageMetadata)