moduleAlgebra.Enumerable(Enumerable(..),universeBounded,Enumerated(..))where-- | Finitely enumerable thingsclassEnumerableawhereuniverse::[a]universeBounded::(Enuma,Boundeda)=>[a]universeBounded=enumFromTominBoundmaxBound-- | Wrapper used to mark where we expect to use the fact that something is EnumerablenewtypeEnumerateda=Enumerated{unEnumerated::a}deriving(Eq,Ord)instanceEnumerablea=>Enumerable(Enumerateda)whereuniverse=mapEnumerateduniverse-- TODO: add to this rather sorry little set of instances. Can we exploit commonality with lazy-smallcheck?instanceEnumerableBoolwhereuniverse=universeBoundedinstanceEnumerableIntwhereuniverse=universeBoundedinstanceEnumerablea=>Enumerable(Maybea)whereuniverse=Nothing:mapJustuniverseinstance(Enumerablea,Enumerableb)=>Enumerable(Eitherab)whereuniverse=mapLeftuniverse++mapRightuniverseinstanceEnumerable()whereuniverse=[()]instance(Enumerablea,Enumerableb)=>Enumerable(a,b)whereuniverse=[(a,b)|a<-universe,b<-universe]