{-# OPTIONS_GHC -Wno-orphans #-} module Phylomemy.IndexationSpec where import Data.Eq (Eq) import Data.Function ((.)) import Data.Functor ((<$>)) import Data.GenValidity import Data.GenValidity.Map () import Data.GenValidity.Sequence () import Data.GenValidity.Set () import Data.GenValidity.Text () import Data.GenValidity.Time () import Data.Int (Int) import Data.Ord (Ord) import Data.Sequence qualified as Seq import Data.Text.Short (ShortText) import Data.Text.Short qualified as ShortText import Data.Time (UTCTime) import Data.Validity.Map () import Data.Validity.Set () import Data.Validity.Text () import GHC.Generics (Generic) import Test.Syd import Test.Syd.Validity import Text.Show (Show (..)) import Prelude (Num) import Phylomemy import Clustering.FrequentItemSet.BruteForce qualified as Clustering instance Validity ShortText where validate = trivialValidation instance GenValid ShortText where genValid = ShortText.fromText <$> genValid shrinkValid = (ShortText.fromText <$>) . shrinkValid . ShortText.toText instance GenValid Ngram instance GenValid Root instance (Validity pos, GenValid pos) => GenValid (Document pos) instance GenValid CoOccurences where genValid = genValidStructurallyWithoutExtraChecking shrinkValid = shrinkValidStructurallyWithoutExtraFiltering instance (Ord item, Validity item, Validity a, GenValid item, GenValid a) => GenValid (Clustering.Transaction item a) instance (Ord pos, Validity pos, GenValid pos) => GenValid (Range pos) newtype Pos = Pos Int deriving (Eq, Ord, Show, Num, Generic) instance ShowHuman Pos where showHuman (Pos x) = show x instance Validity Pos instance GenValid Pos type Rang = Range Pos spec :: Spec spec = do genValidSpec @(Document UTCTime) monoidSpec @CoOccurences genValidSpec @Cluster genValidSpec @(Clustering.Transaction Root (Document ())) genValidSpec @(Rang :-> Clustering.Transaction Root (Document ())) genValidSpec @(Rang :-> Cluster :-> Seq.Seq (Clustering.Transaction Root (Document Pos)))