ms - metric spaces
A metric space is a set together with some notion of distance function which obeys four laws. See the haddock for more information.
We implement these not using a typeclass, but using a simple datatype. This avoids needing to create newtypes for every metric implementation over a given type, meaning that we gain more code re-use and an easier-to-use API.
WARNING: The triangle-inequality law does not necessarily hold in the
Floating a => a, which we use. This is because
Float both don't have arbitrary precision. However, some of our metrics, such
as that of
euclidean distance, require the use of the
sqrt function, which
dist levenshtein "foo" "bar" -- => 3.0 dist euclidean (V.fromList [3,2]) (V.fromList [2,3]) -- => 1.4142135623730951