-- | Generic array class.-- This is used as a compatability layer during testing and debugging.moduleData.Array.Parallel.Array(Array(..),fromList,toList,toVectors1,toVectors2,toVectors3,fromVectors1,fromVectors2,fromVectors3)whereimportControl.MonadimportData.Vector(Vector)importqualifiedData.VectorasVimportqualifiedPreludeasPimportPreludehiding(length)classArrayaewhere-- | Check whether an array has a valid internal representation.valid::ae->Bool-- | Yield an array with just a single element.singleton::e->ae-- | Append two arrays.append::ae->ae->ae-- | Yield the length of an array.length::ae->Int-- | Retrieve the element at the given index. index::ae->Int->e-- | Convert an array to a vector.toVector::ae->Vectore-- | Convert a vector to an array.fromVector::Vectore->aeinstanceArray[]ewherevalid=constTruesingletonx=[x]length=P.lengthindex=(P.!!)append=(P.++)toVector=V.fromListfromVector=V.toListinstanceArrayVectorewherevalid=constTruesingleton=V.singletonlength=V.lengthindex=(V.!)append=(V.++)toVector=idfromVector=id-- | Convert a list to an array.fromList::Arrayae=>[e]->aefromList=fromVector.V.fromList-- | Convert an array to a list.toList::Arrayae=>ae->[e]toList=V.toList.toVector-- | Convert the outer level of an array to vectors.toVectors1::Arrayae=>ae->VectoretoVectors1arr=toVectorarr-- | Convert the outer two levels of an array to vectors.toVectors2::(Arraya1(a2e),Arraya2e)=>a1(a2e)->Vector(Vectore)toVectors2=V.maptoVector.toVector-- | Convert the outer three levels of an array to vectors.toVectors3::(Arraya1(a2(a3e)),Arraya2(a3e),Arraya3e)=>a1(a2(a3e))->Vector(Vector(Vectore))toVectors3=V.map(V.maptoVector).V.maptoVector.toVector-- | Convert some vectors to an array.fromVectors1::Arrayae=>Vectore->aefromVectors1vec=fromVectorvec-- | Convert some vectors to a nested arrayfromVectors2::(Arraya1(a2e),Arraya2e)=>Vector(Vectore)->a1(a2e)fromVectors2=fromVector.V.mapfromVector-- | Convert some vectors to a triply nested arrayfromVectors3::(Arraya1(a2(a3e)),Arraya2(a3e),Arraya3e)=>Vector(Vector(Vectore))->a1(a2(a3e))fromVectors3=fromVector.V.mapfromVector.V.map(V.mapfromVector)