B
The Bounded class is used to name the upper and lower limits of a type. Ord is not a superclass of Bounded since types that are not totally ordered may also have upper and lower bounds.
The Bounded class may be derived for any enumeration type; minBound is the first constructor listed in the data declaration and maxBound is the last. Bounded may also be derived for single-constructor datatypes whose constituent types are in Bounded.
break, applied to a predicate p and a list xs, returns a tuple (possibly empty) of xs of elements that do not satisfy p and second element is the remainder of the list:
> break (> 3) [1,2,3,4,1,2,3,4] == ([1,2,3],[4,1,2,3,4])
> break (< 9) [1,2,3] == ([],[1,2,3])
> break (> 9) [1,2,3] == ([1,2,3],[])
break p is equivalent to span (not . p).
between open close p parses open, followed by p and finally close. Only the value of p is returned.
Note: this function is deprecated, please use mask instead.
Applying block to a computation will execute that computation with asynchronous exceptions blocked. That is, any thread which attempts to raise an exception in the current thread with Control.Exception.throwTo will be blocked until asynchronous exceptions are unblocked again. There's no need to worry about re-enabling asynchronous exceptions; that is done automatically on exiting the scope of block.
Threads created by Control.Concurrent.forkIO inherit the blocked state from the parent; that is, to start a thread in blocked mode, use block $ forkIO .... This is particularly useful if you need to establish an exception handler in the forked thread before any asynchronous exceptions are received.
block-buffering should be enabled if possible. The size of the buffer is n items if the argument is Just n and is otherwise implementation-dependent.
returns True if asynchronous exceptions are blocked in the current thread.
The current thread was waiting to retry an atomic memory transaction that could never become possible to complete because there are no other threads referring to any of the TVars involved.
The thread is blocked on an MVar, but there are no other references to the MVar so it can't ever continue.
The thread is waiting to retry an STM transaction, but there are no other references to any TVars involved, so it can't ever continue.
The current thread was executing a call to Control.Concurrent.MVar.takeMVar that could never return, because there are no other references to this MVar.
When you want to acquire a resource, do some work with it, and then release the resource, it is a good idea to use bracket, because bracket will install the necessary exception handler to release the resource in the event that an exception is raised during the computation. If an exception is raised, then bracket will re-raise the exception (after performing the release).
A common example is opening a file:
> bracket
> (openFile "filename" ReadMode)
> (hClose)
> (\fileHandle -> do { ... })
The arguments to bracket are in this order so that we can partially apply it, e.g.:
> withFile name mode = bracket (openFile name mode) hClose
When you want to acquire a resource, do some work with it, and then release the resource, it is a good idea to use bracket, because bracket will install the necessary exception handler to release the resource in the event that an exception is raised during the computation. If an exception is raised, then bracket will re-raise the exception (after performing the release).
A common example is opening a file:
> bracket
> (openFile "filename" ReadMode)
> (hClose)
> (\handle -> do { ... })
The arguments to bracket are in this order so that we can partially apply it, e.g.:
> withFile name mode = bracket (openFile name mode) hClose
A variant of bracket computation is not required.
Like bracket, but only performs the final action if there was an exception raised by the in-between computation.
Show more results