Purpose Data.Vector.Mixed

The Edward Kmett hybrid-vectors library has two main modules: Data.Vector.Hybrid and Data.Vector.Mixed . There was a large article written based on the first. The latter is mentioned in passing, but he has no explanation. I am trying to figure out which use case. I have noticed two things so far:

  • There is a Mixed class with Typeable restrictions. I don’t understand the explanation in haddock, but it seems that Typeable should be necessary to restore type information or to transfer safely at some point.
  • The Vector data type is parameterized only for the base MVector . This differs from the Hybrid module, where it was parameterized over two types of vectors plus a tuple.

I would appreciate any helpful ideas or (even better) small use cases. Thanks.

+6
source share
1 answer

In my understanding, the Mixed typesclass class will allow you to use type safety functions for analysis, merging and bending through a vector, rather than a parallel process, where each vector is analyzed simultaneously, declaring M.Vector gv M.Vector hm to find a single-point point inside these vectors and then using for MVector do |Stream.length gv && Stream hm find the singleton in each layer using this key key :: mergeStreamwith kd -> Stream ki -> Stream di instance Singleton key where key = Vector.singleton[ v->(v-> MVector vm) -> MVector m] do transversewithkey gv => key.foldlwithkey gh

+1
source

Source: https://habr.com/ru/post/985523/


All Articles