and
and returns the conjunction of a Boolean list. For the result to be True, the list must be finite; False, however, results from a False value at a finite index of a finite or infinite list.
and returns the conjunction of a container of Bools. For the result to be True, the container must be finite; False, however, results from a False value finitely far from the left end.
Haskell defines operations to read and write characters from and to files, represented by values of type Handle. Each value of this type is a handle: a record used by the Haskell run-time system to manage I/O with file system objects. A handle has at least the following properties:
* whether it manages input or output or both;
* whether it is open, closed or semi-closed;
* whether the object is seekable;
* whether buffering is disabled, or enabled on a line or block basis;
* a buffer (whose length may be zero).
Most handles will also have a current I/O position indicating the next input or output operation will occur. A handle is readable if it manages only input or both input and output; likewise, it is writable if it manages only output or both input and output. A handle is open when first allocated. Once it is closed it can no longer be used for either input or output, though an implementation cannot re-use its storage while references remain to it. Handles are in the Show and Eq classes. The string produced by showing a handle is system dependent; it should include enough information to identify the handle for debugging. A handle is equal according to == only to itself; no attempt is made to compare the internal state of different handles for equality.
A version of catch with the arguments swapped around; useful in situations
> do handle (\e -> exitWith (ExitFailure 1)) $
> ...
A version of catch with the arguments swapped around; useful in situations
> do handle (\NonTermination -> exitWith (ExitFailure 1)) $
> ...
The mapAndUnzipM function maps its first argument over a list, returning the result as a pair of lists. This function is mainly used with complicated data structures or a state-transforming monad.
This is a psuedo-random number generator (PRNG). It is designed to replace the standard Haskell '98 PRNG from the random package. It has the following properties:
* Nicer API than random. (Supports all sizes of Int and Word, for example.)
* Much faster than random. (In my tests, roughly 14x faster.)
* Comparable quality to random. (Both libraries pass the "Die Harder" suite of statistical randomness tests. In other words, neither has any overly obvious pattern to the "random" numbers it produces. Both libraries pass Die Harder with similar scores.)
* 100% Haskell '98 code. No compiler-specific features. No external dependencies. Builds everywhere.
* Pure functions and simple ADTs. No mutable state, no IO monad. Simple API.
The actual algorithm is a lag-4 Multiply With Carry (MWC) generator, using 32-bit arithmetic. (Should be fast on 32-bit and 64-bit platforms.) If my algebra is correct, its period should be roughly 1.46 * 10^48. (By constrast, random claims to have a period of only 2.30 * 10^18.)
Note that this algorithm, by itself, is not cryptographically secure.
Changes:
* Initial release.
Version 0.1
Show more results