{-# OPTIONS_HADDOCK hide #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
module EventData.Context.Arbitrary() where
import Test.QuickCheck ( Arbitrary(arbitrary), elements, sublistOf )
import Data.Function ( (.) )
import Data.Functor ( Functor(fmap) )
import Data.List ( map )
import Data.Maybe ( Maybe(Nothing) )
import Data.Set ( fromList )
import EventData.Context ( Concept
, Concepts
, Context
, context
, toConcepts
, packConcepts
, packConcept)
import EventData.Context.Domain ( Domain(UnimplementedDomain) )
conceptChoices :: [Concept]
conceptChoices :: [Concept]
conceptChoices = (Text -> Concept) -> [Text] -> [Concept]
forall a b. (a -> b) -> [a] -> [b]
map Text -> Concept
packConcept [Text
"A", Text
"B", Text
"C", Text
"D", Text
"E", Text
"F", Text
"G", Text
"H", Text
"I", Text
"J"]
instance Arbitrary Concept where
arbitrary :: Gen Concept
arbitrary = [Concept] -> Gen Concept
forall a. [a] -> Gen a
elements [Concept]
conceptChoices
instance Arbitrary Context where
arbitrary :: Gen Context
arbitrary = ([Concept] -> Context) -> Gen [Concept] -> Gen Context
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Domain -> Concepts -> Context
context (() -> Domain
UnimplementedDomain ()) (Concepts -> Context)
-> ([Concept] -> Concepts) -> [Concept] -> Context
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Set Concept -> Concepts
toConcepts (Set Concept -> Concepts)
-> ([Concept] -> Set Concept) -> [Concept] -> Concepts
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Concept] -> Set Concept
forall a. Ord a => [a] -> Set a
fromList))
([Concept] -> Gen [Concept]
forall a. [a] -> Gen [a]
sublistOf [Concept]
conceptChoices)