Movatterモバイル変換
[0]ホーム
modulePostgreSQLBinary.ArraywhereimportPostgreSQLBinary.Preludehiding(Data)typeData=([Dimension],[Value],Bool,Word32)typeDimension=(Word32,Word32)typeValue=MaybeByteStringasSingleton::Data->MaybeValueasSingleton(dimensions,elements,nulls,oid)=ifnulldimensionsthencaseelementsof[x]->returnxl->$bug$"Unexpected amount of elements: "<>showlelsemzerofromListUnsafe::[Data]->DatafromListUnsafelist=caselistof(dimensions,values,nulls,oid):tail->((fromIntegral$lengthlist,1):dimensions,values<>foldMapvaluesOftail,nulls,oid)wherevaluesOf(_,x,_,_)=x_->error"Empty list"fromSingleton::Value->Bool->Word32->DatafromSingletonvaluenullableoid=([],[value],nullable,oid)elements::Data->[Data]elements(dimensions,values,nulls,oid)=dosubvalues<-slicevaluesreturn(subdimensions,subvalues,nulls,oid)where((width,lowerBound),subdimensions)=casedimensionsofh:t->(h,t)_->((0,1),[])chunkSize=ifnullsubdimensionsthen1elseproduct$mapdimensionWidth$subdimensionswheredimensionWidth(x,_)=fromIntegralxslice=foldr(\fgl->caseflof(a,b)->a:gb)(constmzero)$replicate(fromIntegralwidth)(splitAtchunkSize)
[8]ページ先頭