You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All API of Statistics.Sample works only with vectors. It would be handy to add functions for working with containers implementing Foldable as well.
One downside is duplication of the API. It will only become worse if such duplication is extended to other modules. It would be nice to avoid such dulication but I don't know any way to generalize both vector and Foldable API
The text was updated successfully, but these errors were encountered:
Just curious, vectors already have a foldable instance, so couldn't the entire library be generalized except for functions (I'm not sure which) which use very specific, non-generalizable techniques?
Only boxed ones do. Problem is Foldable insists that we should be able to work with containers containing any data type. Here is fold from Foldable: foldl :: (b -> a -> b) -> b -> t a -> b and here is one from unboxed vectors: foldl :: Unbox a => (b -> a -> b) -> b -> Vector a -> b. Here we have constaint on element of vector and it precludes as from defining Foldable instance.
In order to do anything interesting with vectors (except boxed ones) we generally we need to constrain their elements. In general haskell doesn't play very well with polymorphic unboxed values
All API of
Statistics.Sample
works only with vectors. It would be handy to add functions for working with containers implementingFoldable
as well.One downside is duplication of the API. It will only become worse if such duplication is extended to other modules. It would be nice to avoid such dulication but I don't know any way to generalize both vector and Foldable API
The text was updated successfully, but these errors were encountered: