Elm Exactly

Basis entryBasics.neq

A value of Basics. Its type is in Section C.3 Basics.

Static basis

op stands for ↦ OTSTAT(op)==, /= eq, neq ↦ (∀a. a→a→Bool,v)\begin{array}{|clcl|}\hline \opv {\ }& \text{stands for} {\ }& \mapsto {\ }& \OTstat(\opv)\\\hline \kw{==},\ \kw{/=} {\ }& \href{/standard/basis/Basics/eq}{\kw{eq}},\ \href{/standard/basis/Basics/neq}{\kw{neq}} {\ }& \mapsto {\ }& (\forall\mv{a}.\,\mv{a} \rightarrow \mv{a} \rightarrow \tBool, \isv)\\\hline\end{array}
Figure 40: The Static Operator Table, OTSTAT\OTstat

Dynamic basis

opstands for ↦ OTDYN(op)arity==, /=eq, neq ↦ basic value2\begin{array}{|clclc|}\hline \opv {\quad}& \text{stands for} {\ }& \mapsto {\ }& \OTdyn(\opv) {\qquad}& \arity\\\hline \kw{==},\ \kw{/=} {\quad}& \href{/standard/basis/Basics/eq}{\kw{eq}},\ \href{/standard/basis/Basics/neq}{\kw{neq}} {\ }& \mapsto {\ }& \text{basic value} {\qquad}& 2\\\hline\end{array}
Figure 46: The Dynamic Operator Table, OTDYN\OTdyn

Its APPLY

APPLY(neq,v,v′)={True∣False∈Eq(v,v′)}∪{False∣True∈Eq(v,v′)}.\begin{array}{rcl} \APPLY(\kw{neq},v,v') &=& \{\kw{True}\mid\kw{False}\in\dbEq(v,v')\}\\ &&{}\cup\{\kw{False}\mid\kw{True}\in\dbEq(v,v')\}. \end{array}
Read it in its chapter·Permanent address: /standard/basis/Basics/neq

Tests (14)

  • elm / ArrayEqualityFlagsTest
    Two arrays are equal under `==` when they hold equal elements in the same order: arrays received as flags are compared, with the same elements, a different element, and a different length.
  • elm / DeepEqualityTest
    `==` and `/=` give the exact answer on values nested more than 100 levels deep.
  • elm / FloatEdgeTest
    Float edge cases: `round` on halves, NaN in equality, `min` and `compare`, `truncate` of NaN, and an Int power beyond 2^32.
  • elm-core / EqBoxedFastPathTest
    Structural equality gives the correct answer for strings, lists, tuples, records, custom types, unit, empty values, `Bool` and nested containers, through both `==` and `/=`.
  • elm-core / EqualityBoolIfTest
    The result of `==` and `/=` on `Bool` operands drives an `if` expression correctly.
  • elm-core / EqualityBoolTest
    `==` and `/=` on `Bool` literals give the correct answer for all four combinations of operands.
  • elm-core / EqualityTest
    `==` and `/=` give the right answer on `Int` literals, and `==` is `True` for two equal `List Int` literals.
  • elm-core / FloatCompareTest
    `<`, `>`, `<=`, `>=`, `==` and `/=` on `Float` literals, each in a case where the comparison is `True`.
  • elm-core / IntCompareTest
    Checks that the six comparison operators `<`, `>`, `<=`, `>=`, `==` and `/=` give `True` on Int literals.
  • elm-core / NotEqualBoolIfTest
    The result of `/=` on two `Bool` literals is used as the condition of an `if`, for all four combinations of operands; each logs `"yes"` exactly when the operands differ.
  • elm-core / NotEqualBoolMaybeTest
    `/=` on `Maybe Bool` values gives the right answer for `Just True`, `Just False` and `Nothing`, compared in seven pairings: each value with itself, the two `Just`s both ways round, and `Nothing` with `Just True` on either side.
  • elm-core / NotEqualBoolRecordTest
    `/=` on records of type `{ flag : Bool }` gives the right answer for all four combinations of a record holding `True` and one holding `False`.
  • elm-core / NotEqualBoolTest
    `/=` gives the right answer on all four combinations of `Bool` literals, and so does `not` applied to each of those results.
  • elm-core / NotEqualBoolVarTest
    `/=` gives the right answer on `Bool` values held in `let`-bound variables, and inside a top-level helper `neqBool` that receives both operands as arguments, for all four combinations of operands.

Discussions

Discuss this basis entry·Search the discussions on GitHub

Discussions are on GitHub; one about this basis entry has [b:Basics.neq] in its title.

A Standard Definition of Elm? (Draft version 0.4) © Rupert Smith. The text is licensed under CC BY 4.0: share and adapt it freely, with credit and a link to the licence.