bdccf191a1e4775af6086f252c199d9c7bc99fab

5 import qualified Data

.Vector

as DV

6 import qualified Data

.Vector

.IVector

as DVI

7 import qualified Data

.Vector

.Unboxed

as DVU

8 import qualified Data

.Vector

.Unboxed

.Unbox

as DVUU

9 import qualified Data

.Vector

.Fusion

.Stream

as S

12 instance Show a

=> Show (S

.Stream a

) where
13 show s

= "Data.Vector.Fusion.Stream.fromList " ++ show (S

.toList s

)
16 instance Arbitrary a

=> Arbitrary

(DV

.Vector a

) where
17 arbitrary

= fmap DV

.fromList arbitrary

18 coarbitrary

= coarbitrary

. DV

.toList

20 instance (Arbitrary a

, DVUU

.Unbox a

) => Arbitrary

(DVU

.Vector a

) where
21 arbitrary

= fmap DVU

.fromList arbitrary

22 coarbitrary

= coarbitrary

. DVU

.toList

24 instance Arbitrary a

=> Arbitrary

(S

.Stream a

) where
25 arbitrary

= fmap S

.fromList arbitrary

26 coarbitrary

= coarbitrary

. S

.toList

29 class Model a b | a

-> b

where
30 -- | Convert a concrete value into an abstract model
33 -- The meat of the models
34 instance Model

(DV

.Vector a

) [a

] where model

= DV

.toList

35 instance DVUU

.Unbox a

=> Model

(DVU

.Vector a

) [a

] where model

= DVU

.toList

38 instance Model

Bool Bool where model

= id
39 instance Model

Int Int where model

= id
40 instance Model

Float Float where model

= id
41 instance Model

Double Double where model

= id
42 instance Model

Ordering Ordering where model

= id
45 -- All of these need UndecidableInstances although they are actually well founded. Oh well.
46 instance Model a b

=> Model

(Maybe a

) (Maybe b

) where model

= fmap model

47 instance (Model a a

', Model b b

') => Model

(a

, b

) (a

', b

') where model

(a

, b

) = (model a

, model b

)
48 instance (Model a a

', Model b b

', Model c c

') => Model

(a

, b

, c

) (a

', b

', c

') where model

(a

, b

, c

) = (model a

, model b

, model c

)
49 instance (Model c a

, Model b d

) => Model

(a

-> b

) (c

-> d

) where model f

= model

. f

. model

52 eq0 f g

= model f

== g

53 eq1 f g

= \a -> model

(f a

) == g

(model a

)
54 eq2 f g

= \a b

-> model

(f a b

) == g

(model a

) (model b

)
55 eq3 f g

= \a b c

-> model

(f a b c

) == g

(model a

) (model b

) (model c

)
56 eq4 f g

= \a b c d

-> model

(f a b c d

) == g

(model a

) (model b

) (model c

) (model d

)
58 eqNotNull1 f g

= \a -> (not (DVI

.null a

)) ==> eq1 f g a

59 eqNotNull2 f g

= \a b

-> (not (DVI

.null b

)) ==> eq2 f g a b

60 eqNotNull3 f g

= \a b c

-> (not (DVI

.null c

)) ==> eq3 f g a b c

61 eqNotNull4 f g

= \a b c d

-> (not (DVI

.null d

)) ==> eq4 f g a b c d