Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module contains the container algebras
- data Box v = Box {}
- invar_Box_ordered :: (Lattice v, HasScalar v) => Box v -> Logic v
- newtype Jaccard a = Jaccard a
- newtype Hamming a = Hamming a
- newtype Levenshtein a = Levenshtein a
- dist :: Eq a => [a] -> [a] -> Int
- newtype Uncompensated s = Uncompensated s
- newtype Lexical a = Lexical {
- unLexical :: a
- newtype ComponentWise a = ComponentWise {
- unComponentWise :: a
- class (Boolean (Logic a), Logic (Elem a) ~ Logic a) => SimpleContainerLogic a
Documentation
A Box
is a generalization of an interval from the real numbers into an arbitrary lattice.
Boxes are closed in the sense that the end points of the boxes are also contained within the box.
See wikipedia for more details.
Read v => Read (Box v) Source | |
Show v => Show (Box v) Source | |
(Lattice v, Arbitrary v) => Arbitrary (Box v) Source | |
IsMutable (Box v) Source | |
(Lattice v, HasScalar v) => Container (Box v) Source | |
(Lattice v, HasScalar v) => Constructible (Box v) Source | |
(Lattice v, HasScalar v) => Semigroup (Box v) Source | |
(Eq v, HasScalar v) => Eq_ (Box v) Source | |
data Mutable m (Box v0) = Mutable_AppT__ConT_SubHask_Algebra_Container_Box___VarT_v_1628020028_ (PrimRef m (Box v)) Source | |
type Elem (Box v) = v Source | |
type Scalar (Box v) = Scalar v Source | |
type Logic (Box v) = Logic v Source | |
type SetElem (Box v) v' = Box v' Source |
The Jaccard distance.
See wikipedia for more detail.
Jaccard a |
The Hamming distance.
See wikipedia for more detail.
Hamming a |
newtype Levenshtein a Source
The Levenshtein distance is a type of edit distance, but it is often referred to as THE edit distance.
FIXME: The implementation could be made faster in a number of ways; for example, the Hamming distance is a lower bound on the Levenshtein distance
See wikipedia for more detail.
dist :: Eq a => [a] -> [a] -> Int Source
this function stolen from https://www.haskell.org/haskellwiki/Edit_distance
newtype Uncompensated s Source
Compensated sums are more accurate for floating point math
FIXME: There are many different types of compensated sums, they should be implemented too.
FIXME: Is this the best representation for compensated sums? The advantage is that we can make any algorithm work in a compensated or uncompensated manner by just changing the types. This is closely related to the measure theory containers work.
See, e.g. kahan summation for more detail.
Lexical ordering of foldable types.
NOTE: The default ordering for containers is the partial ordering by inclusion.
In most cases this makes more sense intuitively.
But this is NOT the ordering in the Prelude, because the Prelude does not have partial orders.
Therefore, in the prelude, @"abc" < "def"
@, but for us, "abc" and "def" are incomparable PNA.
The Lexical newtype gives us the total ordering provided by the Prelude.
FIXME: there are more container orderings that probably deserve implementation
newtype ComponentWise a Source