Eq a => a -> a -> [a] -> [a]
Replaces all instances of a value in a list by another value.
> { if e1 then e2 else e3 }
bounded arithmetic sequence, with first two elements given
if exp then exp else exp
O(m+n) Replace every occurrence of one substring with another.
In (unlikely) bad cases, this function's time complexity degrades towards O(n*m).
postRequestWithBody urlString typ body is convenience constructor for POST Requests. It constructs a request and sets the body as well as the Content-Type and Content-Length headers. The contents of the body are forced to calculate the value for the Content-Length header. If urlString isn't a syntactically valid URL, the function raises an error.
O(min(n,W)). The expression (findWithDefault def k map) returns the value at key k or returns def when the key is not an element of the map.
> findWithDefault 'x' 1 (fromList [(5,'a'), (3,'b')]) == 'x'
> findWithDefault 'x' 5 (fromList [(5,'a'), (3,'b')]) == 'a'
readProcess forks an external process, reads its standard output strictly, blocking until the process terminates, and returns the output string.
Output is returned strictly, so this is not suitable for interactive applications.
This function throws an IOError if the process ExitCode is anything other than ExitSuccess.
Users of this function should compile with -threaded if they want other Haskell threads to keep running while waiting on the result of readProcess.
> > readProcess "date" [] []
> "Thu Feb 7 10:03:39 PST 2008\n"
The arguments are:
* The command to run, which must be in the $PATH, or an absolute path
* A list of separate command line arguments to the program
* A string to pass on the standard input to the program.
> {x + y} or {(x+)} or {(+ x)} or {(+)}
It's a bit gruesome to use an Exp as the operator, but how else can we distinguish constructors from non-constructors? Maybe there should be a var-or-con type? Or maybe we should leave it to the String itself?
The zipWith3 function takes a function which combines three elements, as well as three lists and returns a list of their point-wise combination, analogous to zipWith.
The zipWith4 function takes a function which combines four elements, as well as four lists and returns a list of their point-wise combination, analogous to zipWith.
Lift a ternary function to actions.
Promote a function to a monad, scanning the monadic arguments from left to right (cf. liftM2).
Promote a function to a monad, scanning the monadic arguments from left to right (cf. liftM2).