subhask-0.1.1.0: Type safe interface for programming in subcategories of Hask

Safe HaskellNone
LanguageHaskell2010

SubHask.Algebra

Contents

Description

This module defines the algebraic type-classes used in subhask. The class hierarchies are significantly more general than those in the standard Prelude.

Synopsis

Comparisons

type family Logic a :: * Source

Every type has an associated logic. Most types use classical logic, which corresponds to the Bool type. But types can use any logical system they want. Functions, for example, use an infinite logic. You probably want your logic to be an instance of Boolean, but this is not required.

See wikipedia's articles on algebraic logic, and infinitary logic for more details.

Instances

type Logic Bool = Bool Source 
type Logic Char = Bool Source 
type Logic Double = Bool Source 
type Logic Float = Bool Source 
type Logic Int = Bool Source 
type Logic Integer = Bool Source 
type Logic Ordering = Bool Source 
type Logic Rational = Bool Source 
type Logic TypeRep = Bool Source 
type Logic Type = Bool Source 
type Logic Dec = Bool Source 
type Logic Name = Bool Source 
type Logic () = () Source 
type Logic POrdering = Bool Source 
type Logic K3 = Bool Source 
type Logic H3 = Bool Source 
type Logic [a] = Logic a Source 
type Logic (Maybe a) = Logic a Source 
type Logic (Maybe' a) = Logic a Source 
type Logic (WithPreludeOrd a0) = Logic a0 Source 
type Logic (WithPreludeOrd a0) = Logic a0 Source 
type Logic (WithPreludeOrd a0) = Logic a0 Source 
type Logic (WithPreludeOrd a0) = Logic a0 Source 
type Logic (WithPreludeOrd a0) = Logic a0 Source 
type Logic (WithPreludeOrd a0) = Logic a0 Source 
type Logic (WithPreludeOrd a0) = Logic a0 Source 
type Logic (WithPreludeOrd a0) = Logic a0 Source 
type Logic (WithPreludeOrd a0) = Logic a0 Source 
type Logic (WithPreludeOrd a0) = Logic a0 Source 
type Logic (WithPreludeOrd a0) = Logic a0 Source 
type Logic (WithPreludeOrd a0) = Logic a0 Source 
type Logic (WithPreludeOrd a0) = Logic a0 Source 
type Logic (WithPreludeOrd a0) = Logic a0 Source 
type Logic (WithPreludeOrd a0) = Logic a0 Source 
type Logic (WithPreludeOrd a0) = Logic a0 Source 
type Logic (WithPreludeOrd a0) = Logic a0 Source 
type Logic (WithPreludeOrd a0) = Logic a0 Source 
type Logic (WithPreludeOrd a0) = Logic a0 Source 
type Logic (WithPreludeOrd a0) = Logic a0 Source 
type Logic (WithPreludeOrd a0) = Logic a0 Source 
type Logic (WithPreludeOrd a0) = Logic a0 Source 
type Logic (WithPreludeOrd a0) = Logic a0 Source 
type Logic (NonNegative t0) = Logic t0 Source 
type Logic (NonNegative t0) = Logic t0 Source 
type Logic (NonNegative t0) = Logic t0 Source 
type Logic (NonNegative t0) = Logic t0 Source 
type Logic (NonNegative t0) = Logic t0 Source 
type Logic (NonNegative t0) = Logic t0 Source 
type Logic (NonNegative t0) = Logic t0 Source 
type Logic (NonNegative t0) = Logic t0 Source 
type Logic (NonNegative t0) = Logic t0 Source 
type Logic (NonNegative t0) = Logic t0 Source 
type Logic (NonNegative t0) = Logic t0 Source 
type Logic (NonNegative t0) = Logic t0 Source 
type Logic (NonNegative t0) = Logic t0 Source 
type Logic (NonNegative t0) = Logic t0 Source 
type Logic (NonNegative t0) = Logic t0 Source 
type Logic (NonNegative t0) = Logic t0 Source 
type Logic (NonNegative t0) = Logic t0 Source 
type Logic (NonNegative t0) = Logic t0 Source 
type Logic (NonNegative t0) = Logic t0 Source 
type Logic (NonNegative t0) = Logic t0 Source 
type Logic (NonNegative t0) = Logic t0 Source 
type Logic (VedicSquare n0) = Logic (Z n0) Source 
type Logic (VedicSquare n0) = Logic (Z n0) Source 
type Logic (VedicSquare n0) = Logic (Z n0) Source 
type Logic (VedicSquare n0) = Logic (Z n0) Source 
type Logic (VedicSquare n0) = Logic (Z n0) Source 
type Logic (Ball v) = Logic v Source 
type Logic (Componentwise v) = Logic v Source 
type Logic (ZIndex a0) = Logic (Z (Order a0)) Source 
type Logic (ZIndex a0) = Logic (Z (Order a0)) Source 
type Logic (ZIndex a0) = Logic (Z (Order a0)) Source 
type Logic (ZIndex a0) = Logic (Z (Order a0)) Source 
type Logic (ZIndex a0) = Logic (Z (Order a0)) Source 
type Logic (ZIndex a0) = Logic (Z (Order a0)) Source 
type Logic (ZIndex a0) = Logic (Z (Order a0)) Source 
type Logic (BArray e) = Logic e Source 
type Logic (UArray e) = Logic e Source 
type Logic (Box v) = Logic v Source 
type Logic (Jaccard a0) = Logic a0 Source 
type Logic (Jaccard a0) = Logic a0 Source 
type Logic (Jaccard a0) = Logic a0 Source 
type Logic (Jaccard a0) = Logic a0 Source 
type Logic (Jaccard a0) = Logic a0 Source 
type Logic (Jaccard a0) = Logic a0 Source 
type Logic (Jaccard a0) = Logic a0 Source 
type Logic (Jaccard a0) = Logic a0 Source 
type Logic (Jaccard a0) = Logic a0 Source 
type Logic (Jaccard a0) = Logic a0 Source 
type Logic (Jaccard a0) = Logic a0 Source 
type Logic (Jaccard a0) = Logic a0 Source 
type Logic (Jaccard a0) = Logic a0 Source 
type Logic (Jaccard a0) = Logic a0 Source 
type Logic (Jaccard a0) = Logic a0 Source 
type Logic (Jaccard a0) = Logic a0 Source 
type Logic (Jaccard a0) = Logic a0 Source 
type Logic (Jaccard a0) = Logic a0 Source 
type Logic (Jaccard a0) = Logic a0 Source 
type Logic (Jaccard a0) = Logic a0 Source 
type Logic (Jaccard a0) = Logic a0 Source 
type Logic (Jaccard a0) = Logic a0 Source 
type Logic (Jaccard a0) = Logic a0 Source 
type Logic (Jaccard a0) = Logic a0 Source 
type Logic (Hamming a0) = Logic a0 Source 
type Logic (Hamming a0) = Logic a0 Source 
type Logic (Hamming a0) = Logic a0 Source 
type Logic (Hamming a0) = Logic a0 Source 
type Logic (Hamming a0) = Logic a0 Source 
type Logic (Hamming a0) = Logic a0 Source 
type Logic (Hamming a0) = Logic a0 Source 
type Logic (Hamming a0) = Logic a0 Source 
type Logic (Hamming a0) = Logic a0 Source 
type Logic (Hamming a0) = Logic a0 Source 
type Logic (Hamming a0) = Logic a0 Source 
type Logic (Hamming a0) = Logic a0 Source 
type Logic (Hamming a0) = Logic a0 Source 
type Logic (Hamming a0) = Logic a0 Source 
type Logic (Hamming a0) = Logic a0 Source 
type Logic (Hamming a0) = Logic a0 Source 
type Logic (Hamming a0) = Logic a0 Source 
type Logic (Hamming a0) = Logic a0 Source 
type Logic (Hamming a0) = Logic a0 Source 
type Logic (Hamming a0) = Logic a0 Source 
type Logic (Hamming a0) = Logic a0 Source 
type Logic (Hamming a0) = Logic a0 Source 
type Logic (Hamming a0) = Logic a0 Source 
type Logic (Hamming a0) = Logic a0 Source 
type Logic (Levenshtein a0) = Logic a0 Source 
type Logic (Levenshtein a0) = Logic a0 Source 
type Logic (Levenshtein a0) = Logic a0 Source 
type Logic (Levenshtein a0) = Logic a0 Source 
type Logic (Levenshtein a0) = Logic a0 Source 
type Logic (Levenshtein a0) = Logic a0 Source 
type Logic (Levenshtein a0) = Logic a0 Source 
type Logic (Levenshtein a0) = Logic a0 Source 
type Logic (Levenshtein a0) = Logic a0 Source 
type Logic (Levenshtein a0) = Logic a0 Source 
type Logic (Levenshtein a0) = Logic a0 Source 
type Logic (Levenshtein a0) = Logic a0 Source 
type Logic (Levenshtein a0) = Logic a0 Source 
type Logic (Levenshtein a0) = Logic a0 Source 
type Logic (Levenshtein a0) = Logic a0 Source 
type Logic (Levenshtein a0) = Logic a0 Source 
type Logic (Levenshtein a0) = Logic a0 Source 
type Logic (Levenshtein a0) = Logic a0 Source 
type Logic (Levenshtein a0) = Logic a0 Source 
type Logic (Levenshtein a0) = Logic a0 Source 
type Logic (Levenshtein a0) = Logic a0 Source 
type Logic (Levenshtein a0) = Logic a0 Source 
type Logic (Levenshtein a0) = Logic a0 Source 
type Logic (Levenshtein a0) = Logic a0 Source 
type Logic (Uncompensated s0) = Logic s0 Source 
type Logic (Uncompensated s0) = Logic s0 Source 
type Logic (Uncompensated s0) = Logic s0 Source 
type Logic (Uncompensated s0) = Logic s0 Source 
type Logic (Uncompensated s0) = Logic s0 Source 
type Logic (Uncompensated s0) = Logic s0 Source 
type Logic (Uncompensated s0) = Logic s0 Source 
type Logic (Uncompensated s0) = Logic s0 Source 
type Logic (Uncompensated s0) = Logic s0 Source 
type Logic (Uncompensated s0) = Logic s0 Source 
type Logic (Uncompensated s0) = Logic s0 Source 
type Logic (Uncompensated s0) = Logic s0 Source 
type Logic (Uncompensated s0) = Logic s0 Source 
type Logic (Uncompensated s0) = Logic s0 Source 
type Logic (Uncompensated s0) = Logic s0 Source 
type Logic (Uncompensated s0) = Logic s0 Source 
type Logic (Uncompensated s0) = Logic s0 Source 
type Logic (Lexical a0) = Logic a0 Source 
type Logic (Lexical a0) = Logic a0 Source 
type Logic (Lexical a0) = Logic a0 Source 
type Logic (Lexical a0) = Logic a0 Source 
type Logic (Lexical a0) = Logic a0 Source 
type Logic (Lexical a0) = Logic a0 Source 
type Logic (Lexical a0) = Logic a0 Source 
type Logic (Lexical a0) = Logic a0 Source 
type Logic (Lexical a0) = Logic a0 Source 
type Logic (Lexical a0) = Logic a0 Source 
type Logic (ComponentWise a0) = Logic a0 Source 
type Logic (ComponentWise a0) = Logic a0 Source 
type Logic (ComponentWise a0) = Logic a0 Source 
type Logic (ComponentWise a0) = Logic a0 Source 
type Logic (ComponentWise a0) = Logic a0 Source 
type Logic (ComponentWise a0) = Logic a0 Source 
type Logic (ComponentWise a0) = Logic a0 Source 
type Logic (ComponentWise a0) = Logic a0 Source 
type Logic (ComponentWise a0) = Logic a0 Source 
type Logic (ComponentWise a0) = Logic a0 Source 
type Logic (Goedel_ r0) = Logic r0 Source 
type Logic (Goedel_ r0) = Logic r0 Source 
type Logic (Goedel_ r0) = Logic r0 Source 
type Logic (Goedel_ r0) = Logic r0 Source 
type Logic (Boolean2Ring b0) = Logic b0 Source 
type Logic (Boolean2Ring b0) = Logic b0 Source 
type Logic (Boolean2Ring b0) = Logic b0 Source 
type Logic (Boolean2Ring b0) = Logic b0 Source 
type Logic (Boolean2Ring b0) = Logic b0 Source 
type Logic (Boolean2Ring b0) = Logic b0 Source 
type Logic (Boolean2Ring b0) = Logic b0 Source 
type Logic (Boolean2Ring b0) = Logic b0 Source 
type Logic (Boolean2Ring b0) = Logic b0 Source 
type Logic (Boolean2Ring b0) = Logic b0 Source 
type Logic (Boolean2Ring b0) = Logic b0 Source 
type Logic (Boolean2Ring b0) = Logic b0 Source 
type Logic (Seq a) = Bool Source 
type Logic (IntMap e) = Bool Source 
type Logic (IntMap' e) = Bool Source 
type Logic (Set a) = Logic a Source 
type Logic (LexSet a) = Bool Source 
type Logic (ByteString b) = Bool Source 
type Logic (PartitionOnNewline a0) = Logic a0 Source 
type Logic (PartitionOnNewline a0) = Logic a0 Source 
type Logic (PartitionOnNewline a0) = Logic a0 Source 
type Logic (PartitionOnNewline a0) = Logic a0 Source 
type Logic (PartitionOnNewline a0) = Logic a0 Source 
type Logic (PartitionOnNewline a0) = Logic a0 Source 
type Logic (PartitionOnNewline a0) = Logic a0 Source 
type Logic (PartitionOnNewline a0) = Logic a0 Source 
type Logic (PartitionOnNewline a0) = Logic a0 Source 
type Logic (PartitionOnNewline a0) = Logic a0 Source 
type Logic (PartitionOnNewline a0) = Logic a0 Source 
type Logic (PartitionOnNewline a0) = Logic a0 Source 
type Logic (PartitionOnNewline a0) = Logic a0 Source 
type Logic (PartitionOnNewline a0) = Logic a0 Source 
type Logic (PartitionOnNewline a0) = Logic a0 Source 
type Logic (PartitionOnNewline a0) = Logic a0 Source 
type Logic (PartitionOnNewline a0) = Logic a0 Source 
type Logic (a -> b) = a -> Logic b Source 
type Logic (a, b) = Logic a Source 
type Logic (Labeled' x y) = Logic x Source 
type Logic (Galois p0 k0) = Logic (Z ((^) p0 k0)) Source 
type Logic (Galois p0 k0) = Logic (Z ((^) p0 k0)) Source 
type Logic (Galois p0 k0) = Logic (Z ((^) p0 k0)) Source 
type Logic (Galois p0 k0) = Logic (Z ((^) p0 k0)) Source 
type Logic (Galois p0 k0) = Logic (Z ((^) p0 k0)) Source 
type Logic (Galois p0 k0) = Logic (Z ((^) p0 k0)) Source 
type Logic (Galois p0 k0) = Logic (Z ((^) p0 k0)) Source 
type Logic (Galois p0 k0) = Logic (Z ((^) p0 k0)) Source 
type Logic (Galois p0 k0) = Logic (Z ((^) p0 k0)) Source 
type Logic (Galois p0 k0) = Logic (Z ((^) p0 k0)) Source 
type Logic (Galois p0 k0) = Logic (Z ((^) p0 k0)) Source 
type Logic (Galois p0 k0) = Logic (Z ((^) p0 k0)) Source 
type Logic (Galois p0 k0) = Logic (Z ((^) p0 k0)) Source 
type Logic (Polynomial_ a b) = Logic b Source 
type Logic ((+>) a b) = Bool Source 
type Logic (BloomFilter n a) = Bool Source 
type Logic (Map i e) = Bool Source 
type Logic (Map' i e) = Bool Source 
type Logic (a, b, c) = Logic a Source 
type Logic ((/) k a0 b0) = Logic a0 Source 
type Logic ((/) k a0 b0) = Logic a0 Source 
type Logic ((/) k a0 b0) = Logic a0 Source 
type Logic ((/) k a0 b0) = Logic a0 Source 
type Logic ((/) k a0 b0) = Logic a0 Source 
type Logic ((/) k a0 b0) = Logic a0 Source 
type Logic (SVector k n r) = Logic r Source 
type Logic (UVector k n r) = Logic r Source 
type Logic (HyperLogLog k k1 p a) = Bool Source 

type ClassicalLogic a = Logic a ~ Bool Source

Classical logic is implemented using the Prelude's Bool type.

class Eq_ a where Source

Defines equivalence classes over the type. The values need not have identical representations in the machine to be equal.

See wikipedia and ncatlab for more details.

Minimal complete definition

(==)

Methods

(==) :: a -> a -> Logic a infix 4 Source

(/=) :: ValidLogic a => a -> a -> Logic a infix 4 Source

In order to have the "not equals to" relation, your logic must have a notion of "not", and therefore must be Boolean.

Instances

Eq_ Bool Source 
Eq_ Char Source 
Eq_ Double Source 
Eq_ Float Source 
Eq_ Int Source 
Eq_ Integer Source 
Eq_ Ordering Source 
Eq_ Rational Source 
Eq_ () Source 
Eq_ POrdering Source 
Eq_ K3 Source 
Eq_ H3 Source 
ValidEq a => Eq_ [a] Source 
ValidEq a => Eq_ (Maybe a) Source 
ValidEq a => Eq_ (Maybe' a) Source 
Eq_ a0 => Eq_ (WithPreludeOrd a) Source 
Eq_ t0 => Eq_ (NonNegative t) Source 
Eq_ (Z n0) => Eq_ (VedicSquare n) Source 
(Eq v, HasScalar v) => Eq_ (Ball v) Source 
Eq_ v => Eq_ (Componentwise v) Source 
Eq_ (Z (Order a0)) => Eq_ (ZIndex a) Source 
(ValidLogic e, Eq_ e) => Eq_ (BArray e) Source 
(Unboxable e, Eq_ e) => Eq_ (UArray e) Source 
(Eq v, HasScalar v) => Eq_ (Box v) Source 
Eq_ a0 => Eq_ (Jaccard a) Source 
Eq_ a0 => Eq_ (Hamming a) Source 
Eq_ a0 => Eq_ (Levenshtein a) Source 
Eq_ s0 => Eq_ (Uncompensated s) Source 
Eq_ a0 => Eq_ (Lexical a) Source 
Eq_ a0 => Eq_ (ComponentWise a) Source 
Eq_ r0 => Eq_ (Goedel_ r) Source 
Eq_ b0 => Eq_ (Boolean2Ring b) Source 
Eq a => Eq_ (Seq a) Source 
Eq e => Eq_ (IntMap e) Source 
Eq e => Eq_ (IntMap' e) Source 
Eq a => Eq_ (Set a) Source 
Eq_ (LexSet a) Source 
Eq_ (ByteString Char) Source 
Eq_ a0 => Eq_ (PartitionOnNewline a) Source 
Eq_ b => Eq_ (a -> b) Source 
(ValidEq a, ValidEq b, (~) * (Logic a) (Logic b)) => Eq_ (a, b) Source 
Eq_ x => Eq_ (Labeled' x y) Source 
Eq_ (Z ((^) p0 k0)) => Eq_ (Galois p k) Source 
Eq b => Eq_ (Polynomial_ a b) Source 
(Eq i, Eq e) => Eq_ (Map i e) Source 
(Eq i, Eq e) => Eq_ (Map' i e) Source 
(ValidEq a, ValidEq b, ValidEq c, (~) * (Logic a) (Logic b), (~) * (Logic b) (Logic c)) => Eq_ (a, b, c) Source 
Eq_ a0 => Eq_ ((/) k a b) Source 
(KnownNat n, Eq_ r, ValidLogic r, ValidSVector Nat n r) => Eq_ (SVector Nat n r) Source 
(Eq r, Monoid r, ValidSVector Symbol n r) => Eq_ (SVector Symbol n r) Source 
(Eq r, Monoid r, Prim r) => Eq_ (UVector Symbol n r) Source 

type Eq a = (Eq_ a, Logic a ~ Bool) Source

type ValidEq a = (Eq_ a, ValidLogic a) Source

law_Eq_symmetric :: Eq a => a -> a -> Logic a Source

law_Eq_transitive :: Eq a => a -> a -> a -> Logic a Source

class Eq_ b => POrd_ b where Source

This is more commonly known as a "meet" semilattice

Minimal complete definition

inf

Methods

inf :: b -> b -> b Source

(<=) :: b -> b -> Logic b infix 4 Source

(<) :: Complemented (Logic b) => b -> b -> Logic b infix 4 Source

type POrd a = (Eq a, POrd_ a) Source

law_POrd_commutative :: (Eq b, POrd_ b) => b -> b -> Bool Source

law_POrd_associative :: (Eq b, POrd_ b) => b -> b -> b -> Bool Source

class POrd_ b => Lattice_ b where Source

See wikipedia for more details.

Minimal complete definition

sup

Methods

sup :: b -> b -> b Source

(>=) :: b -> b -> Logic b infix 4 Source

(>) :: Boolean (Logic b) => b -> b -> Logic b infix 4 Source

pcompare :: (Logic b ~ Bool) => b -> b -> POrdering Source

This function does not make sense on non-classical logics

FIXME: there are probably related functions for all these other logics; is there a nice way to represent them all?

type Lattice a = (Eq a, Lattice_ a) Source

isChain :: Lattice a => [a] -> Logic a Source

A chain is a collection of elements all of which can be compared

isAntichain :: Lattice a => [a] -> Logic a Source

An antichain is a collection of elements none of which can be compared

See wikipedia for more details.

See also the article on Dilward's Theorem.

data POrdering Source

Represents all the possible ordering relations in a classical logic (i.e. Logic a ~ Bool)

Constructors

PLT 
PGT 
PEQ 
PNA 

law_Lattice_associative :: (Eq b, Lattice_ b) => b -> b -> b -> Bool Source

law_Lattice_transitivity :: Lattice a => a -> a -> a -> Logic a Source

class POrd_ b => MinBound_ b where Source

Most Lattice literature only considers Bounded lattices, but here we have both upper and lower bounded lattices.

minBound <= b || not (minBound > b)

Methods

minBound :: b Source

type MinBound a = (Eq a, MinBound_ a) Source

supremum :: (Foldable bs, Elem bs ~ b, Bounded b) => bs -> b Source

supremum_ :: (Foldable bs, Elem bs ~ b, Lattice_ b) => b -> bs -> b Source

infimum :: (Foldable bs, Elem bs ~ b, Bounded b) => bs -> b Source

infimum_ :: (Foldable bs, Elem bs ~ b, POrd_ b) => b -> bs -> b Source

class Bounded b => Heyting b where Source

Heyting algebras are lattices that support implication, but not necessarily the law of excluded middle.

FIXME: Is every Heyting algebra a cancellative Abelian semigroup? If so, should we make that explicit in the class hierarchy?

Laws

There is a single, simple law that Heyting algebras must satisfy:

a ==> b = c   ===>   a && c < b

Theorems

From the laws, we automatically get the properties of:

distributivity

See wikipedia for more details.

Methods

(==>) :: b -> b -> b infixl 3 Source

FIXME: think carefully about infix

modusPonens :: Boolean b => b -> b -> b Source

FIXME: add the axioms for intuitionist logic, which are theorems based on these laws

Modus ponens gives us a default definition for "==>" in a Boolean algebra. This formula is guaranteed to not work in a Heyting algebra that is not Boolean.

See wikipedia for more details.

law_Heyting_infleft :: (Eq b, Heyting b) => b -> b -> Bool Source

law_Heyting_infright :: (Eq b, Heyting b) => b -> b -> Bool Source

law_Heyting_distributive :: (Eq b, Heyting b) => b -> b -> b -> Bool Source

law_Boolean_infdistributivity :: (Eq b, Boolean b) => b -> b -> b -> Bool Source

law_Boolean_supdistributivity :: (Eq b, Boolean b) => b -> b -> b -> Bool Source

class Lattice b => Graded b where Source

An element of a graded poset has a unique predecessor.

See wikipedia for more details.

Methods

pred :: b -> b Source

the predecessor in the ordering

fromEnum :: b -> Int Source

Algebrists typically call this function the "rank" of the element in the poset; however we use the name from the standard prelude instead

law_Graded_pred :: Graded b => b -> b -> Bool Source

class Lattice_ a => Ord_ a where Source

This is the class of total orderings.

See https://en.wikipedia.org/wiki/Total_order

Minimal complete definition

Nothing

Methods

compare :: (Logic a ~ Bool, Ord_ a) => a -> a -> Ordering Source

law_Ord_totality :: Ord a => a -> a -> Bool Source

law_Ord_min :: Ord a => a -> a -> Bool Source

law_Ord_max :: Ord a => a -> a -> Bool Source

type Ord a = (Eq a, Ord_ a) Source

data Ordering :: *

Constructors

LT 
EQ 
GT 

Instances

Bounded Ordering 
Enum Ordering 
Eq Ordering 
Ord Ordering 
Read Ordering 
Show Ordering 
Ix Ordering 
Generic Ordering 
Arbitrary Ordering 
CoArbitrary Ordering 
Monoid Ordering 
Serial Ordering
>>> runGetL deserialize $ runPutL $ serialize LT::Ordering
LT
>>> runGetL deserialize $ runPutL $ serialize EQ::Ordering
EQ
>>> runGetL deserialize $ runPutL $ serialize GT::Ordering
GT
Hashable Ordering 
Semigroup Ordering 
Monoid Ordering Source 
Semigroup Ordering Source 
Eq_ Ordering Source 
type Rep Ordering = D1 D1Ordering ((:+:) (C1 C1_0Ordering U1) ((:+:) (C1 C1_1Ordering U1) (C1 C1_2Ordering U1))) 
type Logic Ordering = Bool Source 
data Mutable m Ordering = Mutable_ConT_GHC_Types_Ordering (PrimRef m Ordering) Source 
type (==) Ordering a b = EqOrdering a b 

min :: Ord_ a => a -> a -> a Source

max :: Ord_ a => a -> a -> a Source

maximum :: (ValidLogic b, Bounded b) => [b] -> b Source

maximum_ :: (ValidLogic b, Ord_ b) => b -> [b] -> b Source

minimum :: (ValidLogic b, Bounded b) => [b] -> b Source

minimum_ :: (ValidLogic b, Ord_ b) => b -> [b] -> b Source

argmin :: Ord b => a -> a -> (a -> b) -> a Source

argmax :: Ord b => a -> a -> (a -> b) -> a Source

class (Graded b, Ord_ b) => Enum b where Source

In a WellFounded type, every element (except the 'maxBound" if it exists) has a successor element

See http://ncatlab.org/nlab/show/well-founded+relation for more info.

Methods

succ :: b -> b Source

toEnum :: Int -> b Source

law_Enum_succ :: Enum b => b -> b -> Bool Source

Boolean helpers

(||) :: Lattice_ b => b -> b -> b infixr 2 Source

(&&) :: Lattice_ b => b -> b -> b infixr 3 Source

true :: Bounded b => b Source

"true" is an lower bound because `a && true = true` for all a.

false :: MinBound_ b => b Source

"false" is an upper bound because `a && false = false` for all a.

and :: (Foldable bs, Elem bs ~ b, Boolean b) => bs -> b Source

or :: (Foldable bs, Elem bs ~ b, Boolean b) => bs -> b Source

Set-like

type family Elem s Source

Instances

type Elem Double = Double Source 
type Elem Double = Double Source 
type Elem Float = Float Source 
type Elem Float = Float Source 
type Elem Int = Int Source 
type Elem Int = Int Source 
type Elem Integer = Integer Source 
type Elem Integer = Integer Source 
type Elem Rational = Rational Source 
type Elem Rational = Rational Source 
type Elem [a] = a Source 
type Elem (WithPreludeOrd a0) = Elem a0 Source 
type Elem (WithPreludeOrd a0) = Elem a0 Source 
type Elem (WithPreludeOrd a0) = Elem a0 Source 
type Elem (WithPreludeOrd a0) = Elem a0 Source 
type Elem (WithPreludeOrd a0) = Elem a0 Source 
type Elem (WithPreludeOrd a0) = Elem a0 Source 
type Elem (WithPreludeOrd a0) = Elem a0 Source 
type Elem (WithPreludeOrd a0) = Elem a0 Source 
type Elem (WithPreludeOrd a0) = Elem a0 Source 
type Elem (WithPreludeOrd a0) = Elem a0 Source 
type Elem (WithPreludeOrd a0) = Elem a0 Source 
type Elem (WithPreludeOrd a0) = Elem a0 Source 
type Elem (WithPreludeOrd a0) = Elem a0 Source 
type Elem (WithPreludeOrd a0) = Elem a0 Source 
type Elem (WithPreludeOrd a0) = Elem a0 Source 
type Elem (WithPreludeOrd a0) = Elem a0 Source 
type Elem (WithPreludeOrd a0) = Elem a0 Source 
type Elem (WithPreludeOrd a0) = Elem a0 Source 
type Elem (WithPreludeOrd a0) = Elem a0 Source 
type Elem (WithPreludeOrd a0) = Elem a0 Source 
type Elem (WithPreludeOrd a0) = Elem a0 Source 
type Elem (WithPreludeOrd a0) = Elem a0 Source 
type Elem (WithPreludeOrd a0) = Elem a0 Source 
type Elem (NonNegative t0) = Elem t0 Source 
type Elem (NonNegative t0) = Elem t0 Source 
type Elem (NonNegative t0) = Elem t0 Source 
type Elem (NonNegative t0) = Elem t0 Source 
type Elem (NonNegative t0) = Elem t0 Source 
type Elem (NonNegative t0) = Elem t0 Source 
type Elem (NonNegative t0) = Elem t0 Source 
type Elem (NonNegative t0) = Elem t0 Source 
type Elem (NonNegative t0) = Elem t0 Source 
type Elem (NonNegative t0) = Elem t0 Source 
type Elem (NonNegative t0) = Elem t0 Source 
type Elem (NonNegative t0) = Elem t0 Source 
type Elem (NonNegative t0) = Elem t0 Source 
type Elem (NonNegative t0) = Elem t0 Source 
type Elem (NonNegative t0) = Elem t0 Source 
type Elem (NonNegative t0) = Elem t0 Source 
type Elem (NonNegative t0) = Elem t0 Source 
type Elem (NonNegative t0) = Elem t0 Source 
type Elem (NonNegative t0) = Elem t0 Source 
type Elem (NonNegative t0) = Elem t0 Source 
type Elem (NonNegative t0) = Elem t0 Source 
type Elem (VedicSquare n0) = Elem (Z n0) Source 
type Elem (VedicSquare n0) = Elem (Z n0) Source 
type Elem (VedicSquare n0) = Elem (Z n0) Source 
type Elem (VedicSquare n0) = Elem (Z n0) Source 
type Elem (VedicSquare n0) = Elem (Z n0) Source 
type Elem (Ball v) = v Source 
type Elem (Componentwise v) = Scalar v Source 
type Elem (ZIndex a0) = Elem (Z (Order a0)) Source 
type Elem (ZIndex a0) = Elem (Z (Order a0)) Source 
type Elem (ZIndex a0) = Elem (Z (Order a0)) Source 
type Elem (ZIndex a0) = Elem (Z (Order a0)) Source 
type Elem (ZIndex a0) = Elem (Z (Order a0)) Source 
type Elem (ZIndex a0) = Elem (Z (Order a0)) Source 
type Elem (ZIndex a0) = Elem (Z (Order a0)) Source 
type Elem (BArray e) = e Source 
type Elem (UArray e) = e Source 
type Elem (Box v) = v Source 
type Elem (Jaccard a0) = Elem a0 Source 
type Elem (Jaccard a0) = Elem a0 Source 
type Elem (Jaccard a0) = Elem a0 Source 
type Elem (Jaccard a0) = Elem a0 Source 
type Elem (Jaccard a0) = Elem a0 Source 
type Elem (Jaccard a0) = Elem a0 Source 
type Elem (Jaccard a0) = Elem a0 Source 
type Elem (Jaccard a0) = Elem a0 Source 
type Elem (Jaccard a0) = Elem a0 Source 
type Elem (Jaccard a0) = Elem a0 Source 
type Elem (Jaccard a0) = Elem a0 Source 
type Elem (Jaccard a0) = Elem a0 Source 
type Elem (Jaccard a0) = Elem a0 Source 
type Elem (Jaccard a0) = Elem a0 Source 
type Elem (Jaccard a0) = Elem a0 Source 
type Elem (Jaccard a0) = Elem a0 Source 
type Elem (Jaccard a0) = Elem a0 Source 
type Elem (Jaccard a0) = Elem a0 Source 
type Elem (Jaccard a0) = Elem a0 Source 
type Elem (Jaccard a0) = Elem a0 Source 
type Elem (Jaccard a0) = Elem a0 Source 
type Elem (Jaccard a0) = Elem a0 Source 
type Elem (Jaccard a0) = Elem a0 Source 
type Elem (Jaccard a0) = Elem a0 Source 
type Elem (Hamming a0) = Elem a0 Source 
type Elem (Hamming a0) = Elem a0 Source 
type Elem (Hamming a0) = Elem a0 Source 
type Elem (Hamming a0) = Elem a0 Source 
type Elem (Hamming a0) = Elem a0 Source 
type Elem (Hamming a0) = Elem a0 Source 
type Elem (Hamming a0) = Elem a0 Source 
type Elem (Hamming a0) = Elem a0 Source 
type Elem (Hamming a0) = Elem a0 Source 
type Elem (Hamming a0) = Elem a0 Source 
type Elem (Hamming a0) = Elem a0 Source 
type Elem (Hamming a0) = Elem a0 Source 
type Elem (Hamming a0) = Elem a0 Source 
type Elem (Hamming a0) = Elem a0 Source 
type Elem (Hamming a0) = Elem a0 Source 
type Elem (Hamming a0) = Elem a0 Source 
type Elem (Hamming a0) = Elem a0 Source 
type Elem (Hamming a0) = Elem a0 Source 
type Elem (Hamming a0) = Elem a0 Source 
type Elem (Hamming a0) = Elem a0 Source 
type Elem (Hamming a0) = Elem a0 Source 
type Elem (Hamming a0) = Elem a0 Source 
type Elem (Hamming a0) = Elem a0 Source 
type Elem (Hamming a0) = Elem a0 Source 
type Elem (Levenshtein a0) = Elem a0 Source 
type Elem (Levenshtein a0) = Elem a0 Source 
type Elem (Levenshtein a0) = Elem a0 Source 
type Elem (Levenshtein a0) = Elem a0 Source 
type Elem (Levenshtein a0) = Elem a0 Source 
type Elem (Levenshtein a0) = Elem a0 Source 
type Elem (Levenshtein a0) = Elem a0 Source 
type Elem (Levenshtein a0) = Elem a0 Source 
type Elem (Levenshtein a0) = Elem a0 Source 
type Elem (Levenshtein a0) = Elem a0 Source 
type Elem (Levenshtein a0) = Elem a0 Source 
type Elem (Levenshtein a0) = Elem a0 Source 
type Elem (Levenshtein a0) = Elem a0 Source 
type Elem (Levenshtein a0) = Elem a0 Source 
type Elem (Levenshtein a0) = Elem a0 Source 
type Elem (Levenshtein a0) = Elem a0 Source 
type Elem (Levenshtein a0) = Elem a0 Source 
type Elem (Levenshtein a0) = Elem a0 Source 
type Elem (Levenshtein a0) = Elem a0 Source 
type Elem (Levenshtein a0) = Elem a0 Source 
type Elem (Levenshtein a0) = Elem a0 Source 
type Elem (Levenshtein a0) = Elem a0 Source 
type Elem (Levenshtein a0) = Elem a0 Source 
type Elem (Levenshtein a0) = Elem a0 Source 
type Elem (Uncompensated s0) = Elem s0 Source 
type Elem (Uncompensated s0) = Elem s0 Source 
type Elem (Uncompensated s0) = Elem s0 Source 
type Elem (Uncompensated s0) = Elem s0 Source 
type Elem (Uncompensated s0) = Elem s0 Source 
type Elem (Uncompensated s0) = Elem s0 Source 
type Elem (Uncompensated s0) = Elem s0 Source 
type Elem (Uncompensated s0) = Elem s0 Source 
type Elem (Uncompensated s0) = Elem s0 Source 
type Elem (Uncompensated s0) = Elem s0 Source 
type Elem (Uncompensated s0) = Elem s0 Source 
type Elem (Uncompensated s0) = Elem s0 Source 
type Elem (Uncompensated s0) = Elem s0 Source 
type Elem (Uncompensated s0) = Elem s0 Source 
type Elem (Uncompensated s0) = Elem s0 Source 
type Elem (Uncompensated s0) = Elem s0 Source 
type Elem (Uncompensated s0) = Elem s0 Source 
type Elem (Lexical a0) = Elem a0 Source 
type Elem (Lexical a0) = Elem a0 Source 
type Elem (Lexical a0) = Elem a0 Source 
type Elem (Lexical a0) = Elem a0 Source 
type Elem (Lexical a0) = Elem a0 Source 
type Elem (Lexical a0) = Elem a0 Source 
type Elem (Lexical a0) = Elem a0 Source 
type Elem (Lexical a0) = Elem a0 Source 
type Elem (Lexical a0) = Elem a0 Source 
type Elem (Lexical a0) = Elem a0 Source 
type Elem (ComponentWise a0) = Elem a0 Source 
type Elem (ComponentWise a0) = Elem a0 Source 
type Elem (ComponentWise a0) = Elem a0 Source 
type Elem (ComponentWise a0) = Elem a0 Source 
type Elem (ComponentWise a0) = Elem a0 Source 
type Elem (ComponentWise a0) = Elem a0 Source 
type Elem (ComponentWise a0) = Elem a0 Source 
type Elem (ComponentWise a0) = Elem a0 Source 
type Elem (ComponentWise a0) = Elem a0 Source 
type Elem (ComponentWise a0) = Elem a0 Source 
type Elem (Goedel_ r0) = Elem r0 Source 
type Elem (Goedel_ r0) = Elem r0 Source 
type Elem (Goedel_ r0) = Elem r0 Source 
type Elem (Goedel_ r0) = Elem r0 Source 
type Elem (Boolean2Ring b0) = Elem b0 Source 
type Elem (Boolean2Ring b0) = Elem b0 Source 
type Elem (Boolean2Ring b0) = Elem b0 Source 
type Elem (Boolean2Ring b0) = Elem b0 Source 
type Elem (Boolean2Ring b0) = Elem b0 Source 
type Elem (Boolean2Ring b0) = Elem b0 Source 
type Elem (Boolean2Ring b0) = Elem b0 Source 
type Elem (Boolean2Ring b0) = Elem b0 Source 
type Elem (Boolean2Ring b0) = Elem b0 Source 
type Elem (Boolean2Ring b0) = Elem b0 Source 
type Elem (Boolean2Ring b0) = Elem b0 Source 
type Elem (Boolean2Ring b0) = Elem b0 Source 
type Elem (Seq a) = a Source 
type Elem (IntMap e) = e Source 
type Elem (IntMap' e) = e Source 
type Elem (Set a) = a Source 
type Elem (LexSet a) = a Source 
type Elem (ByteString b) = b Source 
type Elem (PartitionOnNewline a0) = Elem a0 Source 
type Elem (PartitionOnNewline a0) = Elem a0 Source 
type Elem (PartitionOnNewline a0) = Elem a0 Source 
type Elem (PartitionOnNewline a0) = Elem a0 Source 
type Elem (PartitionOnNewline a0) = Elem a0 Source 
type Elem (PartitionOnNewline a0) = Elem a0 Source 
type Elem (PartitionOnNewline a0) = Elem a0 Source 
type Elem (PartitionOnNewline a0) = Elem a0 Source 
type Elem (PartitionOnNewline a0) = Elem a0 Source 
type Elem (PartitionOnNewline a0) = Elem a0 Source 
type Elem (PartitionOnNewline a0) = Elem a0 Source 
type Elem (PartitionOnNewline a0) = Elem a0 Source 
type Elem (PartitionOnNewline a0) = Elem a0 Source 
type Elem (PartitionOnNewline a0) = Elem a0 Source 
type Elem (PartitionOnNewline a0) = Elem a0 Source 
type Elem (PartitionOnNewline a0) = Elem a0 Source 
type Elem (PartitionOnNewline a0) = Elem a0 Source 
type Elem (Any cxt x) = x Source 
type Elem (Labeled' x y) = Elem x Source 
type Elem (Galois p0 k0) = Elem (Z ((^) p0 k0)) Source 
type Elem (Galois p0 k0) = Elem (Z ((^) p0 k0)) Source 
type Elem (Galois p0 k0) = Elem (Z ((^) p0 k0)) Source 
type Elem (Galois p0 k0) = Elem (Z ((^) p0 k0)) Source 
type Elem (Galois p0 k0) = Elem (Z ((^) p0 k0)) Source 
type Elem (Galois p0 k0) = Elem (Z ((^) p0 k0)) Source 
type Elem (Galois p0 k0) = Elem (Z ((^) p0 k0)) Source 
type Elem (Galois p0 k0) = Elem (Z ((^) p0 k0)) Source 
type Elem (Galois p0 k0) = Elem (Z ((^) p0 k0)) Source 
type Elem (Galois p0 k0) = Elem (Z ((^) p0 k0)) Source 
type Elem (Galois p0 k0) = Elem (Z ((^) p0 k0)) Source 
type Elem (Galois p0 k0) = Elem (Z ((^) p0 k0)) Source 
type Elem (Galois p0 k0) = Elem (Z ((^) p0 k0)) Source 
type Elem (BloomFilter n a) = a Source 
type Elem (Map i e) = e Source 
type Elem (Map' i e) = e Source 
type Elem ((/) k a0 b0) = Elem a0 Source 
type Elem ((/) k a0 b0) = Elem a0 Source 
type Elem ((/) k a0 b0) = Elem a0 Source 
type Elem ((/) k a0 b0) = Elem a0 Source 
type Elem ((/) k a0 b0) = Elem a0 Source 
type Elem ((/) k a0 b0) = Elem a0 Source 
type Elem (SVector k n r) = Scalar r Source 
type Elem (UVector k n r) = Scalar r Source 
type Elem (HyperLogLog * k p a) = a Source 

type family SetElem s t Source

Instances

type SetElem Double a = Double Source 
type SetElem Float a = Float Source 
type SetElem Int a = Int Source 
type SetElem Integer a = Integer Source 
type SetElem Rational a = Rational Source 
type SetElem [a] b = [b] Source 
type SetElem (Ball v) v' = Ball v' Source 
type SetElem (Componentwise v) v' = Componentwise v' Source 
type SetElem (BArray e) e' = BArray e' Source 
type SetElem (UArray e) e' = UArray e' Source 
type SetElem (Box v) v' = Box v' Source 
type SetElem (Seq a) b = Seq b Source 
type SetElem (IntMap e) e' = IntMap e' Source 
type SetElem (IntMap' e) e' = IntMap' e' Source 
type SetElem (Set a) b = Set b Source 
type SetElem (LexSet a) b = LexSet b Source 
type SetElem (ByteString b) c = ByteString c Source 
type SetElem (BloomFilter n a) b = BloomFilter n b Source 
type SetElem (Map i e) e' = Map i e' Source 
type SetElem (Map' i e) e' = Map' i e' Source 
type SetElem (SVector k n r) b = SVector k n b Source 
type SetElem (UVector k n r) b = UVector k n b Source 

class (ValidLogic s, Constructible s, ValidSetElem s) => Container s where Source

This is a generalization of a "set". We do not require a container to be a boolean algebra, just a semigroup.

Minimal complete definition

elem

Methods

elem :: Elem s -> s -> Logic s Source

notElem :: Elem s -> s -> Logic s Source

class Semigroup s => Constructible s where Source

This is the class for any type that gets "constructed" from smaller types. It is a massive generalization of the notion of a constructable set in topology.

See wikipedia for more details.

Minimal complete definition

singleton | cons | fromList1

Methods

singleton :: Elem s -> s Source

creates the smallest value containing the given element

cons :: Elem s -> s -> s Source

inserts an element on the left

snoc :: s -> Elem s -> s Source

inserts an element on the right; in a non-abelian Constructible, this may not insert the element; this occurs, for example, in the Map type.

fromList1 :: Elem s -> [Elem s] -> s Source

Construct the type from a list. Since lists may be empty (but not all Constructibles can be empty) we explicitly pass in an Elem s.

fromList1N :: Int -> Elem s -> [Elem s] -> s Source

Like "fromList1" but passes in the size of the list for more efficient construction.

fromString :: (Monoid s, Constructible s, Elem s ~ Char) => String -> s Source

This function needed for the OverloadedStrings language extension

fromList :: (Monoid s, Constructible s) => [Elem s] -> s Source

FIXME: if -XOverloadedLists is enabled, this causes an infinite loop for some reason

fromListN :: (Monoid s, Constructible s) => Int -> [Elem s] -> s Source

generate :: (Monoid v, Constructible v) => Int -> (Int -> Elem v) -> v Source

insert :: Constructible s => Elem s -> s -> s Source

A more suggestive name for inserting an element into a container that does not remember location

empty :: (Monoid s, Constructible s) => s Source

A slightly more suggestive name for a container's monoid identity

isEmpty :: (ValidEq s, Monoid s, Constructible s) => s -> Logic s Source

A slightly more suggestive name for checking if a container is empty

class (Constructible s, Monoid s, Normed s, Scalar s ~ Int) => Foldable s where Source

Provides inverse operations for Constructible.

FIXME: should this class be broken up into smaller pieces?

Minimal complete definition

foldMap | foldr

Methods

toList :: Foldable s => s -> [Elem s] Source

Convert the container into a list.

uncons :: s -> Maybe (Elem s, s) Source

Remove an element from the left of the container.

unsnoc :: s -> Maybe (s, Elem s) Source

Remove an element from the right of the container.

sum :: Monoid (Elem s) => s -> Elem s Source

Add all the elements of the container together.

foldMap :: Monoid a => (Elem s -> a) -> s -> a Source

the default summation uses kahan summation sum :: (Abelian (Elem s), Group (Elem s)) => s -> Elem s sum = snd . foldl' go (zero,zero) where go (c,t) i = ((t'-t)-y,t') where y = i-c t' = t+y

foldr :: (Elem s -> a -> a) -> a -> s -> a Source

foldr' :: (Elem s -> a -> a) -> a -> s -> a Source

foldl :: (a -> Elem s -> a) -> a -> s -> a Source

foldl' :: (a -> Elem s -> a) -> a -> s -> a Source

foldr1 :: (Elem s -> Elem s -> Elem s) -> s -> Elem s Source

foldr1' :: (Elem s -> Elem s -> Elem s) -> s -> Elem s Source

foldl1 :: (Elem s -> Elem s -> Elem s) -> s -> Elem s Source

foldl1' :: (Elem s -> Elem s -> Elem s) -> s -> Elem s Source

law_Foldable_sum :: (Logic (Scalar s) ~ Logic s, Logic (Elem s) ~ Logic s, Heyting (Logic s), Monoid (Elem s), Eq_ (Elem s), Foldable s) => s -> s -> Logic s Source

FIXME: This law can't be automatically included in the current test system because it breaks parametricity by requiring Monoid (Elem s)

theorem_Foldable_tofrom :: (Eq_ s, Foldable s) => s -> Logic s Source

Note: The inverse "theorem" of (toList . fromList) xs == xs is actually not true. See the Set type for a counter example.

defn_Foldable_foldr :: (Eq_ a, a ~ Elem s, Logic a ~ Logic (Elem s), Logic (Scalar s) ~ Logic (Elem s), Boolean (Logic (Elem s)), Foldable s) => (Elem s -> Elem s -> Elem s) -> Elem s -> s -> Logic (Elem s) Source

defn_Foldable_foldr' :: (Eq_ a, a ~ Elem s, Logic a ~ Logic (Elem s), Logic (Scalar s) ~ Logic (Elem s), Boolean (Logic (Elem s)), Foldable s) => (Elem s -> Elem s -> Elem s) -> Elem s -> s -> Logic (Elem s) Source

defn_Foldable_foldl :: (Eq_ a, a ~ Elem s, Logic a ~ Logic (Elem s), Logic (Scalar s) ~ Logic (Elem s), Boolean (Logic (Elem s)), Foldable s) => (Elem s -> Elem s -> Elem s) -> Elem s -> s -> Logic (Elem s) Source

defn_Foldable_foldl' :: (Eq_ a, a ~ Elem s, Logic a ~ Logic (Elem s), Logic (Scalar s) ~ Logic (Elem s), Boolean (Logic (Elem s)), Foldable s) => (Elem s -> Elem s -> Elem s) -> Elem s -> s -> Logic (Elem s) Source

defn_Foldable_foldr1 :: (Eq_ (Elem s), Logic (Scalar s) ~ Logic (Elem s), Boolean (Logic (Elem s)), Foldable s) => (Elem s -> Elem s -> Elem s) -> s -> Logic (Elem s) Source

defn_Foldable_foldr1' :: (Eq_ (Elem s), Logic (Scalar s) ~ Logic (Elem s), Boolean (Logic (Elem s)), Foldable s) => (Elem s -> Elem s -> Elem s) -> s -> Logic (Elem s) Source

defn_Foldable_foldl1 :: (Eq_ (Elem s), Logic (Scalar s) ~ Logic (Elem s), Boolean (Logic (Elem s)), Foldable s) => (Elem s -> Elem s -> Elem s) -> s -> Logic (Elem s) Source

defn_Foldable_foldl1' :: (Eq_ (Elem s), Logic (Scalar s) ~ Logic (Elem s), Boolean (Logic (Elem s)), Foldable s) => (Elem s -> Elem s -> Elem s) -> s -> Logic (Elem s) Source

foldtree1 :: Monoid a => [a] -> a Source

This fold is not in any of the standard libraries.

length :: Normed s => s -> Scalar s Source

For anything foldable, the norm must be compatible with the folding structure.

reduce :: (Monoid (Elem s), Foldable s) => s -> Elem s Source

concat :: (Monoid (Elem s), Foldable s) => s -> Elem s Source

indexed containers

type family Index s Source

Instances

type Index Double = Int Source 
type Index Double = Int Source 
type Index Float = Int Source 
type Index Float = Int Source 
type Index Int = Int Source 
type Index Int = Int Source 
type Index Integer = Int Source 
type Index Integer = Int Source 
type Index Rational = Int Source 
type Index Rational = Int Source 
type Index [a] = Int Source 
type Index (BArray e) = Int Source 
type Index (UArray e) = Int Source 
type Index (IntMap e) = Key Source 
type Index (IntMap' e) = Key Source 
type Index (Map i e) = i Source 
type Index (Map' i e) = i Source 
type Index (SVector k n r) = Int Source 
type Index (UVector k n r) = Int Source 

type family SetIndex s a Source

Instances

type SetIndex Double a = Int Source 
type SetIndex Float a = Int Source 
type SetIndex Int a = Int Source 
type SetIndex Integer a = Int Source 
type SetIndex Rational a = Int Source 
type SetIndex (Map i e) i' = Map i' e Source 
type SetIndex (Map' i e) i' = Map' i' e Source 

class (ValidLogic s, Monoid s, ValidSetElem s) => IxContainer s where Source

An indexed constructible container associates an Index with each Elem. This class generalizes the map abstract data type.

There are two differences in the indexed hierarchy of containers from the standard hierarchy. 1. IxConstructible requires a Monoid constraint whereas Constructible requires a Semigroup constraint because there are no valid IxConstructibles (that I know of at least) that are not also Monoids. 2. Many regular containers are indexed containers, but not the other way around. So the class hierarchy is in a different order.

Minimal complete definition

lookup, imap, toIxList

Associated Types

type ValidElem s e :: Constraint Source

FIXME: should the functions below be moved to other classes?

Methods

lookup :: Index s -> s -> Maybe (Elem s) Source

(!) :: s -> Index s -> Elem s Source

findWithDefault :: Elem s -> Index s -> s -> Elem s Source

hasIndex :: s -> Index s -> Logic s Source

imap :: (ValidElem s (Elem s), ValidElem s b) => (Index s -> Elem s -> b) -> s -> SetElem s b Source

toIxList :: s -> [(Index s, Elem s)] Source

indices :: s -> [Index s] Source

values :: s -> [Elem s] Source

(!?) :: IxContainer s => s -> Index s -> Maybe (Elem s) Source

An infix operator equivalent to lookup

class (IxContainer s, Enum (Index s)) => Sliceable s where Source

Sliceable containers generalize the notion of a substring to any IxContainer.

Methods

slice :: Index s -> Int -> s -> s Source

class IxContainer s => IxConstructible s where Source

Some containers that use indices are not typically constructed with those indices (e.g. Arrays).

Minimal complete definition

singletonAt | consAt

Methods

singletonAt :: Index s -> Elem s -> s Source

Construct a container with only the single (index,element) pair. This function is equivalent to singleton in the Constructible class.

consAt :: Index s -> Elem s -> s -> s Source

Insert an element, overwriting the previous value if the index already exists. This function is equivalent to cons in the Constructible class.

snocAt :: s -> Index s -> Elem s -> s Source

Insert an element only if the index does not already exist. If the index already exists, the container is unmodified. This function is equivalent to snoc in the Constructible class.

fromIxList :: [(Index s, Elem s)] -> s Source

This function is the equivalent of fromList in the Constructible class. We do not require all the variants of fromList because of our Monoid constraint.

Instances

insertAt :: IxConstructible s => Index s -> Elem s -> s -> s Source

Types

class CanError a where Source

Minimal complete definition

errorVal, isError

Methods

errorVal :: a Source

isError :: a -> Bool Source

isJust :: a -> Bool Source

justs' :: [Maybe' a] -> [a] Source

Number-like

Classes with one operator

class IsMutable g => Semigroup g where Source

Minimal complete definition

(+) | (+=)

Methods

(+) :: g -> g -> g infixl 6 Source

(+=) :: PrimBase m => Mutable m g -> g -> m () infixr 5 Source

Instances

Semigroup Double Source 
Semigroup Float Source 
Semigroup Int Source 
Semigroup Integer Source 
Semigroup Ordering Source 
Semigroup Rational Source 
Semigroup () Source 
Semigroup POrdering Source

FIXME: there are many semigroups over POrdering; how should we represent the others? newtypes?

Semigroup [a] Source 
Semigroup a => Semigroup (Maybe a) Source 
Semigroup a => Semigroup (Maybe' a) Source 
(Semigroup a0, IsMutable a0) => Semigroup (WithPreludeOrd a) Source 
(Semigroup t0, IsMutable t0) => Semigroup (NonNegative t) Source 
KnownNat n => Semigroup (VedicSquare n) Source 
(Metric v, HasScalar v, ClassicalLogic v) => Semigroup (Ball v) Source 
Semigroup v => Semigroup (Componentwise v) Source 
Semigroup (BArray e) Source 
Unboxable e => Semigroup (UArray e) Source 
Semigroup a => Semigroup (Forward a) Source 
(Lattice v, HasScalar v) => Semigroup (Box v) Source 
(Semigroup a0, IsMutable a0) => Semigroup (Jaccard a) Source 
(Semigroup a0, IsMutable a0) => Semigroup (Hamming a) Source 
(Semigroup a0, IsMutable a0) => Semigroup (Levenshtein a) Source 
(Semigroup s0, IsMutable s0) => Semigroup (Uncompensated s) Source 
(Semigroup a0, IsMutable a0) => Semigroup (Lexical a) Source 
(Semigroup a0, IsMutable a0) => Semigroup (ComponentWise a) Source 
(IsMutable b, Boolean b, ValidLogic b) => Semigroup (Boolean2Ring b) Source 
Semigroup (Seq a) Source 
Semigroup (IntMap e) Source 
Semigroup (IntMap' e) Source 
Ord a => Semigroup (Set a) Source 
Semigroup (LexSet a) Source 
Semigroup (ByteString Char) Source 
(Semigroup a0, IsMutable a0) => Semigroup (PartitionOnNewline a) Source 
Semigroup b => Semigroup (a -> b) Source 
(Semigroup a, Semigroup b) => Semigroup (a, b) Source 
Semigroup (Any Foldable x) Source 
(Semigroup (Z ((^) p0 k0)), IsMutable (Z ((^) p0 k0))) => Semigroup (Galois p k) Source 
Ring r => Semigroup (Polynomial_ r r) Source 
Semigroup ((+>) a b) Source 
KnownNat n => Semigroup (BloomFilter n a) Source 
Ord i => Semigroup (Map i e) Source 
Ord i => Semigroup (Map' i e) Source 
(Semigroup a, Semigroup b, Semigroup c) => Semigroup (a, b, c) Source 
Ring a => Semigroup (ProofOf * Polynomial_ a) Source 
Semigroup (ProofOf_ cat a) => Semigroup (ProofOf * (IncreasingT cat) a) Source 
(Semigroup a, Quotient k a b) => Semigroup ((/) k a b) Source 
Semigroup (cat a b) => Semigroup (IncreasingT cat a b) Source 
(KnownNat n, Semigroup r, ValidSVector Nat n r) => Semigroup (SVector Nat n r) Source 
(Monoid r, ValidSVector Symbol n r) => Semigroup (SVector Symbol n r) Source 
(Monoid r, Prim r) => Semigroup (UVector Symbol n r) Source 
Semigroup b => Semigroup (Diff 0 a b) Source 
(Semigroup b, Semigroup ((><) * * a b)) => Semigroup (Diff 1 a b) Source 
(Semigroup b, Semigroup ((><) * * a b), Semigroup ((><) * * a ((><) * * a b))) => Semigroup (Diff 2 a b) Source 
Semigroup (HyperLogLog k k p a) Source 

law_Semigroup_associativity :: (Eq g, Semigroup g) => g -> g -> g -> Logic g Source

type family Actor s Source

This type class is only used by the Action class. It represents the semigroup that acts on our type.

Instances

type Actor Double = Double Source 
type Actor Float = Float Source 
type Actor Int = Int Source 
type Actor Integer = Integer Source 
type Actor Rational = Rational Source 
type Actor () = () Source 
type Actor (WithPreludeOrd a0) = Actor a0 Source

FIXME: for some reason, our deriving mechanism doesn't work on Show here; It causes's Set's show to enter an infinite loop

type Actor (WithPreludeOrd a0) = Actor a0 Source 
type Actor (WithPreludeOrd a0) = Actor a0 Source 
type Actor (WithPreludeOrd a0) = Actor a0 Source 
type Actor (WithPreludeOrd a0) = Actor a0 Source 
type Actor (WithPreludeOrd a0) = Actor a0 Source 
type Actor (WithPreludeOrd a0) = Actor a0 Source 
type Actor (WithPreludeOrd a0) = Actor a0 Source 
type Actor (WithPreludeOrd a0) = Actor a0 Source 
type Actor (WithPreludeOrd a0) = Actor a0 Source 
type Actor (WithPreludeOrd a0) = Actor a0 Source 
type Actor (WithPreludeOrd a0) = Actor a0 Source 
type Actor (WithPreludeOrd a0) = Actor a0 Source 
type Actor (WithPreludeOrd a0) = Actor a0 Source 
type Actor (WithPreludeOrd a0) = Actor a0 Source 
type Actor (WithPreludeOrd a0) = Actor a0 Source 
type Actor (WithPreludeOrd a0) = Actor a0 Source 
type Actor (WithPreludeOrd a0) = Actor a0 Source 
type Actor (WithPreludeOrd a0) = Actor a0 Source 
type Actor (WithPreludeOrd a0) = Actor a0 Source 
type Actor (WithPreludeOrd a0) = Actor a0 Source 
type Actor (WithPreludeOrd a0) = Actor a0 Source 
type Actor (WithPreludeOrd a0) = Actor a0 Source 
type Actor (NonNegative t0) = Actor t0 Source 
type Actor (NonNegative t0) = Actor t0 Source 
type Actor (NonNegative t0) = Actor t0 Source 
type Actor (NonNegative t0) = Actor t0 Source 
type Actor (NonNegative t0) = Actor t0 Source 
type Actor (NonNegative t0) = Actor t0 Source 
type Actor (NonNegative t0) = Actor t0 Source 
type Actor (NonNegative t0) = Actor t0 Source 
type Actor (NonNegative t0) = Actor t0 Source 
type Actor (NonNegative t0) = Actor t0 Source 
type Actor (NonNegative t0) = Actor t0 Source 
type Actor (NonNegative t0) = Actor t0 Source 
type Actor (NonNegative t0) = Actor t0 Source 
type Actor (NonNegative t0) = Actor t0 Source 
type Actor (NonNegative t0) = Actor t0 Source 
type Actor (NonNegative t0) = Actor t0 Source 
type Actor (NonNegative t0) = Actor t0 Source 
type Actor (NonNegative t0) = Actor t0 Source 
type Actor (NonNegative t0) = Actor t0 Source 
type Actor (NonNegative t0) = Actor t0 Source 
type Actor (NonNegative t0) = Actor t0 Source 
type Actor (VedicSquare n0) = Actor (Z n0) Source 
type Actor (VedicSquare n0) = Actor (Z n0) Source 
type Actor (VedicSquare n0) = Actor (Z n0) Source 
type Actor (VedicSquare n0) = Actor (Z n0) Source 
type Actor (VedicSquare n0) = Actor (Z n0) Source 
type Actor (ZIndex a0) = Actor (Z (Order a0)) Source 
type Actor (ZIndex a0) = Actor (Z (Order a0)) Source 
type Actor (ZIndex a0) = Actor (Z (Order a0)) Source 
type Actor (ZIndex a0) = Actor (Z (Order a0)) Source 
type Actor (ZIndex a0) = Actor (Z (Order a0)) Source 
type Actor (ZIndex a0) = Actor (Z (Order a0)) Source 
type Actor (ZIndex a0) = Actor (Z (Order a0)) Source 
type Actor (Jaccard a0) = Actor a0 Source 
type Actor (Jaccard a0) = Actor a0 Source 
type Actor (Jaccard a0) = Actor a0 Source 
type Actor (Jaccard a0) = Actor a0 Source 
type Actor (Jaccard a0) = Actor a0 Source 
type Actor (Jaccard a0) = Actor a0 Source 
type Actor (Jaccard a0) = Actor a0 Source 
type Actor (Jaccard a0) = Actor a0 Source 
type Actor (Jaccard a0) = Actor a0 Source 
type Actor (Jaccard a0) = Actor a0 Source 
type Actor (Jaccard a0) = Actor a0 Source 
type Actor (Jaccard a0) = Actor a0 Source 
type Actor (Jaccard a0) = Actor a0 Source 
type Actor (Jaccard a0) = Actor a0 Source 
type Actor (Jaccard a0) = Actor a0 Source 
type Actor (Jaccard a0) = Actor a0 Source 
type Actor (Jaccard a0) = Actor a0 Source 
type Actor (Jaccard a0) = Actor a0 Source 
type Actor (Jaccard a0) = Actor a0 Source 
type Actor (Jaccard a0) = Actor a0 Source 
type Actor (Jaccard a0) = Actor a0 Source 
type Actor (Jaccard a0) = Actor a0 Source 
type Actor (Jaccard a0) = Actor a0 Source 
type Actor (Jaccard a0) = Actor a0 Source 
type Actor (Hamming a0) = Actor a0 Source 
type Actor (Hamming a0) = Actor a0 Source 
type Actor (Hamming a0) = Actor a0 Source 
type Actor (Hamming a0) = Actor a0 Source 
type Actor (Hamming a0) = Actor a0 Source 
type Actor (Hamming a0) = Actor a0 Source 
type Actor (Hamming a0) = Actor a0 Source 
type Actor (Hamming a0) = Actor a0 Source 
type Actor (Hamming a0) = Actor a0 Source 
type Actor (Hamming a0) = Actor a0 Source 
type Actor (Hamming a0) = Actor a0 Source 
type Actor (Hamming a0) = Actor a0 Source 
type Actor (Hamming a0) = Actor a0 Source 
type Actor (Hamming a0) = Actor a0 Source 
type Actor (Hamming a0) = Actor a0 Source 
type Actor (Hamming a0) = Actor a0 Source 
type Actor (Hamming a0) = Actor a0 Source 
type Actor (Hamming a0) = Actor a0 Source 
type Actor (Hamming a0) = Actor a0 Source 
type Actor (Hamming a0) = Actor a0 Source 
type Actor (Hamming a0) = Actor a0 Source 
type Actor (Hamming a0) = Actor a0 Source 
type Actor (Hamming a0) = Actor a0 Source 
type Actor (Hamming a0) = Actor a0 Source 
type Actor (Levenshtein a0) = Actor a0 Source 
type Actor (Levenshtein a0) = Actor a0 Source 
type Actor (Levenshtein a0) = Actor a0 Source 
type Actor (Levenshtein a0) = Actor a0 Source 
type Actor (Levenshtein a0) = Actor a0 Source 
type Actor (Levenshtein a0) = Actor a0 Source 
type Actor (Levenshtein a0) = Actor a0 Source 
type Actor (Levenshtein a0) = Actor a0 Source 
type Actor (Levenshtein a0) = Actor a0 Source 
type Actor (Levenshtein a0) = Actor a0 Source 
type Actor (Levenshtein a0) = Actor a0 Source 
type Actor (Levenshtein a0) = Actor a0 Source 
type Actor (Levenshtein a0) = Actor a0 Source 
type Actor (Levenshtein a0) = Actor a0 Source 
type Actor (Levenshtein a0) = Actor a0 Source 
type Actor (Levenshtein a0) = Actor a0 Source 
type Actor (Levenshtein a0) = Actor a0 Source 
type Actor (Levenshtein a0) = Actor a0 Source 
type Actor (Levenshtein a0) = Actor a0 Source 
type Actor (Levenshtein a0) = Actor a0 Source 
type Actor (Levenshtein a0) = Actor a0 Source 
type Actor (Levenshtein a0) = Actor a0 Source 
type Actor (Levenshtein a0) = Actor a0 Source 
type Actor (Levenshtein a0) = Actor a0 Source 
type Actor (Uncompensated s0) = Actor s0 Source 
type Actor (Uncompensated s0) = Actor s0 Source 
type Actor (Uncompensated s0) = Actor s0 Source 
type Actor (Uncompensated s0) = Actor s0 Source 
type Actor (Uncompensated s0) = Actor s0 Source 
type Actor (Uncompensated s0) = Actor s0 Source 
type Actor (Uncompensated s0) = Actor s0 Source 
type Actor (Uncompensated s0) = Actor s0 Source 
type Actor (Uncompensated s0) = Actor s0 Source 
type Actor (Uncompensated s0) = Actor s0 Source 
type Actor (Uncompensated s0) = Actor s0 Source 
type Actor (Uncompensated s0) = Actor s0 Source 
type Actor (Uncompensated s0) = Actor s0 Source 
type Actor (Uncompensated s0) = Actor s0 Source 
type Actor (Uncompensated s0) = Actor s0 Source 
type Actor (Uncompensated s0) = Actor s0 Source 
type Actor (Uncompensated s0) = Actor s0 Source 
type Actor (Lexical a0) = Actor a0 Source 
type Actor (Lexical a0) = Actor a0 Source 
type Actor (Lexical a0) = Actor a0 Source 
type Actor (Lexical a0) = Actor a0 Source 
type Actor (Lexical a0) = Actor a0 Source 
type Actor (Lexical a0) = Actor a0 Source 
type Actor (Lexical a0) = Actor a0 Source 
type Actor (Lexical a0) = Actor a0 Source 
type Actor (Lexical a0) = Actor a0 Source 
type Actor (Lexical a0) = Actor a0 Source 
type Actor (ComponentWise a0) = Actor a0 Source 
type Actor (ComponentWise a0) = Actor a0 Source 
type Actor (ComponentWise a0) = Actor a0 Source 
type Actor (ComponentWise a0) = Actor a0 Source 
type Actor (ComponentWise a0) = Actor a0 Source 
type Actor (ComponentWise a0) = Actor a0 Source 
type Actor (ComponentWise a0) = Actor a0 Source 
type Actor (ComponentWise a0) = Actor a0 Source 
type Actor (ComponentWise a0) = Actor a0 Source 
type Actor (ComponentWise a0) = Actor a0 Source 
type Actor (Goedel_ r0) = Actor r0 Source 
type Actor (Goedel_ r0) = Actor r0 Source 
type Actor (Goedel_ r0) = Actor r0 Source 
type Actor (Goedel_ r0) = Actor r0 Source 
type Actor (Boolean2Ring b0) = Actor b0 Source 
type Actor (Boolean2Ring b0) = Actor b0 Source 
type Actor (Boolean2Ring b0) = Actor b0 Source 
type Actor (Boolean2Ring b0) = Actor b0 Source 
type Actor (Boolean2Ring b0) = Actor b0 Source 
type Actor (Boolean2Ring b0) = Actor b0 Source 
type Actor (Boolean2Ring b0) = Actor b0 Source 
type Actor (Boolean2Ring b0) = Actor b0 Source 
type Actor (Boolean2Ring b0) = Actor b0 Source 
type Actor (Boolean2Ring b0) = Actor b0 Source 
type Actor (Boolean2Ring b0) = Actor b0 Source 
type Actor (Boolean2Ring b0) = Actor b0 Source 
type Actor (PartitionOnNewline a0) = Actor a0 Source 
type Actor (PartitionOnNewline a0) = Actor a0 Source 
type Actor (PartitionOnNewline a0) = Actor a0 Source 
type Actor (PartitionOnNewline a0) = Actor a0 Source 
type Actor (PartitionOnNewline a0) = Actor a0 Source 
type Actor (PartitionOnNewline a0) = Actor a0 Source 
type Actor (PartitionOnNewline a0) = Actor a0 Source 
type Actor (PartitionOnNewline a0) = Actor a0 Source 
type Actor (PartitionOnNewline a0) = Actor a0 Source 
type Actor (PartitionOnNewline a0) = Actor a0 Source 
type Actor (PartitionOnNewline a0) = Actor a0 Source 
type Actor (PartitionOnNewline a0) = Actor a0 Source 
type Actor (PartitionOnNewline a0) = Actor a0 Source 
type Actor (PartitionOnNewline a0) = Actor a0 Source 
type Actor (PartitionOnNewline a0) = Actor a0 Source 
type Actor (PartitionOnNewline a0) = Actor a0 Source 
type Actor (PartitionOnNewline a0) = Actor a0 Source 
type Actor (a -> b) = a -> Actor b Source 
type Actor (Labeled' x y) = x Source 
type Actor (Galois p0 k0) = Actor (Z ((^) p0 k0)) Source 
type Actor (Galois p0 k0) = Actor (Z ((^) p0 k0)) Source 
type Actor (Galois p0 k0) = Actor (Z ((^) p0 k0)) Source 
type Actor (Galois p0 k0) = Actor (Z ((^) p0 k0)) Source 
type Actor (Galois p0 k0) = Actor (Z ((^) p0 k0)) Source 
type Actor (Galois p0 k0) = Actor (Z ((^) p0 k0)) Source 
type Actor (Galois p0 k0) = Actor (Z ((^) p0 k0)) Source 
type Actor (Galois p0 k0) = Actor (Z ((^) p0 k0)) Source 
type Actor (Galois p0 k0) = Actor (Z ((^) p0 k0)) Source 
type Actor (Galois p0 k0) = Actor (Z ((^) p0 k0)) Source 
type Actor (Galois p0 k0) = Actor (Z ((^) p0 k0)) Source 
type Actor (Galois p0 k0) = Actor (Z ((^) p0 k0)) Source 
type Actor (Galois p0 k0) = Actor (Z ((^) p0 k0)) Source 
type Actor ((/) k a0 b0) = Actor a0 Source 
type Actor ((/) k a0 b0) = Actor a0 Source 
type Actor ((/) k a0 b0) = Actor a0 Source 
type Actor ((/) k a0 b0) = Actor a0 Source 
type Actor ((/) k a0 b0) = Actor a0 Source 
type Actor ((/) k a0 b0) = Actor a0 Source 

class (IsMutable s, Semigroup (Actor s)) => Action s where Source

Semigroup actions let us apply a semigroup to a set. The theory of Modules is essentially the theory of Ring actions. (See <http://mathoverflow.net/questions/100565/why-are-ring-actions-much-harder-to-find-than-group-actions mathoverflow.) That is why the two classes use similar notation.

See wikipedia for more detail.

FIXME: These types could probably use a more expressive name.

FIXME: We would like every Semigroup to act on itself, but this results in a class cycle.

Minimal complete definition

(.+) | (.+=)

Methods

(.+) :: s -> Actor s -> s infixl 6 Source

(.+=) :: PrimBase m => Mutable m s -> Actor s -> m () infixr 5 Source

law_Action_compatibility :: (Eq_ s, Action s) => Actor s -> Actor s -> s -> Logic s Source

(+.) :: Action s => Actor s -> s -> s infixr 6 Source

s .+ a = a +. s

class Semigroup g => Cancellative g where Source

In a cancellative semigroup,

1)

a + b = a + c   ==>   b = c

so > (a + b) - b = a + (b - b) = a

2)

b + a = c + a   ==>   b = c

so > -b + (b + a) = (-b + b) + a = a

This allows us to define "subtraction" in the semigroup. If the semigroup is embeddable in a group, subtraction can be thought of as performing the group subtraction and projecting the result back into the domain of the cancellative semigroup. It is an open problem to fully characterize which cancellative semigroups can be embedded into groups.

See wikipedia for more details.

Minimal complete definition

(-) | (-=)

Methods

(-) :: g -> g -> g infixl 6 Source

(-=) :: PrimBase m => Mutable m g -> g -> m () infixr 5 Source

Instances

Cancellative Double Source 
Cancellative Float Source 
Cancellative Int Source 
Cancellative Integer Source 
Cancellative Rational Source 
Cancellative () Source 
(Cancellative a0, Semigroup a0) => Cancellative (WithPreludeOrd a) Source 
(Ord t, Group t) => Cancellative (NonNegative t) Source 
Cancellative v => Cancellative (Componentwise v) Source 
Cancellative a => Cancellative (Forward a) Source 
(Cancellative a0, Semigroup a0) => Cancellative (Jaccard a) Source 
(Cancellative a0, Semigroup a0) => Cancellative (Hamming a) Source 
(Cancellative a0, Semigroup a0) => Cancellative (Levenshtein a) Source 
(IsMutable b, Boolean b, ValidLogic b) => Cancellative (Boolean2Ring b) Source 
Cancellative b => Cancellative (a -> b) Source 
(Cancellative a, Cancellative b) => Cancellative (a, b) Source 
(Cancellative (Z ((^) p0 k0)), Semigroup (Z ((^) p0 k0))) => Cancellative (Galois p k) Source 
(ValidLogic r, Ring r) => Cancellative (Polynomial_ r r) Source 
(VectorSpace a, VectorSpace b) => Cancellative ((+>) a b) Source 
(Cancellative a, Cancellative b, Cancellative c) => Cancellative (a, b, c) Source 
(ValidLogic a, Ring a) => Cancellative (ProofOf * Polynomial_ a) Source 
(Cancellative a, Quotient k a b) => Cancellative ((/) k a b) Source 
(KnownNat n, Cancellative r, ValidSVector Nat n r) => Cancellative (SVector Nat n r) Source 
(Monoid r, Cancellative r, ValidSVector Symbol n r) => Cancellative (SVector Symbol n r) Source 
(Monoid r, Cancellative r, Prim r) => Cancellative (UVector Symbol n r) Source 

class Semigroup g => Monoid g where Source

Methods

zero :: g Source

Instances

Monoid Double Source 
Monoid Float Source 
Monoid Int Source 
Monoid Integer Source 
Monoid Ordering Source 
Monoid Rational Source 
Monoid () Source 
Monoid POrdering Source 
Monoid [a] Source 
Semigroup a => Monoid (Maybe a) Source 
Semigroup a => Monoid (Maybe' a) Source 
(Monoid a0, Semigroup a0) => Monoid (WithPreludeOrd a) Source 
(Monoid t0, Semigroup t0) => Monoid (NonNegative t) Source 
KnownNat n => Monoid (VedicSquare n) Source 
Monoid v => Monoid (Componentwise v) Source 
Monoid (BArray e) Source 
Unboxable e => Monoid (UArray e) Source 
Monoid a => Monoid (Forward a) Source 
(Monoid a0, Semigroup a0) => Monoid (Jaccard a) Source 
(Monoid a0, Semigroup a0) => Monoid (Hamming a) Source 
(Monoid a0, Semigroup a0) => Monoid (Levenshtein a) Source 
(Monoid s0, Semigroup s0) => Monoid (Uncompensated s) Source 
(Monoid a0, Semigroup a0) => Monoid (Lexical a) Source 
(Monoid a0, Semigroup a0) => Monoid (ComponentWise a) Source 
(IsMutable b, Boolean b, ValidLogic b) => Monoid (Boolean2Ring b) Source 
Monoid (Seq a) Source 
Monoid (IntMap e) Source 
Monoid (IntMap' e) Source 
Ord a => Monoid (Set a) Source 
Ord a => Monoid (LexSet a) Source 
Monoid (ByteString Char) Source 
(Monoid a0, Semigroup a0) => Monoid (PartitionOnNewline a) Source 
Monoid b => Monoid (a -> b) Source 
(Monoid a, Monoid b) => Monoid (a, b) Source 
Monoid (Any Foldable x) Source 
(Monoid (Z ((^) p0 k0)), Semigroup (Z ((^) p0 k0))) => Monoid (Galois p k) Source 
(ValidLogic r, Ring r) => Monoid (Polynomial_ r r) Source 
(VectorSpace a, VectorSpace b) => Monoid ((+>) a b) Source 
KnownNat n => Monoid (BloomFilter n a) Source 
Ord i => Monoid (Map i e) Source 
Ord i => Monoid (Map' i e) Source 
(Monoid a, Monoid b, Monoid c) => Monoid (a, b, c) Source 
(ValidLogic a, Ring a) => Monoid (ProofOf * Polynomial_ a) Source 
(Monoid a, Quotient k a b) => Monoid ((/) k a b) Source 
(KnownNat n, Monoid r, ValidSVector Nat n r) => Monoid (SVector Nat n r) Source 
(Monoid r, ValidSVector Symbol n r) => Monoid (SVector Symbol n r) Source 
(Monoid r, Prim r) => Monoid (UVector Symbol n r) Source 
Monoid b => Monoid (Diff 0 a b) Source 
(Monoid b, Monoid ((><) * * a b)) => Monoid (Diff 1 a b) Source 
(Monoid b, Monoid ((><) * * a b), Monoid ((><) * * a ((><) * * a b))) => Monoid (Diff 2 a b) Source 

isZero :: (Monoid g, ValidEq g) => g -> Logic g Source

FIXME: this should be in the Monoid class, but putting it there requires a lot of changes to Eq

notZero :: (Monoid g, ValidEq g) => g -> Logic g Source

FIXME: this should be in the Monoid class, but putting it there requires a lot of changes to Eq

class Semigroup m => Abelian m Source

class (Cancellative g, Monoid g) => Group g where Source

Minimal complete definition

Nothing

Methods

negate :: g -> g Source

Instances

Group Double Source 
Group Float Source 
Group Int Source 
Group Integer Source 
Group Rational Source 
Group () Source 
(Group a0, Cancellative a0, Monoid a0) => Group (WithPreludeOrd a) Source 
Group v => Group (Componentwise v) Source 
Group a => Group (Forward a) Source 
(Group a0, Cancellative a0, Monoid a0) => Group (Jaccard a) Source 
(Group a0, Cancellative a0, Monoid a0) => Group (Hamming a) Source 
(Group a0, Cancellative a0, Monoid a0) => Group (Levenshtein a) Source 
(IsMutable b, Boolean b, ValidLogic b) => Group (Boolean2Ring b) Source 
Group b => Group (a -> b) Source 
(Group a, Group b) => Group (a, b) Source 
(Group (Z ((^) p0 k0)), Cancellative (Z ((^) p0 k0)), Monoid (Z ((^) p0 k0))) => Group (Galois p k) Source 
(ValidLogic r, Ring r) => Group (Polynomial_ r r) Source 
(VectorSpace a, VectorSpace b) => Group ((+>) a b) Source 
(Group a, Group b, Group c) => Group (a, b, c) Source 
(ValidLogic a, Ring a) => Group (ProofOf * Polynomial_ a) Source 
(Group a, Quotient k a b) => Group ((/) k a b) Source 
(KnownNat n, Group r, ValidSVector Nat n r) => Group (SVector Nat n r) Source 
(Group r, ValidSVector Symbol n r) => Group (SVector Symbol n r) Source 
(Group r, Prim r) => Group (UVector Symbol n r) Source 

defn_Group_negateminus :: (Eq g, Group g) => g -> g -> Bool Source

Classes with two operators

class (Abelian r, Monoid r) => Rg r where Source

A Rg is a Ring without multiplicative identity or negative numbers. (Hence the removal of the i and n from the name.)

There is no standard terminology for this structure. They might also be called "semirings without identity", "pre-semirings", or "hemirings". See this stackexchange question for a discussion on naming.

Minimal complete definition

(*) | (*=)

Methods

(*) :: r -> r -> r infixl 7 Source

(*=) :: PrimBase m => Mutable m r -> r -> m () infixr 5 Source

Instances

Rg Double Source 
Rg Float Source 
Rg Int Source 
Rg Integer Source 
Rg Rational Source 
(Rg a0, Abelian a0, Monoid a0) => Rg (WithPreludeOrd a) Source 
(Rg t0, Abelian t0, Monoid t0) => Rg (NonNegative t) Source 
FreeModule v => Rg (Componentwise v) Source 
Rg a => Rg (Forward a) Source 
(Rg a0, Abelian a0, Monoid a0) => Rg (Jaccard a) Source 
(Rg a0, Abelian a0, Monoid a0) => Rg (Hamming a) Source 
(Rg a0, Abelian a0, Monoid a0) => Rg (Levenshtein a) Source 
(IsMutable b, Boolean b, ValidLogic b) => Rg (Boolean2Ring b) Source 
Rg b => Rg (a -> b) Source 
(Rg (Z ((^) p0 k0)), Abelian (Z ((^) p0 k0)), Monoid (Z ((^) p0 k0))) => Rg (Galois p k) Source 
(ValidLogic r, Ring r) => Rg (Polynomial_ r r) Source 
VectorSpace a => Rg ((+>) a a) Source 
(ValidLogic a, Ring a) => Rg (ProofOf * Polynomial_ a) Source 
(Rg a, Quotient k a b) => Rg ((/) k a b) Source 

law_Rg_multiplicativeAssociativity :: (Eq r, Rg r) => r -> r -> r -> Bool Source

law_Rg_annihilation :: (Eq r, Rg r) => r -> Bool Source

law_Rg_distributivityLeft :: (Eq r, Rg r) => r -> r -> r -> Bool Source

theorem_Rg_distributivityRight :: (Eq r, Rg r) => r -> r -> r -> Bool Source

defn_Rg_timesequal :: (Eq_ g, Rg g) => g -> g -> Logic g Source

class (Monoid r, Rg r) => Rig r where Source

A Rig is a Rg with multiplicative identity. They are also known as semirings.

See wikipedia and ncatlab for more details.

Methods

one :: r Source

the multiplicative identity

Instances

Rig Double Source 
Rig Float Source 
Rig Int Source 
Rig Integer Source 
Rig Rational Source 
(Rig a0, Monoid a0, Rg a0) => Rig (WithPreludeOrd a) Source 
(Rig t0, Monoid t0, Rg t0) => Rig (NonNegative t) Source 
FiniteModule v => Rig (Componentwise v) Source 
Rig a => Rig (Forward a) Source 
(Rig a0, Monoid a0, Rg a0) => Rig (Jaccard a) Source 
(Rig a0, Monoid a0, Rg a0) => Rig (Hamming a) Source 
(Rig a0, Monoid a0, Rg a0) => Rig (Levenshtein a) Source 
(IsMutable b, Boolean b, ValidLogic b) => Rig (Boolean2Ring b) Source 
Rig b => Rig (a -> b) Source 
(Rig (Z ((^) p0 k0)), Monoid (Z ((^) p0 k0)), Rg (Z ((^) p0 k0))) => Rig (Galois p k) Source 
(ValidLogic r, Ring r) => Rig (Polynomial_ r r) Source 
VectorSpace a => Rig ((+>) a a) Source 
(ValidLogic a, Ring a) => Rig (ProofOf * Polynomial_ a) Source 
(Rig a, Quotient k a b) => Rig ((/) k a b) Source 

isOne :: (Rig g, ValidEq g) => g -> Logic g Source

FIXME: this should be in the Rig class, but putting it there requires a lot of changes to Eq

notOne :: (Rig g, ValidEq g) => g -> Logic g Source

FIXME: this should be in the Rig class, but putting it there requires a lot of changes to Eq

type Rng r = (Rg r, Group r) Source

A Ring without identity.

class (Rng r, Rig r) => Ring r where Source

It is not part of the standard definition of rings that they have a "fromInteger" function. It follows from the definition, however, that we can construct such a function. The "slowFromInteger" function is this standard construction.

See wikipedia and ncatlab for more details.

FIXME: We can construct a Module from any ring by taking (*)=(.*.). Thus, Module should be a superclass of Ring. Currently, however, this creates a class cycle, so we can't do it. A number of type signatures are therefore more complicated than they need to be.

Minimal complete definition

Nothing

Methods

fromInteger :: Integer -> r Source

Instances

Ring Double Source 
Ring Float Source 
Ring Int Source 
Ring Integer Source 
Ring Rational Source 
(Ring a0, Rng a0, Rig a0) => Ring (WithPreludeOrd a) Source 
FiniteModule v => Ring (Componentwise v) Source 
Ring a => Ring (Forward a) Source 
(Ring a0, Rng a0, Rig a0) => Ring (Jaccard a) Source 
(Ring a0, Rng a0, Rig a0) => Ring (Hamming a) Source 
(Ring a0, Rng a0, Rig a0) => Ring (Levenshtein a) Source 
(IsMutable b, Boolean b, ValidLogic b) => Ring (Boolean2Ring b) Source 
Ring b => Ring (a -> b) Source 
(Ring (Z ((^) p0 k0)), Rng (Z ((^) p0 k0)), Rig (Z ((^) p0 k0))) => Ring (Galois p k) Source 
(ValidLogic r, Ring r) => Ring (Polynomial_ r r) Source 
VectorSpace a => Ring ((+>) a a) Source 
(ValidLogic a, Ring a) => Ring (ProofOf * Polynomial_ a) Source 
(Ring a, Quotient k a b) => Ring ((/) k a b) Source 

indicator :: Ring r => Bool -> r Source

class Ring a => Integral a where Source

Integral numbers can be formed from a wide class of things that behave like integers, but intuitively look nothing like integers.

FIXME: All Fields are integral domains; should we make it a subclass? This wouuld have the (minor?) problem of making the Integral class have to be an approximate embedding. FIXME: Not all integral domains are homomorphic to the integers (e.g. a field)

See wikipedia on integral elements, integral domains, and the ring of integers.

Minimal complete definition

toInteger, quotRem, divMod

Methods

toInteger :: a -> Integer Source

quot :: a -> a -> a infixl 7 Source

truncates towards zero

rem :: a -> a -> a infixl 7 Source

quotRem :: a -> a -> (a, a) Source

div :: a -> a -> a infixl 7 Source

truncates towards negative infinity

mod :: a -> a -> a infixl 7 Source

divMod :: a -> a -> (a, a) Source

law_Integral_divMod :: (Eq a, Integral a) => a -> a -> Bool Source

law_Integral_quotRem :: (Eq a, Integral a) => a -> a -> Bool Source

roundUpToNearest :: Int -> Int -> Int Source

FIXME: This should be moved into the class hierarchy and generalized.

FIXME: There are more efficient implementations available if you restrict m to powers of 2. Is GHC smart enough to convert rem into bit shifts? See for more possibilities: http://stackoverflow.com/questions/3407012/c-rounding-up-to-the-nearest-multiple-of-a-number

fromIntegral :: (Integral a, Ring b) => a -> b Source

class Ring r => Field r where Source

Fields are Rings with a multiplicative inverse.

See wikipedia and ncatlab for more details.

Minimal complete definition

Nothing

Methods

reciprocal :: r -> r Source

(/) :: r -> r -> r infixl 7 Source

fromRational :: Rational -> r Source

class (Field r, Ord r, Normed r, IsScalar r) => OrdField r Source

Ordered fields are generalizations of the rational numbers that maintain most of the nice properties. In particular, all finite fields and the complex numbers are NOT ordered fields.

See wikipedia for more details.

class Field r => RationalField r where Source

A Rational field is a field with only a single dimension.

FIXME: this isn't part of standard math; why is it here?

Methods

toRational :: r -> Rational Source

toFloat :: RationalField a => a -> Float Source

FIXME: These functions don't work for Int's, but they should

class (OrdField r, Bounded r) => BoundedField r where Source

The prototypical example of a bounded field is the extended real numbers. Other examples are the extended hyperreal numbers and the extended rationals. Each of these fields has been extensively studied, but I don't know of any studies of this particular abstraction of these fields.

See wikipedia for more details.

Minimal complete definition

isNaN

Methods

nan :: r Source

isNaN :: r -> Bool Source

class Ring r => ExpRing r where Source

Rings augmented with the ability to take exponents.

Not all rings have this ability. Consider the ring of rational numbers (represented by Rational in Haskell). Raising any rational to an integral power results in another rational. But raising to a fractional power results in an irrational number. For example, the square root of 2.

See wikipedia for more detail.

FIXME: This class hierarchy doesn't give a nice way exponentiate the integers. We need to add instances for all the quotient groups.

Methods

(**) :: r -> r -> r infixl 8 Source

logBase :: r -> r -> r Source

(^) :: ExpRing r => r -> r -> r Source

An alternate form of "(**)" that some people find more convenient.

class (ExpRing r, Field r) => ExpField r where Source

Fields augmented with exponents and logarithms.

Technically, there are fields for which only a subset of the functions below are meaningful. But these fields don't have any practical computational uses that I'm aware of. So I've combined them all into a single class for simplicity.

See wikipedia for more detail.

Minimal complete definition

exp, log

Methods

sqrt :: r -> r Source

exp :: r -> r Source

log :: r -> r Source

class ExpField r => Real r where Source

This is a catch-all class for things the real numbers can do but don't exist in other classes.

FIXME: Factor this out into a more appropriate class hierarchy. For example, some (all?) trig functions need to move to a separate class in order to support trig in finite fields (see wikipedia).

FIXME: This class is misleading/incorrect for complex numbers.

FIXME: There's a lot more functions that need adding.

Methods

gamma :: r -> r Source

lnGamma :: r -> r Source

erf :: r -> r Source

pi :: r Source

sin :: r -> r Source

cos :: r -> r Source

tan :: r -> r Source

asin :: r -> r Source

acos :: r -> r Source

atan :: r -> r Source

sinh :: r -> r Source

cosh :: r -> r Source

tanh :: r -> r Source

asinh :: r -> r Source

acosh :: r -> r Source

atanh :: r -> r Source

class (Ring r, Integral s) => QuotientField r s where Source

A QuotientField is a field with an IntegralDomain as a subring. There may be many such subrings (for example, every field has itself as an integral domain subring). This is especially true in Haskell because we have different data types that represent essentially the same ring (e.g. Int and Integer). Therefore this is a multiparameter type class. The r parameter represents the quotient field, and the s parameter represents the subring. The main purpose of this class is to provide functions that map elements in r to elements in s in various ways.

FIXME: Need examples. Is there a better representation?

See wikipedia for more details.

Methods

truncate :: r -> s Source

round :: r -> s Source

ceiling :: r -> s Source

floor :: r -> s Source

(^^) :: r -> s -> r Source

Sizes

class (Ord_ (Scalar g), Scalar (Scalar g) ~ Scalar g, Ring (Scalar g)) => Normed g where Source

FIXME: What constraint should be here? Semigroup?

See ncatlab

Minimal complete definition

size

Methods

size :: g -> Scalar g Source

sizeSquared :: g -> Scalar g Source

Instances

Normed Double Source 
Normed Float Source 
Normed Int Source 
Normed Integer Source 
Normed Rational Source 
Normed [a] Source 
Normed (BArray e) Source 
Unbox e => Normed (UArray e) Source 
(Normed a0, Ord_ (Scalar a0), (~) * (Scalar (Scalar a0)) (Scalar a0), Ring (Scalar a0)) => Normed (Jaccard a) Source 
(Normed a0, Ord_ (Scalar a0), (~) * (Scalar (Scalar a0)) (Scalar a0), Ring (Scalar a0)) => Normed (Hamming a) Source 
(Normed a0, Ord_ (Scalar a0), (~) * (Scalar (Scalar a0)) (Scalar a0), Ring (Scalar a0)) => Normed (Levenshtein a) Source 
(Normed s0, Ord_ (Scalar s0), (~) * (Scalar (Scalar s0)) (Scalar s0), Ring (Scalar s0)) => Normed (Uncompensated s) Source 
(Normed a0, Ord_ (Scalar a0), (~) * (Scalar (Scalar a0)) (Scalar a0), Ring (Scalar a0)) => Normed (Lexical a) Source 
(Normed a0, Ord_ (Scalar a0), (~) * (Scalar (Scalar a0)) (Scalar a0), Ring (Scalar a0)) => Normed (ComponentWise a) Source 
Normed (Seq a) Source 
Normed (IntMap e) Source 
Normed (IntMap' e) Source 
Normed (Set a) Source 
Ord a => Normed (LexSet a) Source 
Normed (ByteString Char) Source 
(Normed a0, Ord_ (Scalar a0), (~) * (Scalar (Scalar a0)) (Scalar a0), Ring (Scalar a0)) => Normed (PartitionOnNewline a) Source 
Normed (Any Foldable x) Source 
Normed x => Normed (Labeled' x y) Source 
MatrixField r => Normed ((+>) (SVector k m r) (SVector k n r)) Source 
KnownNat n => Normed (BloomFilter n a) Source 
Normed (Map i e) Source 
Normed (Map' i e) Source 
(KnownNat n, VectorSpace r, ValidSVector Nat n r, IsScalar r, ExpField r) => Normed (SVector Nat n r) Source 
(VectorSpace r, ValidSVector Symbol n r, IsScalar r, ExpField r) => Normed (SVector Symbol n r) Source 
(VectorSpace r, Prim r, IsScalar r, ExpField r) => Normed (UVector Symbol n r) Source 
ReifiesConfig k1 p => Normed (HyperLogLog k k p a) Source 

abs :: IsScalar g => g -> g Source

class (HasScalar v, Eq_ v, Boolean (Logic v), Logic (Scalar v) ~ Logic v) => Metric v where Source

Metric spaces give us the most intuitive notion of distance between objects.

FIXME: There are many other notions of distance and we should make a whole hierarchy.

Minimal complete definition

distance

Methods

distance :: v -> v -> Scalar v Source

distanceUB :: v -> v -> Scalar v -> Scalar v Source

If the distance between two datapoints is less than or equal to the upper bound, then this function will return the distance. Otherwise, it will return some number greater than the upper bound.

Instances

Metric Double Source 
Metric Float Source 
Metric Int Source 
Metric Integer Source 
Metric Rational Source 
(Metric a0, HasScalar a0, Eq_ a0, Boolean (Logic a0), (~) * (Logic (Scalar a0)) (Logic a0)) => Metric (WithPreludeOrd a) Source 
(Metric t0, HasScalar t0, Eq_ t0, Boolean (Logic t0), (~) * (Logic (Scalar t0)) (Logic t0)) => Metric (NonNegative t) Source 
(Lattice_ a, Field (Scalar a), Normed a, (~) * (Logic (Scalar a)) (Logic a), Boolean (Logic a), HasScalar a) => Metric (Jaccard a) Source 
(Foldable a, Eq (Elem a), Eq a, ClassicalLogic (Scalar a), HasScalar a) => Metric (Hamming a) Source 
(Foldable a, Eq (Elem a), Eq a, Show a, HasScalar a, ClassicalLogic (Scalar a), Bounded (Scalar a)) => Metric (Levenshtein a) Source 
Metric x => Metric (Labeled' x y) Source 
(KnownNat n, ValidSVector Nat n r, ExpField r, Normed r, Ord_ r, (~) * (Logic r) Bool, IsScalar r, VectorSpace r, ValidSVector Symbol "dyn" r) => Metric (SVector Nat n r) Source 
(ValidSVector Symbol n r, ExpField r, Normed r, Ord_ r, (~) * (Logic r) Bool, IsScalar r, VectorSpace r) => Metric (SVector Symbol n r) Source 
(Prim r, ExpField r, Normed r, Ord_ r, (~) * (Logic r) Bool, IsScalar r, VectorSpace r) => Metric (UVector Symbol n r) Source 

isFartherThan :: Metric v => v -> v -> Scalar v -> Logic v Source

Calling this function will be faster on some Metrics than manually checking if distance is greater than the bound.

lb2distanceUB :: (Metric a, ClassicalLogic a) => (a -> a -> Scalar a) -> a -> a -> Scalar a -> Scalar a Source

This function constructs an efficient default implementation for distanceUB given a function that lower bounds the distance metric.

law_Metric_triangle :: Metric v => v -> v -> v -> Logic v Source

Linear algebra

type family Scalar m Source

Instances

type Scalar Double = Double Source 
type Scalar Float = Float Source 
type Scalar Int = Int Source 
type Scalar Int64 = Int64 Source 
type Scalar Integer = Integer Source 
type Scalar Rational = Rational Source 
type Scalar [a] = Int Source 
type Scalar (Maybe a) = Scalar a Source 
type Scalar (Maybe' a) = Scalar a Source 
type Scalar (WithPreludeOrd a0) = Scalar a0 Source 
type Scalar (WithPreludeOrd a0) = Scalar a0 Source 
type Scalar (WithPreludeOrd a0) = Scalar a0 Source 
type Scalar (WithPreludeOrd a0) = Scalar a0 Source 
type Scalar (WithPreludeOrd a0) = Scalar a0 Source 
type Scalar (WithPreludeOrd a0) = Scalar a0 Source 
type Scalar (WithPreludeOrd a0) = Scalar a0 Source 
type Scalar (WithPreludeOrd a0) = Scalar a0 Source 
type Scalar (WithPreludeOrd a0) = Scalar a0 Source 
type Scalar (WithPreludeOrd a0) = Scalar a0 Source 
type Scalar (WithPreludeOrd a0) = Scalar a0 Source 
type Scalar (WithPreludeOrd a0) = Scalar a0 Source 
type Scalar (WithPreludeOrd a0) = Scalar a0 Source 
type Scalar (WithPreludeOrd a0) = Scalar a0 Source 
type Scalar (WithPreludeOrd a0) = Scalar a0 Source 
type Scalar (WithPreludeOrd a0) = Scalar a0 Source 
type Scalar (WithPreludeOrd a0) = Scalar a0 Source 
type Scalar (WithPreludeOrd a0) = Scalar a0 Source 
type Scalar (WithPreludeOrd a0) = Scalar a0 Source 
type Scalar (WithPreludeOrd a0) = Scalar a0 Source 
type Scalar (WithPreludeOrd a0) = Scalar a0 Source 
type Scalar (WithPreludeOrd a0) = Scalar a0 Source 
type Scalar (WithPreludeOrd a0) = Scalar a0 Source 
type Scalar (NonNegative t0) = Scalar t0 Source 
type Scalar (NonNegative t0) = Scalar t0 Source 
type Scalar (NonNegative t0) = Scalar t0 Source 
type Scalar (NonNegative t0) = Scalar t0 Source 
type Scalar (NonNegative t0) = Scalar t0 Source 
type Scalar (NonNegative t0) = Scalar t0 Source 
type Scalar (NonNegative t0) = Scalar t0 Source 
type Scalar (NonNegative t0) = Scalar t0 Source 
type Scalar (NonNegative t0) = Scalar t0 Source 
type Scalar (NonNegative t0) = Scalar t0 Source 
type Scalar (NonNegative t0) = Scalar t0 Source 
type Scalar (NonNegative t0) = Scalar t0 Source 
type Scalar (NonNegative t0) = Scalar t0 Source 
type Scalar (NonNegative t0) = Scalar t0 Source 
type Scalar (NonNegative t0) = Scalar t0 Source 
type Scalar (NonNegative t0) = Scalar t0 Source 
type Scalar (NonNegative t0) = Scalar t0 Source 
type Scalar (NonNegative t0) = Scalar t0 Source 
type Scalar (NonNegative t0) = Scalar t0 Source 
type Scalar (NonNegative t0) = Scalar t0 Source 
type Scalar (NonNegative t0) = Scalar t0 Source 
type Scalar (VedicSquare n0) = Scalar (Z n0) Source 
type Scalar (VedicSquare n0) = Scalar (Z n0) Source 
type Scalar (VedicSquare n0) = Scalar (Z n0) Source 
type Scalar (VedicSquare n0) = Scalar (Z n0) Source 
type Scalar (VedicSquare n0) = Scalar (Z n0) Source 
type Scalar (Ball v) = Scalar v Source 
type Scalar (Componentwise v) = Scalar v Source 
type Scalar (ZIndex a0) = Scalar (Z (Order a0)) Source 
type Scalar (ZIndex a0) = Scalar (Z (Order a0)) Source 
type Scalar (ZIndex a0) = Scalar (Z (Order a0)) Source 
type Scalar (ZIndex a0) = Scalar (Z (Order a0)) Source 
type Scalar (ZIndex a0) = Scalar (Z (Order a0)) Source 
type Scalar (ZIndex a0) = Scalar (Z (Order a0)) Source 
type Scalar (ZIndex a0) = Scalar (Z (Order a0)) Source 
type Scalar (BArray e) = Int Source 
type Scalar (UArray e) = Int Source 
type Scalar (Box v) = Scalar v Source 
type Scalar (Jaccard a0) = Scalar a0 Source 
type Scalar (Jaccard a0) = Scalar a0 Source 
type Scalar (Jaccard a0) = Scalar a0 Source 
type Scalar (Jaccard a0) = Scalar a0 Source 
type Scalar (Jaccard a0) = Scalar a0 Source 
type Scalar (Jaccard a0) = Scalar a0 Source 
type Scalar (Jaccard a0) = Scalar a0 Source 
type Scalar (Jaccard a0) = Scalar a0 Source 
type Scalar (Jaccard a0) = Scalar a0 Source 
type Scalar (Jaccard a0) = Scalar a0 Source 
type Scalar (Jaccard a0) = Scalar a0 Source 
type Scalar (Jaccard a0) = Scalar a0 Source 
type Scalar (Jaccard a0) = Scalar a0 Source 
type Scalar (Jaccard a0) = Scalar a0 Source 
type Scalar (Jaccard a0) = Scalar a0 Source 
type Scalar (Jaccard a0) = Scalar a0 Source 
type Scalar (Jaccard a0) = Scalar a0 Source 
type Scalar (Jaccard a0) = Scalar a0 Source 
type Scalar (Jaccard a0) = Scalar a0 Source 
type Scalar (Jaccard a0) = Scalar a0 Source 
type Scalar (Jaccard a0) = Scalar a0 Source 
type Scalar (Jaccard a0) = Scalar a0 Source 
type Scalar (Jaccard a0) = Scalar a0 Source 
type Scalar (Jaccard a0) = Scalar a0 Source 
type Scalar (Hamming a0) = Scalar a0 Source 
type Scalar (Hamming a0) = Scalar a0 Source 
type Scalar (Hamming a0) = Scalar a0 Source 
type Scalar (Hamming a0) = Scalar a0 Source 
type Scalar (Hamming a0) = Scalar a0 Source 
type Scalar (Hamming a0) = Scalar a0 Source 
type Scalar (Hamming a0) = Scalar a0 Source 
type Scalar (Hamming a0) = Scalar a0 Source 
type Scalar (Hamming a0) = Scalar a0 Source 
type Scalar (Hamming a0) = Scalar a0 Source 
type Scalar (Hamming a0) = Scalar a0 Source 
type Scalar (Hamming a0) = Scalar a0 Source 
type Scalar (Hamming a0) = Scalar a0 Source 
type Scalar (Hamming a0) = Scalar a0 Source 
type Scalar (Hamming a0) = Scalar a0 Source 
type Scalar (Hamming a0) = Scalar a0 Source 
type Scalar (Hamming a0) = Scalar a0 Source 
type Scalar (Hamming a0) = Scalar a0 Source 
type Scalar (Hamming a0) = Scalar a0 Source 
type Scalar (Hamming a0) = Scalar a0 Source 
type Scalar (Hamming a0) = Scalar a0 Source 
type Scalar (Hamming a0) = Scalar a0 Source 
type Scalar (Hamming a0) = Scalar a0 Source 
type Scalar (Hamming a0) = Scalar a0 Source 
type Scalar (Levenshtein a0) = Scalar a0 Source 
type Scalar (Levenshtein a0) = Scalar a0 Source 
type Scalar (Levenshtein a0) = Scalar a0 Source 
type Scalar (Levenshtein a0) = Scalar a0 Source 
type Scalar (Levenshtein a0) = Scalar a0 Source 
type Scalar (Levenshtein a0) = Scalar a0 Source 
type Scalar (Levenshtein a0) = Scalar a0 Source 
type Scalar (Levenshtein a0) = Scalar a0 Source 
type Scalar (Levenshtein a0) = Scalar a0 Source 
type Scalar (Levenshtein a0) = Scalar a0 Source 
type Scalar (Levenshtein a0) = Scalar a0 Source 
type Scalar (Levenshtein a0) = Scalar a0 Source 
type Scalar (Levenshtein a0) = Scalar a0 Source 
type Scalar (Levenshtein a0) = Scalar a0 Source 
type Scalar (Levenshtein a0) = Scalar a0 Source 
type Scalar (Levenshtein a0) = Scalar a0 Source 
type Scalar (Levenshtein a0) = Scalar a0 Source 
type Scalar (Levenshtein a0) = Scalar a0 Source 
type Scalar (Levenshtein a0) = Scalar a0 Source 
type Scalar (Levenshtein a0) = Scalar a0 Source 
type Scalar (Levenshtein a0) = Scalar a0 Source 
type Scalar (Levenshtein a0) = Scalar a0 Source 
type Scalar (Levenshtein a0) = Scalar a0 Source 
type Scalar (Levenshtein a0) = Scalar a0 Source 
type Scalar (Uncompensated s0) = Scalar s0 Source 
type Scalar (Uncompensated s0) = Scalar s0 Source 
type Scalar (Uncompensated s0) = Scalar s0 Source 
type Scalar (Uncompensated s0) = Scalar s0 Source 
type Scalar (Uncompensated s0) = Scalar s0 Source 
type Scalar (Uncompensated s0) = Scalar s0 Source 
type Scalar (Uncompensated s0) = Scalar s0 Source 
type Scalar (Uncompensated s0) = Scalar s0 Source 
type Scalar (Uncompensated s0) = Scalar s0 Source 
type Scalar (Uncompensated s0) = Scalar s0 Source 
type Scalar (Uncompensated s0) = Scalar s0 Source 
type Scalar (Uncompensated s0) = Scalar s0 Source 
type Scalar (Uncompensated s0) = Scalar s0 Source 
type Scalar (Uncompensated s0) = Scalar s0 Source 
type Scalar (Uncompensated s0) = Scalar s0 Source 
type Scalar (Uncompensated s0) = Scalar s0 Source 
type Scalar (Uncompensated s0) = Scalar s0 Source 
type Scalar (Lexical a0) = Scalar a0 Source 
type Scalar (Lexical a0) = Scalar a0 Source 
type Scalar (Lexical a0) = Scalar a0 Source 
type Scalar (Lexical a0) = Scalar a0 Source 
type Scalar (Lexical a0) = Scalar a0 Source 
type Scalar (Lexical a0) = Scalar a0 Source 
type Scalar (Lexical a0) = Scalar a0 Source 
type Scalar (Lexical a0) = Scalar a0 Source 
type Scalar (Lexical a0) = Scalar a0 Source 
type Scalar (Lexical a0) = Scalar a0 Source 
type Scalar (ComponentWise a0) = Scalar a0 Source 
type Scalar (ComponentWise a0) = Scalar a0 Source 
type Scalar (ComponentWise a0) = Scalar a0 Source 
type Scalar (ComponentWise a0) = Scalar a0 Source 
type Scalar (ComponentWise a0) = Scalar a0 Source 
type Scalar (ComponentWise a0) = Scalar a0 Source 
type Scalar (ComponentWise a0) = Scalar a0 Source 
type Scalar (ComponentWise a0) = Scalar a0 Source 
type Scalar (ComponentWise a0) = Scalar a0 Source 
type Scalar (ComponentWise a0) = Scalar a0 Source 
type Scalar (Goedel_ r0) = Scalar r0 Source 
type Scalar (Goedel_ r0) = Scalar r0 Source 
type Scalar (Goedel_ r0) = Scalar r0 Source 
type Scalar (Goedel_ r0) = Scalar r0 Source 
type Scalar (Boolean2Ring b0) = Scalar b0 Source 
type Scalar (Boolean2Ring b0) = Scalar b0 Source 
type Scalar (Boolean2Ring b0) = Scalar b0 Source 
type Scalar (Boolean2Ring b0) = Scalar b0 Source 
type Scalar (Boolean2Ring b0) = Scalar b0 Source 
type Scalar (Boolean2Ring b0) = Scalar b0 Source 
type Scalar (Boolean2Ring b0) = Scalar b0 Source 
type Scalar (Boolean2Ring b0) = Scalar b0 Source 
type Scalar (Boolean2Ring b0) = Scalar b0 Source 
type Scalar (Boolean2Ring b0) = Scalar b0 Source 
type Scalar (Boolean2Ring b0) = Scalar b0 Source 
type Scalar (Boolean2Ring b0) = Scalar b0 Source 
type Scalar (Seq a) = Int Source 
type Scalar (IntMap e) = Int Source 
type Scalar (IntMap' e) = Int Source 
type Scalar (Set a) = Int Source 
type Scalar (LexSet a) = Int Source 
type Scalar (ByteString b) = Int Source 
type Scalar (PartitionOnNewline a0) = Scalar a0 Source 
type Scalar (PartitionOnNewline a0) = Scalar a0 Source 
type Scalar (PartitionOnNewline a0) = Scalar a0 Source 
type Scalar (PartitionOnNewline a0) = Scalar a0 Source 
type Scalar (PartitionOnNewline a0) = Scalar a0 Source 
type Scalar (PartitionOnNewline a0) = Scalar a0 Source 
type Scalar (PartitionOnNewline a0) = Scalar a0 Source 
type Scalar (PartitionOnNewline a0) = Scalar a0 Source 
type Scalar (PartitionOnNewline a0) = Scalar a0 Source 
type Scalar (PartitionOnNewline a0) = Scalar a0 Source 
type Scalar (PartitionOnNewline a0) = Scalar a0 Source 
type Scalar (PartitionOnNewline a0) = Scalar a0 Source 
type Scalar (PartitionOnNewline a0) = Scalar a0 Source 
type Scalar (PartitionOnNewline a0) = Scalar a0 Source 
type Scalar (PartitionOnNewline a0) = Scalar a0 Source 
type Scalar (PartitionOnNewline a0) = Scalar a0 Source 
type Scalar (PartitionOnNewline a0) = Scalar a0 Source 
type Scalar (a -> b) = Scalar b Source 
type Scalar (a, b) = Scalar a Source 
type Scalar (Any cxt x) = Int Source 
type Scalar (Labeled' x y) = Scalar x Source 
type Scalar (Galois p0 k0) = Scalar (Z ((^) p0 k0)) Source 
type Scalar (Galois p0 k0) = Scalar (Z ((^) p0 k0)) Source 
type Scalar (Galois p0 k0) = Scalar (Z ((^) p0 k0)) Source 
type Scalar (Galois p0 k0) = Scalar (Z ((^) p0 k0)) Source 
type Scalar (Galois p0 k0) = Scalar (Z ((^) p0 k0)) Source 
type Scalar (Galois p0 k0) = Scalar (Z ((^) p0 k0)) Source 
type Scalar (Galois p0 k0) = Scalar (Z ((^) p0 k0)) Source 
type Scalar (Galois p0 k0) = Scalar (Z ((^) p0 k0)) Source 
type Scalar (Galois p0 k0) = Scalar (Z ((^) p0 k0)) Source 
type Scalar (Galois p0 k0) = Scalar (Z ((^) p0 k0)) Source 
type Scalar (Galois p0 k0) = Scalar (Z ((^) p0 k0)) Source 
type Scalar (Galois p0 k0) = Scalar (Z ((^) p0 k0)) Source 
type Scalar (Galois p0 k0) = Scalar (Z ((^) p0 k0)) Source 
type Scalar (Polynomial_ a b) = Scalar b Source 
type Scalar ((+>) a b) = Scalar b Source 
type Scalar (BloomFilter n a) = Int Source 
type Scalar (Map i e) = Int Source 
type Scalar (Map' i e) = Int Source 
type Scalar (a, b, c) = Scalar a Source 
type Scalar ((/) k a0 b0) = Scalar a0 Source 
type Scalar ((/) k a0 b0) = Scalar a0 Source 
type Scalar ((/) k a0 b0) = Scalar a0 Source 
type Scalar ((/) k a0 b0) = Scalar a0 Source 
type Scalar ((/) k a0 b0) = Scalar a0 Source 
type Scalar ((/) k a0 b0) = Scalar a0 Source 
type Scalar (SVector k n r) = Scalar r Source 
type Scalar (UVector k n r) = Scalar r Source 
type Scalar (a, b, c, d) = Scalar a Source 
type Scalar (HyperLogLog k k1 p a) = Integer Source 

type IsScalar r = (Ring r, Ord_ r, Scalar r ~ r, Normed r, ClassicalLogic r, r ~ (r >< r)) Source

A synonym that covers everything we intuitively thing scalar variables should have.

type HasScalar a = IsScalar (Scalar a) Source

A (sometimes) more convenient version of IsScalar.

type family a >< b :: * infixr 8 Source

Instances

type (><) * * Double Double = Double Source 
type (><) * * Float Float = Float Source 
type (><) * * Int Int = Int Source 
type (><) * * Integer Integer = Integer Source 
type (><) * * Rational Rational = Rational Source 
type (><) * * (Galois p k) Integer = Galois p k Source 
type (><) * * (Polynomial_ r r) r = Polynomial_ r r Source 
type (><) * k (a -> b) c = a -> (><) * k b c Source 
type (><) * k ((+>) a b) c Source 
type (><) * * (SVector k m a) b Source 
type (><) * k ((/) k1 a b) c = (/) k1 ((><) * k a c) b Source 
type (><) * k (UVector k1 n r) a = UVector k1 n ((><) * k r a) Source 

class (Cancellative m, HasScalar m, Rig (Scalar m)) => Cone m where Source

A Cone is an "almost linear" subspace of a module. Examples include the cone of positive real numbers and the cone of positive semidefinite matrices.

See <http://en.wikipedia.org/wiki/Cone_%28linear_algebra%29 wikipedia for more details.

FIXME: There are many possible laws for cones (as seen in the wikipedia article). I need to explicitly formulate them here. Intuitively, the laws should apply the module operations and then project back into the "closest point" in the cone.

FIXME: We're using the definition of a cone from linear algebra. This definition is closely related to the definition from topology. What is needed to ensure our definition generalizes to topological cones? See wikipedia and ncatlab for more details.

Methods

(*..) :: Scalar m -> m -> m infixl 7 Source

(..*..) :: m -> m -> m infixl 7 Source

class (Abelian v, Group v, HasScalar v, v ~ (v >< Scalar v)) => Module v where Source

Minimal complete definition

(.*) | (.*=)

Methods

(.*) :: v -> Scalar v -> v infixl 7 Source

Scalar multiplication.

(.*=) :: PrimBase m => Mutable m v -> Scalar v -> m () infixr 5 Source

Instances

law_Module_multiplication :: (Eq_ m, Module m) => m -> m -> Scalar m -> Logic m Source

law_Module_addition :: (Eq_ m, Module m) => m -> Scalar m -> Scalar m -> Logic m Source

law_Module_action :: (Eq_ m, Module m) => m -> Scalar m -> Scalar m -> Logic m Source

(*.) :: Module v => Scalar v -> v -> v infixl 7 Source

class Module v => FreeModule v where Source

Free modules have a basis. This means it makes sense to perform operations elementwise on the basis coefficients.

See wikipedia for more detail.

Minimal complete definition

ones, ((.*.) | (.*.=))

Methods

(.*.) :: v -> v -> v infixl 7 Source

Multiplication of the components pointwise. For matrices, this is commonly called Hadamard multiplication.

See wikipedia for more detail.

FIXME: This is only valid for modules with a basis.

(.*.=) :: PrimBase m => Mutable m v -> v -> m () infixr 5 Source

ones :: v Source

The identity for Hadamard multiplication. Intuitively, this object has the value "one" in every column.

law_FreeModule_associative :: (Eq_ m, FreeModule m) => m -> m -> m -> Logic m Source

class (FreeModule v, IxContainer v, Elem v ~ Scalar v, Index v ~ Int, v ~ SetElem v (Elem v)) => FiniteModule v where Source

If our FreeModule has a finite basis, then we can:

  • index into the modules basis coefficients
  • provide a dense construction method that's a bit more convenient than "fromIxList".

Methods

dim :: v -> Int Source

Returns the dimension of the object. For some objects, this may be known statically, and so the parameter will not be "seq"ed. But for others, this may not be known statically, and so the parameter will be "seq"ed.

unsafeToModule :: [Scalar v] -> v Source

class (FreeModule v, Field (Scalar v)) => VectorSpace v where Source

Minimal complete definition

(./.) | (./.=)

Methods

(./) :: v -> Scalar v -> v infixl 7 Source

(./.) :: v -> v -> v infixl 7 Source

(./=) :: PrimBase m => Mutable m v -> Scalar v -> m () infixr 5 Source

(./.=) :: PrimBase m => Mutable m v -> v -> m () infixr 5 Source

class (VectorSpace v, Normed v, Metric v) => Banach v where Source

A Banach space is a Vector Space equipped with a compatible Norm and Metric.

See wikipedia for more details.

Minimal complete definition

Nothing

Methods

normalize :: v -> v Source

Instances

Banach Double Source 
Banach Float Source 
Banach Rational Source 
(KnownNat n, VectorSpace r, ValidSVector Nat n r, IsScalar r, ExpField r, Real r, ValidSVector Nat n r, ValidSVector Symbol "dyn" r) => Banach (SVector Nat n r) Source 
(VectorSpace r, ValidSVector Symbol n r, IsScalar r, ExpField r, Real r) => Banach (SVector Symbol n r) Source 

class (Banach v, TensorAlgebra v, Real (Scalar v), OrdField (Scalar v)) => Hilbert v where Source

Hilbert spaces are a natural generalization of Euclidean space that allows for infinite dimension.

See wikipedia for more details.

FIXME: The result of a dot product must always be an ordered field. This is true even when the Hilbert space is over a non-ordered field like the complex numbers. But the OrdField constraint currently prevents us from doing scalar multiplication on Complex Hilbert spaces. See http://math.stackexchange.com/questions/49348/inner-product-spaces-over-finite-fields and http://math.stackexchange.com/questions/47916/banach-spaces-over-fields-other-than-mathbbc for some technical details.

Methods

(<>) :: v -> v -> Scalar v infix 8 Source

Instances

Hilbert Double Source 
Hilbert Float Source 
(KnownNat n, VectorSpace r, ValidSVector Nat n r, IsScalar r, ExpField r, Real r, OrdField r, MatrixField r, ValidSVector Nat n r, ValidSVector Symbol "dyn" r) => Hilbert (SVector Nat n r) Source 
(VectorSpace r, ValidSVector Symbol n r, IsScalar r, ExpField r, Real r, OrdField r, MatrixField r) => Hilbert (SVector Symbol n r) Source 

class (VectorSpace v, VectorSpace (v >< v), Scalar (v >< v) ~ Scalar v, Normed (v >< v), Field (v >< v)) => TensorAlgebra v where Source

Tensor algebras generalize the outer product of vectors to construct a matrix.

See wikipedia for details.

FIXME: This needs to be replaced by the Tensor product in the Monoidal category Vect

Methods

(><) :: v -> v -> v >< v infixr 8 Source

Take the tensor product of two vectors

vXm :: v -> (v >< v) -> v Source

"left multiplication" of a square matrix

mXv :: (v >< v) -> v -> v Source

"right multiplication" of a square matrix

Spatial programming

data Any cxt x where Source

Constructors

Any :: forall cxt x xs. (cxt xs, Elem xs ~ x) => xs -> Any cxt x 

type All cxt x = forall xs. (cxt xs, Elem xs ~ x) => xs Source

The type of all containers satisfying the cxt constraint with elements of type x.

Helper functions

simpleMutableDefn Source

Arguments

:: (Eq_ a, IsMutable a) 
=> (Mutable (ST s) a -> b -> ST s ())

mutable function

-> (a -> b -> a)

create a mutable function using "immutable2mutable"

-> a -> b -> Logic a

the output property

Creates a quickcheck property for a simple mutable operator defined using "immutable2mutable"