.direnv | ||
src/Data | ||
.envrc | ||
.gitignore | ||
CHANGELOG.md | ||
flake.lock | ||
flake.nix | ||
lattice.cabal | ||
LICENSE | ||
README.md |
What?
this adds a class of types you can perform boolean operations on
the simplest example is Bool
itself:
False || False = False
_ || _ = True
Why?
very frequently i need to redefine the basic boolean operations exported by Prelude
a one simple example of this is the involvement of predicates
takeWhile (isAlphaNum || (== '_') || (== '-'))
takeWhile (\x -> isAlphaNum x || x == '_' || x == '-')
this doesnt look like too sizeable of a difference, but once you give the variable an even slightly more descriptive name, and start stacking up other predicates, you'll be very happy to skip it entirely
so this library exists to allow me to Not redefine the boolean operations exported by Prelude
over and over and over and over and over again
additionally, the library adds other useful combinators. the least interesting of these are the implication -*
and exclusion </
, which exist more for readability than anything
the two more interesting combinators are the (in)equality operators, =*=
and =/=
, which respectively produce the corresponding truth values when comparing two of the same or two different elements
How?
recommended usage is to import Prelude
hiding the (||)
, (&&)
, and any additional boolean functions, and add Data.Lattice
to your list of imports
if youre making an alternative prelude (or you work on base, god help you), feel free to include this library or copy-paste this code
i literally do not care lmao the license only exists cause cabal wouldnt let me not choose one, the fuckers