IZ      !"#$% & '( ) * + , - . /0 1 2 3 456789: ; <=>? @ABC DE FG HIJKLMNOPQRSTUV W XYZ[\]^_`abcdef ghijklmnopqrstuvwxyz{|}~   !""""""""""""                      #$ !"#$%&'()*+,-./0123456789:;<=%>?@ABCD&EF&GHIJKLM#N#O'P'Q'RSTUVWXYZ[\(])^)_)`)a)b)c)d)e)f*g*h*i*j*k*l*m*n*o*p*q*r*s*t*u*v*w*x*y*z*{|}~%%%++++,,,,-----------------------------------......................../////////////////%0011     %%%%%%%%%%%%% !"#$%&'()2*2+2,2-2.2/202122232425262728292:2;2<2=2>2?2@2A2B2C2D2E2F3G3H3I3J3K3L3M3N3O4P4Q4R4S4T4U4V4W4X4Y4Z4[4\4]4^4_4`4a4b4c4d4e4f4g4h4i4j4k4l4m4n4o4p4q4r4s4t4u4v4w4x4y4z4{4|4}4~444444     $$$$$$5 5!5"5#5$5%5&5'5(6)5*5+7,7-8.8/808182838456789:;9<9=9>9?,@,A,B:C:D:E:F:G:H:I:J:K:L:M:N:O:P:Q:R:S:T:U:V:W:X:Y:Z:[:\:]:^:_;`;a;b;c;d;e;f;g;h;i;j;k;l m5n5o5p5q5r<s=t=u=v=w=x=y=z={=|=}=~=============================>>>>>>>>>>>>>>>>>>>>???@@@@@@@@@@@AAAAAAAAAAAAAAAA&BBBCCCCCCCCCDDDDDDDDDEEEEEEEFFFFGGGGGGGGGG G G H H HHHHHHHHHHIIIIIIAJK K!K"K#K$K%K&K'K(K)L*L+L,L-L.L/L0L1L2L3L4L5L6L7L8L9L:L;L<L=M>M?M@MAMBMCMDNENFNGNHNINJNKNLNMNNNONPNQNRNSNTNUNVNWNXNYNZN[N\N]N^N_N`NaObOcOdOeOfOgOhOiOjOkOlOmOnOoOpOqOrOsOtOuOvOwOxOyOzO{O|O}O~OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOPPPPPPPPPPPPPPPQ<RRRRRRRRRRRRRRRRSRSSSSRR S R S R RRRSSSRRRRRSRRRRRR R!R"R#R$R%R&R'R(T)T*R+R,R-R./0123456789:;<=>?@ABCDEFGHIJ)K)L)M)N)OUPUQURUS'T&U&V&W&X&Y&Z&[&\&]&^&_&`&a&b&c&d&e&f&g&h&i&j&k&l&m&n&o&p&q&r&s&t&u&v&w&x&y&z&{&|&}V~VVVWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW11XXX?????????????????AAAYYYYYYYYYYYYYYYYYYYYYYRRRRSRAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA J J J J JJJJJ !"#$%&'(Z)Z*Z+Z,Z-Z.Z/Z0Z1Z2Z3Z4Z5Z6Z7Z8Z9Z:Z;Z<Z=Z>Z?Z@ZAZBZCZDZEZFZGZHZIZJZKZLZMZNZOZPZQZRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ [ [ [ [ [[[[[[[[[[[[[[[[[[[ [!["[#[$[%[&['[([)[*[+[,[-[.[/[0[1[2[3[4[5[6[7[8[9[:[;[<[=[>[?[@[A[B[C[D[E[F[G[H[I[J[K[L[M[N[O[P[Q[R[S[T[U[V[W[X[Y[Z[[[\[][^[_[`[a[b[c[d[e[f[g[h[i[j[k[l[m[n[o[p[q[r[s[t[u[v[w[x[y[z[{[|[}[~\\\\\]^^^^^^^^^^^^^_______`````````````````````aaa!bbbbbbbbbccccddddeeeeeeeSSSSSSSSSfgg                         hhhiiiiiijj      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJkKkLlMlNlOlPlQlRlSlTlUlVmWmXmYmZm[m\m]m^m_m`mambmcmdmemfmgmhmimjmkl+mnnnonpnqorosotouovowpxpypzp{p|p}p~ppppppqqrrrrrrBBBsssstuuu999vvvvvv portable experimentallibraries@haskell.orgUnsafew Trustworthyxnon-portable (GHC extensions)internalcvs-ghc@haskell.orgUnsafe'A list producer that can be fused with .  This function is merely   augment g xs = g (:) xs but GHC'6s simplifier will transform an expression of the form   k z ( g xs)%, which may arise after inlining, to  g k ( k z xs)/, which avoids producing an intermediate list. Append two lists, i.e.,  > [x1, ..., xm] ++ [y1, ..., yn] == [x1, ..., xm, y1, ..., yn] 6 [x1, ..., xm] ++ [y1, ...] == [x1, ..., xm, y1, ...] ?If the first list is not finite, the result is the first list. 'A list producer that can be fused with .  This function is merely   build g = g (:) [] but GHC'6s simplifier will transform an expression of the form   k z ( g)%, which may arise after inlining, to g k z, . which avoids producing an intermediate list. <, applied to a binary operator, a starting value (typically C the right-identity of the operator), and a list, reduces the list 0 using the binary operator, from right to left: B foldr f z [x1, x2, ..., xn] == x1 `f` (x2 `f` ... (xn `f` z)...)  is defined as the value {. It helps to make  guards more readable. eg.  f x | x < 0 = ...  | otherwise = ... #If the first argument evaluates to {, then the result is the  second argument. Otherwise an AssertionFailed exception is raised,  containing a u- with the source file and line number of the  call to . AAssertions can normally be turned on or off with a compiler flag H (for GHC, assertions are normally on unless optimisation is turned on  with -O or the -fignore-asserts > option is given). When assertions are turned off, the first  argument to ( is ignored, and the second argument is  returned as the result.  The call '(lazy e)' means the same as e, but  has a A magical strictness property: it is lazy in its first argument, & even though its semantics is strict.  f xs" is the list obtained by applying f to each element  of xs, i.e., 4 map f [x1, x2, ..., xn] == [f x1, f x2, ..., f xn] * map f [x1, x2, ...] == [f x1, f x2, ...] BApplication operator. This operator is redundant, since ordinary  application (f x) means the same as (f  x) . However,  has C low, right-associative binding precedence, so it sometimes allows ) parentheses to be omitted; for example:  ! f $ g $ h x = f (g (h x)) 6It is also useful in higher-order situations, such as  ( 0) xs,  or y () fs xs. (8Fail with a message. This operation is not part of the E mathematical definition of a monad, but is invoked on pattern-match  failure in a do expression. )=Sequentially compose two actions, passing any value produced , by the first as an argument to the second. *@Sequentially compose two actions, discarding any value produced A by the first, like sequencing operators (such as the semicolon)  in imperative languages. ,&Inject a value into the monadic type. CThe C+ class defines the basic operations over a monad, 0a concept from a branch of mathematics known as category theory. EFrom the perspective of a Haskell programmer, however, it is best to think of a monad as an abstract datatype of actions. Haskell's do5 expressions provide a convenient syntax for writing monadic expressions. Minimal complete definition: ) and ,.  Instances of C$ should satisfy the following laws:   return a >>= k == k a  m >>= return == m . m >>= (\x -> k x >>= h) == (m >>= k) >>= h Instances of both C and E& should additionally satisfy the law:  " fmap f xs == xs >>= return . f The instances of C for lists, "z and { defined in the Prelude satisfy these laws. EThe E2 class is used for types that can be mapped over.  Instances of E$ should satisfy the following laws:   fmap id == id # fmap (f . g) == fmap f . fmap g The instances of E for lists, "z and { satisfy these laws. uA uB is a list of characters. String constants in Haskell are values  of type u. 8Replace all locations in the input with the same value.  The default definition is + . , but this may be + overridden with a more efficient version. The | method restricted to the type }. The ~ method restricted to the type }. Identity function. Constant function. Function composition.  f9 takes its (first) two arguments in the reverse order of f.  p f yields the result of applying f until p holds. ! is a type-restricted version of . It is usually E used as an infix operator, and its typing forces its first argument D (which is usually overloaded) to have the same type as the second. 8Shift the argument left by the specified number of bits  (which must be non-negative). 9Shift the argument right by the specified number of bits  (which must be non-negative). 8Shift the argument left by the specified number of bits  (which must be non-negative). BShift the argument right (signed) by the specified number of bits  (which must be non-negative). DShift the argument right (unsigned) by the specified number of bits  (which must be non-negative). >()*+,CEu%&()*+,?CEG\]^_`fiktuvwxyz{~                           ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~                            ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ?7C)*,(E+unon-portable (GHC Extensions)internalcvs-ghc@haskell.org TrustworthyConversion from an e. ? An integer literal represents the application of the function  " to the appropriate value of type e,  so such literals have type (F a) => a. 'Unary negation. FBasic numeric class. (Minimal complete definition: all except ' or (-) Absolute value. Sign of a number.  The functions  and  should satisfy the law:   abs x * signum x == x For real numbers, the  is either -1 (negative), 0 (zero)  or 1 (positive).  the same as  (). Because -. is treated specially in the Haskell grammar,  (- e): is not a section, but an application of prefix negation.  However, ( exp)* is equivalent to the disallowed section. 'F @ A B C. D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b'Fe c d e @ AF' @ A B Cportable experimentallibraries@haskell.org Trustworthy'Extract the first component of a pair. (Extract the second component of a pair. 7 converts an uncurried function to a curried function. 5 converts a curried function to a function on pairs. Swap the components of a pair. "portablestablelibraries@haskell.org Trustworthy The 7 type encapsulates an optional value. A value of type   a! either contains a value of type a (represented as  a),  or it is empty (represented as  ). Using  is a good way to D deal with errors or exceptional cases without resorting to drastic  measures such as . The 5 type is also a monad. It is a simple kind of error , monad, where all errors are represented by  . A richer $ error monad can be built using the  type. The 3 function takes a default value, a function, and a   value. If the  value is , the function returns the H default value. Otherwise, it applies the function to the value inside  the  and returns the result. The  function returns { iff its argument is of the  form Just _. The  function returns { iff its argument is . The ( function extracts the element out of a  and $ throws an error if its argument is . The ( function takes a default value and and   value. If the  is !, it returns the default values; 2 otherwise, it returns the value contained in the . The + function returns an empty list when given  $ or a singleton list when not given . The  function returns  on an empty list  or  a where a# is the first element of the list. The  function takes a list of s and returns  a list of all the  values. The  function is a version of  which can throw ? out elements. In particular, the functional argument returns  something of type  b. If this is  , no element - is added on to the result list. If it just  b, then b is  included in the result list.  f g  f gnon-portable (GHC Extensions)internalcvs-ghc@haskell.org Trustworthy)Concatenate a list of lists. 9, applied to a predicate and a list, returns the list of 2 those elements that satisfy the predicate; i.e., # filter p xs = [ x | x <- xs, p x] < takes two lists and returns a list of corresponding pairs. D If one input list is short, excess elements of the longer list are  discarded. >Extract the first element of a list, which must be non-empty. HExtract the elements after the head of a list, which must be non-empty. HExtract the last element of a list, which must be finite and non-empty. 7Return all the elements of a list except the last one.  The list must be non-empty. Test whether a list is empty. O(n). + returns the length of a finite list as an `. ' It is an instance of the more general , 5 the result type of which may be any kind of number. <, applied to a binary operator, a starting value (typically B the left-identity of the operator), and a list, reduces the list 0 using the binary operator, from left to right:  G foldl f z [x1, x2, ..., xn] == (...((z `f` x1) `f` x2) `f`...) `f` xn The list must be finite.  is similar to #, but returns a list of successive  reduced values from the left:  B scanl f z [x1, x2, ...] == [z, z `f` x1, (z `f` x1) `f` x2, ...]  Note that & last (scanl f z xs) == foldl f z xs.  is a variant of & that has no starting value argument: 0 scanl1 f [x1, x2, ...] == [x1, x1 `f` x2, ...]  is a variant of & that has no starting value argument, . and thus must be applied to non-empty lists.  is the right-to-left dual of .  Note that & head (scanr f z xs) == foldr f z xs.  is a variant of & that has no starting value argument.  f x3 returns an infinite list of repeated applications  of f to x: ' iterate f x == [x, f x, f (f x), ...]  x is an infinite list, with x the value of every element.  n x is a list of length n with x the value of  every element. ' It is an instance of the more general ,  in which n may be of any integral type. : ties a finite list into a circular one, or equivalently, C the infinite repetition of the original list. It is the identity  on infinite lists. , applied to a predicate p and a list xs, returns the $ longest prefix (possibly empty) of xs of elements that satisfy p: , takeWhile (< 3) [1,2,3,4,1,2,3,4] == [1,2] $ takeWhile (< 9) [1,2,3] == [1,2,3]  takeWhile (< 0) [1,2,3] == []  p xs$ returns the suffix remaining after  p xs: 4 dropWhile (< 3) [1,2,3,4,5,1,2,3] == [3,4,5,1,2,3]  dropWhile (< 9) [1,2,3] == [] $ dropWhile (< 0) [1,2,3] == [1,2,3]  n, applied to a list xs, returns the prefix of xs  of length n, or xs itself if n >  xs:  " take 5 "Hello World!" == "Hello"  take 3 [1,2,3,4,5] == [1,2,3]  take 3 [1,2] == [1,2]  take 3 [] == []  take (-1) [1,2] == []  take 0 [1,2] == [] &It is an instance of the more general ,  in which n may be of any integral type.  n xs returns the suffix of xs  after the first n elements, or [] if n >  xs:  # drop 6 "Hello World!" == "World!"  drop 3 [1,2,3,4,5] == [4,5]  drop 3 [1,2] == []  drop 3 [] == []  drop (-1) [1,2] == [1,2]  drop 0 [1,2] == [1,2] &It is an instance of the more general ,  in which n may be of any integral type.  n xs( returns a tuple where first element is xs prefix of  length n2 and second element is the remainder of the list:  1 splitAt 6 "Hello World!" == ("Hello ","World!") * splitAt 3 [1,2,3,4,5] == ([1,2,3],[4,5]) " splitAt 1 [1,2,3] == ([1],[2,3]) # splitAt 3 [1,2,3] == ([1,2,3],[]) # splitAt 4 [1,2,3] == ([1,2,3],[]) # splitAt 0 [1,2,3] == ([],[1,2,3]) & splitAt (-1) [1,2,3] == ([],[1,2,3]) It is equivalent to ( n xs,  n xs) when n is not _|_  (splitAt _|_ xs = _|_).  $ is an instance of the more general ,  in which n may be of any integral type. , applied to a predicate p and a list xs, returns a tuple where 5 first element is longest prefix (possibly empty) of xs of elements that  satisfy p2 and second element is the remainder of the list:  7 span (< 3) [1,2,3,4,1,2,3,4] == ([1,2],[3,4,1,2,3,4]) $ span (< 9) [1,2,3] == ([1,2,3],[]) $ span (< 0) [1,2,3] == ([],[1,2,3])  p xs is equivalent to ( p xs,  p xs) , applied to a predicate p and a list xs, returns a tuple where 5 first element is longest prefix (possibly empty) of xs of elements that  do not satisfy p2 and second element is the remainder of the list:  8 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],[])  p is equivalent to  ( . p).  xs returns the elements of xs in reverse order.  xs must be finite. B returns the conjunction of a Boolean list. For the result to be  {, the list must be finite; x, however, results from a x 7 value at a finite index of a finite or infinite list. B returns the disjunction of a Boolean list. For the result to be  x, the list must be finite; {, however, results from a { 7 value at a finite index of a finite or infinite list. #Applied to a predicate and a list,  determines if any element < of the list satisfies the predicate. For the result to be  x, the list must be finite; {, however, results from a { _ value for the predicate applied to an element at a finite index of a finite or infinite list. #Applied to a predicate and a list,  determines if all elements 9 of the list satisfy the predicate. For the result to be  {, the list must be finite; x, however, results from a x _ value for the predicate applied to an element at a finite index of a finite or infinite list. B is the list membership predicate, usually written in infix form,  e.g., x `elem` xs. For the result to be  x, the list must be finite; {,, however, results from an element equal to x7 found at a finite index of a finite or infinite list.  is the negation of .   key assocs( looks up a key in an association list. 8Map a function over a list and concatenate the results. 2List index (subscript) operator, starting from 0. ' It is an instance of the more general , , which takes an index of any integral type. ? takes three lists and returns a list of triples, analogous to  .  generalises $ by zipping with the function given 7 as the first argument, instead of a tupling function.  For example,  (+)( is applied to two lists to produce the  list of corresponding sums. The 0 function takes a function which combines three I elements, as well as three lists and returns a list of their point-wise  combination, analogous to . < transforms a list of pairs into a list of first components " and a list of second components. The 4 function takes a list of triples and returns three  lists, analogous to . ; h i j k l m n o p q r s t u v w x y. q x; h i j k l m n o p q r s t u v w x ynon-portable (GHC Extensions)internalcvs-ghc@haskell.org Trustworthy L!Conversion of values to readable us. Minimal complete definition:  or . Derived instances of L& have the following properties, which * are compatible with derived instances of :  The result of $ is a syntactically correct Haskell : expression containing only constants, given the fixity B declarations in force at the point where the type is declared. D It contains only the constructor names defined in the data type, B parentheses, and spaces. When labelled constructor fields are E used, braces, commas, field names, and equal signs are also used. = If the constructor is defined to be an infix operator, then  5 will produce infix applications of the constructor. ; the representation will be enclosed in parentheses if the . precedence of the top-level constructor in x is less than d ) (associativity is ignored). Thus, if d is 0 then the result * is never surrounded in parentheses; if d is 11 it is always A surrounded in parentheses, unless it is an atomic expression. 9 If the constructor is defined using record syntax, then  E will produce the record-syntax form, with the fields given in the + same order as the original declaration. $For example, given the declarations   infixr 5 :^: - data Tree a = Leaf a | Tree a :^: Tree a the derived instance of L is equivalent to  * instance (Show a) => Show (Tree a) where  : showsPrec d (Leaf m) = showParen (d > app_prec) $ ; showString "Leaf " . showsPrec (app_prec+1) m  where app_prec = 10  : showsPrec d (u :^: v) = showParen (d > up_prec) $ ' showsPrec (up_prec+1) u . ' showString " :^: " . % showsPrec (up_prec+1) v  where up_prec = 5 !Note that right-associativity of :^: is ignored. For example,   (Leaf 1 :^: Leaf 2 :^: Leaf 3) produces the string  "Leaf 1 :^: (Leaf 2 :^: Leaf 3)". Convert a value to a readable u.  should satisfy the law  2 showsPrec d x r ++ s == showsPrec d x (r ++ s) Derived instances of  and L satisfy the following:  (x,"") is an element of  ( d ( d x "")).  That is,  parses the string produced by  , and delivers the value that  started with. A specialised variant of , using precedence context ! zero, and returning an ordinary u.  The method ( is provided to allow the programmer to 4 give a specialised way of showing lists of values. - For example, this is used by the predefined L instance of  the ] type, where values of type u should be shown 8 in double quotes, rather than between square brackets. The shows/ functions return a function that prepends the  output u to an existing u. This allows constant-time 6 concatenation of results using function composition. equivalent to  with a precedence of 0. utility function converting a ] to a show function that * simply prepends the character unchanged. utility function converting a u to a show function that ' simply prepends the string unchanged. =utility function that surrounds the inner show function with  parentheses when the \ parameter is {. AConvert a character to a string using only printable characters, A using Haskell source-language escape conventions. For example: # showLitChar '\n' s = "\\n" ++ s zSame as , but for strings E It converts the string to a string using Haskell escape conventions E for non-printable characters. Does not add double-quotes around the ) whole thing; the caller should do that. D The main difference from showLitChar (apart from the fact that the G argument is a string not a list) is that we must escape double-quotes {Like  z) (expand escape characters using Haskell  escape conventions), but * * break the string into multiple lines , * wrap the entire thing in double quotes  Example: showMultiLineString hellongoodbyenblah  returns ["hello\,  \goodbye\, \blah"]  Convert an ` in the range 0..15 to the corresponding single  digit ]6. This function fails on other inputs, and generates  lower-case hexadecimal digits. /L |)the operator precedence of the enclosing  context (a number from 0 to 11). % Function application has precedence 10. the value to be converted to a u } ~  z { L | } ~  z { ,L | } ~  z { non-portable (GHC extensions)internalcvs-ghc@haskell.org Trustworthy !Used in Haskell's translation of [n..]. "Used in Haskell's translation of [n,n'..]. #Used in Haskell's translation of [n..m]. $Used in Haskell's translation of [n,n'..m]. =The =7 class is used to name the upper and lower limits of a  type. G is not a superclass of = since types that are not 7 totally ordered may also have upper and lower bounds. The =0 class may be derived for any enumeration type;  ( is the first constructor listed in the data declaration  and  is the last.  =< may also be derived for single-constructor datatypes whose  constituent types are in =. >Class >3 defines operations on sequentially ordered types. The enumFrom... methods are used in Haskell's translation of  arithmetic sequences.  Instances of >0 may be derived for any enumeration type (types C whose constructors have no fields). The nullary constructors are ) assumed to be numbered left-to-right by  from 0 through n-1.  See Chapter 10 of the Haskell Report for more details. *For any type that is an instance of class = as well as >,  the following should hold:  The calls   and   should result in  a runtime error.   and % should give a runtime error if the 9 result value is not representable in the result type.  For example,  7 :: \ is an error.  ! and "+ should be defined with an implicit bound,  thus: 1 enumFrom x = enumFromTo x maxBound 0 enumFromThen x y = enumFromThenTo x y bound  where 4 bound | fromEnum y >= fromEnum x = maxBound 4 | otherwise = minBound .the successor of a value. For numeric types,  adds 1. 0the predecessor of a value. For numeric types,  subtracts 1. Convert from an `. Convert to an `. % It is implementation-dependent what  returns when 3 applied to a value that is too large to fit in an `. F!"#$=> !"#$=> <=>!"#$ portable provisionallibraries@haskell.orgSafeAShow a list (using square brackets and commas), given a function  for showing elements.  L L portable provisionallibraries@haskell.org Trustworthy":: b is , () if b is {,  and  if b is x. ;Promote a function to a monad. W-Monads that also support choice and failure. the identity of (. It should also satisfy the equations  mzero >>= f = mzero  v >> mzero = mzero an associative operation Same as )', but with the arguments interchanged. 9Evaluate each action in the sequence from left to right,  and collect the results. 9Evaluate each action in the sequence from left to right,  and ignore the results.  f is equivalent to  .  f.  f is equivalent to  .  f.  This generalizes the list-based  function.  is  with its arguments flipped  is  with its arguments flipped  This generalizes the list-based  function. -Left-to-right Kleisli composition of monads. -Right-to-left Kleisli composition of monads. (), with the arguments flipped  act repeats the action infinitely.  valueN discards or ignores the result of evaluation, such as the return value of an k action. The A function is the conventional monad join operator. It is used to O remove one level of monadic structure, projecting its bound argument into the  outer level. The 9 function maps its first argument over a list, returning N the result as a pair of lists. This function is mainly used with complicated 0 data structures or a state-transforming monad. The  function generalizes  to arbitrary monads.  is the extension of ! which ignores the final result.  The   function is analogous to , except that its result is #encapsulated in a monad. Note that   works from left-to-right over 1the list arguments. This could be an issue where (*) and the `folded function' are not commutative.  $ foldM f a1 [x1, x2, ..., xm] ==   do  a2 <- f a1 x1  a3 <- f a2 x2  ...  f am xm LIf right-to-left evaluation is required, the input list should be reversed.  Like  , but discards the result.    n act performs the action n times,  gathering the results.  Like  , but discards the result.  <Conditional execution of monadic expressions. For example,  ) when debug (putStr "Debugging\n") will output the string  Debugging\n if the Boolean value debug is {, and otherwise do nothing. The reverse of  . CPromote a function to a monad, scanning the monadic arguments from  left to right. For example, ' liftM2 (+) [0,1] [0,2] = [0,2,1,3] * liftM2 (+) (Just 1) Nothing = Nothing CPromote a function to a monad, scanning the monadic arguments from  left to right (cf. ). CPromote a function to a monad, scanning the monadic arguments from  left to right (cf. ). CPromote a function to a monad, scanning the monadic arguments from  left to right (cf. ). In many situations, the ;' operations can be replaced by uses of (, which promotes function application.  ) return f `ap` x1 `ap` ... `ap` xn is equivalent to  liftMn f x1 x2 ... xn Direct W equivalent of    = (mfilter:: (a -> Bool) -> [a] -> [a]  applicable to any W, for example  mfilter odd (Just 1) == Just 1  mfilter odd (Just 2) == Nothing $:;W      )()*+,:;CEW     )E+C)*,(W    : ;":;W      non-portable (GHC Extensions)internalcvs-ghc@haskell.orgUnsafe$The strict state-transformer monad.  A computation of type  s a& transforms an internal state indexed  by s, and returns a value of type a.  The s parameter is either 8 an uninstantiated type variable (inside invocations of ), or  i (inside invocations of h). ?It serves to keep the internal states of different invocations  of 2 separate from each other and from invocations of  h. The ) and *3 operations are strict in the state (though not in , values stored in the state). For example,  (writeSTRef _|_ v >>= f) = _|_HAllow the result of a state transformer computation to be used (lazily)  inside the computation.  Note that if f is strict,  f = _|_. >Return the value computed by a state transformer computation.  The forall- ensures that the internal state used by the  9 computation is inaccessible to the rest of the program.        non-portable (GHC extensions)internalcvs-ghc@haskell.orgUnsafeMThe M9 class is used to map a contiguous subrange of values in @ a type onto integers. It is used primarily for array indexing  (see the array package). The first argument (l,u)' of each of these operations is a pair K specifying the lower and upper bounds of a contiguous subrange of values. GAn implementation is entitled to assume the following laws about these  operations:   (l,u) i ==  i ( (l,u))     (l,u)   (l,u) i == i, when  (l,u) i   ( (l,u)) ( (l,u))) == [0.. (l,u)-1]     (l,u) ==  ( (l,u))   Minimal complete instance: ,  and . )Mutable, boxed, non-strict arrays in the  monad. The type  arguments are as follows:  s&: the state variable argument for the  type  i8: the index type of the array (should be an instance of M)  e!: the element type of the array. 0The type of immutable non-strict (boxed) arrays  with indices in i and elements in e. ?The list of values in the subrange defined by a bounding pair. -The position of a subscript in the subrange. Like 3, but without checking that the value is in range. Returns {/ the given subscript lies in the range defined  the bounding pair. 5The size of the subrange defined by a bounding pair. like /, but without checking that the upper bound is  in range. CConstruct an array with the specified bounds and containing values ( for given indices within these bounds. AThe array is undefined (i.e. bottom) if any index in the list is E out of bounds. The Haskell 98 Report further specifies that if any E two associations in the list have the same index, the value at that 2 index is undefined (i.e. bottom). However in GHC's implementation, F the value at such an index is the value part of the last association  with that index in the list. 6Because the indices must be checked for these errors,   is E strict in the bounds argument and in the indices of the association D list, but non-strict in the values. Thus, recurrences such as the  following are possible:  @ a = array (1,100) ((1,1) : [(i, i * a!(i-1)) | i <- [2..100]]) BNot every index within the bounds of the array need appear in the F association list, but the values associated with indices that do not ) appear will be undefined (i.e. bottom). GIf, in any dimension, the lower bound is greater than the upper bound, E then the array is legal, but empty. Indexing an empty array always " gives an array-bounds error, but   still yields the bounds ' with which the array was constructed. AConstruct an array from a pair of bounds and a list of values in  index order. *The value at the given index in an array. 0The bounds with which an array was constructed. %The number of elements in the array. 4The list of indices of an array in ascending order. 1The list of elements of an array in index order. 5The list of associations of an array in index order. The  9 function deals with repeated indices in the association  list using an accumulating function which combines the values of # associations with the same index. 9 For example, given a list of values of some index type, hist H produces a histogram of the number of occurrences of each index within  a specified range:  4 hist :: (Ix a, Num b) => (a,a) -> [a] -> Array a b G hist bnds is = accumArray (+) 0 bnds [(i, 1) | i<-is, inRange bnds i] -If the accumulating function is strict, then   is strict in E the values, as well as the indices, in the association list. Thus, # unlike ordinary arrays built with  , accumulated arrays should  not in general be recursive. GConstructs an array identical to the first argument except that it has 9 been updated by the associations in the right argument.  For example, if m is a 1-origin, n by n matrix, then   m//[((i,i), 0) | i <- [1..n]] 5is the same matrix, except with the diagonal zeroed. <Repeated indices in the association list are handled as for  : K Haskell 98 specifies that the resulting array is undefined (i.e. bottom),  but GHC';s implementation uses the last association for each index.   f8 takes an array and an association list and accumulates C pairs from the list into the array with the accumulating function f.  Thus   can be defined using  : > accumArray f z b = accum f (array b [(i, z) | i <- range b])  . allows for transformations on array indices. E It may be thought of as providing function composition on the right 4 with the mapping that the original array embodies. ?A similar transformation of array values may be achieved using +  from the   instance of the E class. GM    a pair of bounds, each of the index type 0 of the array. These bounds are the lowest and . highest indices in the array, in that order. , For example, a one-origin vector of length  '10' has bounds '(1,10)', and a one-origin '10'  by '10' matrix has bounds '((1,1),(10,10))'.  a list of  associations of the form  (index, value). Typically, this list will & be expressed as a comprehension. An  association '(i, x)' defines the value of  the array at index i to be x.  accumulating function initial value bounds of the array association list                          ! " # $8M                  ?M                              ! " # $non-portable (GHC extensions)internalcvs-ghc@haskell.org TrustworthyArithmetic exceptions. $#This is thrown when the user calls . The String is the  argument given to . &DAny type that you wish to throw or catch as an exception must be an instance of the  Exception- class. The simplest case is a new exception type directly below the root:  2 data MyException = ThisException | ThatException  deriving (Show, Typeable)   instance Exception MyException &The default method definitions in the  Exception class do what we need *in this case. You can now throw and catch  ThisException and  ThatException as exceptions:   *Main> throw ThisException `catch` \e -> putStrLn ("Caught " ++ show (e :: MyException)) Caught ThisException GIn more complicated examples, you may wish to define a whole hierarchy of exceptions:  G --------------------------------------------------------------------- F -- Make the root exception type for all the exceptions in a compiler  P data SomeCompilerException = forall e . Exception e => SomeCompilerException e  deriving Typeable  + instance Show SomeCompilerException where - show (SomeCompilerException e) = show e  * instance Exception SomeCompilerException  C compilerExceptionToException :: Exception e => e -> SomeException D compilerExceptionToException = toException . SomeCompilerException  K compilerExceptionFromException :: Exception e => SomeException -> Maybe e ' compilerExceptionFromException x = do 0 SomeCompilerException a <- fromException x  cast a  G --------------------------------------------------------------------- G -- Make a subhierarchy for exceptions in the frontend of the compiler  P data SomeFrontendException = forall e . Exception e => SomeFrontendException e  deriving Typeable  + instance Show SomeFrontendException where - show (SomeFrontendException e) = show e  0 instance Exception SomeFrontendException where 0 toException = compilerExceptionToException 4 fromException = compilerExceptionFromException  C frontendExceptionToException :: Exception e => e -> SomeException D frontendExceptionToException = toException . SomeFrontendException  K frontendExceptionFromException :: Exception e => SomeException -> Maybe e ' frontendExceptionFromException x = do 0 SomeFrontendException a <- fromException x  cast a  G --------------------------------------------------------------------- H -- Make an exception type for a particular frontend compiler exception  4 data MismatchedParentheses = MismatchedParentheses  deriving (Typeable, Show)  0 instance Exception MismatchedParentheses where 2 toException = frontendExceptionToException 4 fromException = frontendExceptionFromException We can now catch a MismatchedParentheses exception as MismatchedParentheses, SomeFrontendException or SomeCompilerException, but not other types, e.g.  IOException:  #*Main> throw MismatchedParentheses catch e -> putStrLn ("Caught "' ++ show (e :: MismatchedParentheses)) Caught MismatchedParentheses #*Main> throw MismatchedParentheses catch e -> putStrLn ("Caught "' ++ show (e :: SomeFrontendException)) Caught MismatchedParentheses #*Main> throw MismatchedParentheses catch e -> putStrLn ("Caught "' ++ show (e :: SomeCompilerException)) Caught MismatchedParentheses #*Main> throw MismatchedParentheses catch e -> putStrLn ("Caught " ++ show (e :: IOException)) %*** Exception: MismatchedParentheses )The  SomeException3 type is the root of the exception type hierarchy. When an exception of type e$ is thrown, behind the scenes it is encapsulated in a  SomeException. +:Throw an exception. Exceptions may be thrown from purely 4 functional code, but may only be caught within the k monad.  !"#$%&'()*+ % & ' ( ) * !"#$%&'()*+ #"! $%&'()*+ % & ' ( ) *non-portable (GHC extensions)internalcvs-ghc@haskell.org Trustworthy0 stops execution and displays an error message. ,A special case of . D It is expected that compilers will recognize this and insert error = messages which are more appropriate to the context in which ,  appears. , + , -, + , -, + , -non-portable (GHC Extensions)internalcvs-ghc@haskell.org Trustworthy Conversion from a h (that is g e). 1 A floating literal stands for an application of    to a value of type h, so such literals have type  (A a) => a. 6%general coercion from integral types 7%general coercion to fractional types 8conversion to e 9Athe rational equivalent of its real argument with full precision A.Fractional numbers, supporting real division. Minimal complete definition:   and (3 or (2)) B/Integral numbers, supporting integer division. Minimal complete definition: 8 and 8 K$Extracting components of fractions. Minimal complete definition: - g9Rational numbers, with numerator and denominator of some B type. h@Arbitrary-precision rational numbers, represented as a ratio of  two e5 values. A rational number may be constructed using  the : operator. - The function - takes a real fractional number x  and returns a pair (n,f) such that x = n+f, and:  n- is an integral number with the same sign as x; and  f. is a fraction with the same type and sign as x, % and with absolute value less than 1. The default definitions of the 0, 1, .  and / functions are in terms of -. .. x returns the integer nearest x between zero and x // x returns the nearest integer to x;  the even integer if x% is equidistant between two integers 00 x) returns the least integer not less than x 11 x/ returns the greatest integer not greater than x 2fractional division 3reciprocal fraction 4'integer division truncated toward zero 5integer remainder, satisfying # (x `quot` y)*y + (x `rem` y) == x 64integer division truncated toward negative infinity 7integer modulus, satisfying " (x `div` y)*y + (x `mod` y) == x 8 simultaneous 4 and 5 9 simultaneous 6 and 7 :)Forms the ratio of two integral numbers. ;4Extract the numerator of the ratio in reduced form: I the numerator and denominator have no common factor and the denominator  is positive. <6Extract the denominator of the ratio in reduced form: I the numerator and denominator have no common factor and the denominator  is positive. =Converts a possibly-negative I value to a string. @0raise a number to a non-negative integral power A$raise a number to an integral power BB x y$ is the non-negative factor of both x and y of which  every common factor of x and y is also a factor; for example  B 4 2 = 2, B (-4) 6 = 2, B 0 4 = 4. B 0 0 = 0. & (That is, the common divisor that is "greatest" in the divisibility  preordering.) 2Note: Since for signed fixed-width integer types,   < 0, 7 the result may be negative if one of the arguments is  (and  necessarily is if the other is 0 or ) for such types. CC x y, is the smallest positive integer that both x and y divide. > 6789ABIKgh .-./0123456789 / 0 1 2 3:;< 4 5 6 7=)a function that can show unsigned values (the precedence of the enclosing context the value to show >?@A 8 9BC : ; < = > ? @ A B C D E F G H I3 6789ABIKgh .-./0123456789 / 0 1 2 3:;< 4 5 6 7=>?@A 8 9BC : ; < = >-67A23 B4567898I9K-./01g .h / 0 1 2 3:;< 4 5 6 7=>?@A 8 9BC : ; < = > ? @ A B C D E F G H Inon-portable (GHC Extensions)internalcvs-ghc@haskell.orgUnsafeG9Describes the behaviour of a thread when an asynchronous  exception is received. Hthe state during ZU: asynchronous exceptions are masked, and blocking operations may not be interrupted Ithe state during XW: asynchronous exceptions are masked, but blocking operations may still be interrupted J8asynchronous exceptions are unmasked (the normal state) K,File and directory names are values of type u, whose precise H meaning is operating system dependent. Files can be opened, yielding a H handle which can then be used to operate on the contents of that file. L?A monad transformer embedding strict state transformers in the k  monad. The i- parameter indicates that the internal state  used by the . computation is a special one supplied by the k < monad, and thus distinct from those used by invocations of . O This is the " back door" into the k monad, allowing k/ computation to be performed at any time. For this to be safe, the k computation should be 9free of side effects and independent of its environment. If the I/O computation wrapped in O performs side Beffects, then the relative order in which those side effects take place (relative to the main I/O trunk, or other calls to O-) is indeterminate. Furthermore, when using O6 to cause side-effects, you should take the following Fprecautions to ensure the side effects are performed as many times as Fyou expect them to be. Note that these precautions are necessary for @GHC, but may not be sufficient, and other compilers may require different precautions:  Use {-# NOINLINE foo #-} as a pragma on any function foo  that calls O. If the call is inlined,  the I/#O may be performed more than once.  Use the compiler flag -fno-cse" to prevent common sub-expression G elimination being performed on the module, which might combine I two side effects that were meant to be separate. A good example 1 is using multiple global variables (like test in the example below). 8 Make sure that the either you switch off let-floating (-fno-full-laziness), or that the  call to O/ cannot float outside a lambda. For example,  if you say:   , f x = unsafePerformIO (newIORef [])   H you may get only one reference cell shared between all calls to f.  Better would be   - f x = unsafePerformIO (newIORef [x])    because now it can't float outside the lambda. It is less well known that O! is not type safe. For example:   test :: IORef [a] * test = unsafePerformIO $ newIORef []   main = do " writeIORef test [42] $ bang <- readIORef test $ print (bang :: [Char]) GThis program will core dump. This problem with polymorphic references Bis well known in the ML community, and does not arise with normal Gmonadic use of references. There is no easy way to make it impossible  once you use O. Indeed, it is possible to write coerce :: a -> b with the help of O. So be careful! PThis version of O is more efficient Dbecause it omits the check that the IO is only being performed by a $single thread. Hence, when you use P, Dthere is a possibility that the IO action may be performed multiple Btimes (on a multiprocessor), and you should therefore ensure that %it gives the same results each time. QQ allows k$ computation to be deferred lazily. When passed a value of type IO a, the k will only be performed when the value of the a. is demanded. This is used to implement lazy file reading, see . JDEnsures that the suspensions under evaluation by the current thread Care unique; that is, the current thread is not evaluating anything Gthat is also under evaluation by another thread that has also executed  J. ,This operation is used in the definition of O to Kprevent the IO action from being executed multiple times, which is usually  undesirable. R A variant of +" that can only be used within the k monad.  Although R/ has a type that is an instance of the type of +, the % two functions are subtly different:  ! throw e `seq` x ===> throw e  throwIO e `seq` x ===> x +The first example will cause the exception e to be raised,  whereas the second one won' t. In fact, R will only cause 6 an exception to be raised when it is used within the k monad.  The R) variant should be used in preference to + to  raise an exception within the k monad because it guarantees  ordering with respect to other k operations, whereas +  does not. S.Note: this function is deprecated, please use X instead.  Applying S to a computation will 7 execute that computation with asynchronous exceptions  blocked. That is, any thread which ; attempts to raise an exception in the current thread with U will be B blocked until asynchronous exceptions are unblocked again. There's E no need to worry about re-enabling asynchronous exceptions; that is , done automatically on exiting the scope of  S. Threads created by S inherit the blocked D 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. T.Note: this function is deprecated, please use X instead. 9To re-enable asynchronous exceptions inside the scope of  S, T can be ; used. It scopes in exactly the same way, so on exit from  T& asynchronous exception delivery will  be disabled again. U Returns the G for the current thread. V;returns True if asynchronous exceptions are blocked in the  current thread. WLike X, but does not pass a restore action to the argument. X-Executes an IO computation with asynchronous  exceptions masked/. That is, any thread which attempts to raise ) an exception in the current thread with U C will be blocked until asynchronous exceptions are unmasked again. The argument passed to X! is a function that takes as its = argument another function, which can be used to restore the ; prevailing masking state within the context of the masked 0 computation. For example, a common way to use X is to protect  the acquisition of a resource:   mask $ \restore -> do  x <- acquire 9 restore (do_something_with x) `onException` release  release This code guarantees that acquire is paired with release , by masking D asynchronous exceptions for the critical parts. (Rather than write / this code yourself, it would be better to use  U' which abstracts the general pattern). Note that the restore" action passed to the argument to X > does not necessarily unmask asynchronous exceptions, it just D restores the masking state to that of the enclosing context. Thus 0 if asynchronous exceptions are already masked, X cannot be used M to unmask exceptions again. This is so that if you call a library function K with exceptions masked, you can be sure that the library call will not be L able to unmask exceptions again. If you are writing library code and need I to use asynchronous exceptions, the only way is to create a new thread;  see S. BAsynchronous exceptions may still be received while in the masked  state if the masked thread blocks in certain ways; see  Control.Exception#interruptible. Threads created by S inherit the masked D state from the parent; that is, to start a thread in blocked mode,  use mask_ $ forkIO ...+. This is particularly useful if you need C to establish an exception handler in the forked thread before any D asynchronous exceptions are received. To create a a new thread in  an unmasked state use S. YLike Z, but does not pass a restore action  to the argument. ZLike X7, but the masked computation is not interruptible (see  Control.Exception#interruptible). THIS SHOULD BE USED WITH . GREAT CARE, because if a thread executing in Z C blocks for any reason, then the thread (and possibly the program, B if this is the main thread) will be unresponsive and unkillable. < This function should only be necessary if you need to mask E exceptions around an interruptible operation, and you can guarantee E that the interruptible operation will only block for a short period  of time. [BForces its argument to be evaluated to weak head normal form when  the resultant k- action is executed. It can be used to order " evaluation with respect to other k operations; its semantics are  given by   evaluate x `seq` y ==> y 6 evaluate x `catch` f ==> (return $! x) `catch` f 2 evaluate x >>= f ==> (return $! x) >>= f Note:! the first equation implies that  (evaluate x) is not the  same as  (return $! x). A correct definition is ) evaluate x = (return $! x) >>= return ! KGHIJK LL MMNOPQ N J O PRST Q RUV SWXYZ Tcomputation to run first ("acquire resource") computation to run last ("release resource") computation to run in-between Ucomputation to run first 3computation to run afterward (even if an exception  was raised) [# KkGHIJK LL MMNOPQ N J O PRST QUV SWXYZ T U[ KGJIHK LL MMNOPQ N J O PRST Q RUV SWXYZ T U[non-portable (GHC Extensions)internalcvs-ghc@haskell.orgUnsafe VAn  V. is a mutable, boxed, non-strict array in the k monad. $ The type arguments are as follows:  i8: the index type of the array (should be an instance of M)  e!: the element type of the array. W Build a new  V XRead a value from an  V YWrite a new value into an  V ZRead a value from an  V [Write a new value into an  V V \ W X Y Z [ ] ^ V \ W X Y Z [ ] V \ W X Y Z [ ] ^(portable provisionalffi@haskell.orgUnsafe\GSometimes an external entity is a pure function, except that it passes  arguments and/'or results via pointers. The function unsafeLocalState0 permits the packaging of such entities as pure  functions. :The only IO operations allowed in the IO action passed to unsafeLocalState are (a) local allocation (alloca,  allocaBytes and derived operations such as  withArray and  withCString ), and (b) pointer operations (Foreign.Storable and  Foreign.Ptr ) on the @pointers to local storage, and (c) foreign functions whose only  observable effect is to read and/or write the locally allocated @memory. Passing an IO operation that does not obey these rules  results in undefined behaviour. +It is expected that this operation will be *replaced in a future revision of Haskell. \\\\non-portable (GHC Extensions)internalcvs-ghc@haskell.orgUnsafe ]An ] (pronounced "em-var"$) is a synchronising variable, used Dfor communication between concurrent threads. It can be thought of (as a a box, which may be empty or full. ^ Create an ] which is initially empty. _ Create an ]$ which contains the supplied value. `Return the contents of the ] . If the ] is currently  empty, `& will wait until it is full. After a `,  the ] is left empty. .There are two further important properties of `:  `3 is single-wakeup. That is, if there are multiple  threads blocked in ` , and the ] becomes full, D only one thread will be woken up. The runtime guarantees that $ the woken thread completes its ` operation. ) When multiple threads are blocked on an ] , they are ; woken up in FIFO order. This is useful for providing 5 fairness properties of abstractions built using ]s. aPut a value into an ] . If the ] is currently full,  a# will wait until it becomes empty. .There are two further important properties of a:  a3 is single-wakeup. That is, if there are multiple  threads blocked in a , and the ] becomes empty, D only one thread will be woken up. The runtime guarantees that $ the woken thread completes its a operation. ) When multiple threads are blocked on an ] , they are ; woken up in FIFO order. This is useful for providing 5 fairness properties of abstractions built using ]s. bA non-blocking version of `. The b function  returns immediately, with  if the ] was empty, or   a if the ] was full with contents a . After b,  the ] is left empty. cA non-blocking version of a. The c function  attempts to put the value a into the ] , returning { if  it was successful, or x otherwise. dCheck whether a given ] is empty. >Notice that the boolean value returned is just a snapshot of D the state of the MVar. By the time you get to react on its result, > the MVar may have been filled (or emptied) - so be extremely * careful when using this operation. Use b instead if possible. eAdd a finalizer to an ] (GHC only). See Foreign.ForeignPtr and  System.Mem.Weak for more about finalizers. ] _^_`abcde ` ] _^_`abcde ] _^_`abcde `*portable experimentallibraries@haskell.org TrustworthyfThe f7 class defines bitwise operations over integral types. 5 Bits are numbered from 0 with bit 0 being the least  significant bit. Minimal complete definition: g, h, i, j, (k or (t and v)), (l or (x and y)), r and s. gBitwise "and" hBitwise "or" iBitwise "xor" j&Reverse all the bits in the argument kk x i shifts x left by i bits if i is positive,  or right by -i bits otherwise. D Right shifts perform sign extension on signed number types; 2 i.e. they fill the top bits with 1 if the x is negative  and with 0 otherwise. +An instance can define either this unified k or t and  v8, depending on which is more convenient for the type in  question. ll x i rotates x left by i bits if i is positive,  or right by -i bits otherwise. For unbounded types like e, l is equivalent to k. +An instance can define either this unified l or x and  y8, depending on which is more convenient for the type in  question. mbit i is a value with the i$th bit set and all other bits clear nx `setBit` i is the same as  x .|. bit i ox `clearBit` i is the same as x .&. complement (bit i) px ` complementBit` i is the same as x `xor` bit i qReturn { if the nth bit of the argument is 1 rCReturn the number of bits in the type of the argument. The actual 8 value of the argument is ignored. The function r is C undefined for types that do not have a fixed bitsize, like e. sReturn {/ if the argument is a signed type. The actual * value of the argument is ignored t8Shift the argument left by the specified number of bits & (which must be non-negative). 'An instance can define either this and v or the unified  k8, depending on which is more convenient for the type in  question. u>Shift the argument left by the specified number of bits. The I result is undefined for negative shift amounts and shift amounts  greater or equal to the r.  Defaults to t, unless defined explicitly by an instance. vDShift the first argument right by the specified number of bits. The I result is undefined for negative shift amounts and shift amounts  greater or equal to the r. <Right shifts perform sign extension on signed number types; 2 i.e. they fill the top bits with 1 if the x is negative  and with 0 otherwise. 'An instance can define either this and t or the unified  k8, depending on which is more convenient for the type in  question. wFShift the first argument right by the specified number of bits, which M must be non-negative an smaller than the number of bits in the type. <Right shifts perform sign extension on signed number types; 2 i.e. they fill the top bits with 1 if the x is negative  and with 0 otherwise.  Defaults to v, unless defined explicitly by an instance. x9Rotate the argument left by the specified number of bits & (which must be non-negative). 'An instance can define either this and y or the unified  l8, depending on which is more convenient for the type in  question. y:Rotate the argument right by the specified number of bits & (which must be non-negative). 'An instance can define either this and x or the unified  l8, depending on which is more convenient for the type in  question. z?Return the number of set bits in the argument. This number is > known as the population count or the Hamming weight. fghijklmnopqrstuvwxyz a bfghijklmnopqrstuvwxyzfghijklmnopqrstuvwxyzfghijklmnopqrstuvwxyz a bnon-portable (GHC Extensions)internalcvs-ghc@haskell.org Trustworthy c d e f g h i j k l m n o p q r s t u v w x y z { | } ~ g h i j k l m n o p q r s t u v w x y z { | c d e f g h i j k l m n o p q r s t u v w x y z { | } ~non-portable (GHC Extensions)internalcvs-ghc@haskell.org Trustworthy     non-portable (GHC Extensions)internalcvs-ghc@haskell.org Trustworthy@>Trigonometric and hyperbolic functions and related functions. Minimal complete definition:  , , , , , , ,  , , , ,  and  J=Efficient, machine-independent access to the components of a  floating-point number. Minimal complete definition:  all except , ,  and  {?a constant function, returning the radix of the representation  (often 2) |7a constant function, returning the number of digits of  { in the significand }=a constant function, returning the lowest and highest values  the exponent may assume ~ The function ~" applied to a real floating-point 0 number returns the significand expressed as an e and an # appropriately scaled exponent (an `). If ~ x  yields (m,n), then x is equal in value to m*b^^n, where b 6 is the floating-point radix, and furthermore, either m and n  are both zero or else b^(d-1) <=  m < b^d, where d is  the value of | x.  In particular, ~ 0 = (0,0). If the type  contains a negative zero, also ~ (-0.0) = (0,0).   The result of ~ x is unspecified if either of   x or  x is {.  performs the inverse of ~ in the  sense that for finite x with the exception of -0.0,  uncurry  (~ x) = x.   m n) is one of the two closest representable  floating-point numbers to m*b^^n (or Infinity if overflow % occurs); usually the closer, but if m contains too many bits, 3 the result may be rounded in the wrong direction. ( corresponds to the second component of ~.   0 = 0 and for finite nonzero x,   x = snd (~ x) + | x.  If x< is a finite floating-point number, it is equal in value to   x * b ^^  x, where b is the  floating-point radix. - The behaviour is unspecified on infinite or NaN values. The first component of ~, scaled to lie in the open  interval (-1,1 ), either 0.0 or of absolute value >= 1/b,  where b is the floating-point radix. - The behaviour is unspecified on infinite or NaN values. Dmultiplies a floating-point number by an integer power of the radix { if the argument is an IEEE " not-a-number" (NaN) value {: if the argument is an IEEE infinity or negative infinity {3 if the argument is too small to be represented in  normalized format {* if the argument is an IEEE negative zero {2 if the argument is an IEEE floating point number Ba version of arctangent taking two real floating-point arguments.  For real floating x and y,  y x computes the angle A (from the positive x-axis) of the vector from the origin to the  point (x,y).  y x returns a value in the range [-pi,  pi]<. It follows the Common Lisp semantics for the origin when  signed zeroes are supported.  y 1, with y in a type  that is J", should return the same value as  y.  A default definition of  is provided, but implementors - can provide a more accurate implementation. Show a signed J value to full precision I using standard decimal notation for arguments whose absolute value lies  between 0.1 and  9,999,999%, and scientific notation otherwise. ! takes a base and a non-negative J number, / and returns a list of digits and an exponent.  In particular, if x>=0, and  , floatToDigits base x = ([d1,d2,...,dn], e) then  n >= 1 x = 0.d1d2...dn * (base**e) 0 <= di <= base-1 Converts a h value into any type in class J. @J {|}~   )a function that can show unsigned values (the precedence of the enclosing context the value to show |@J^_wy y z { | {|}~   _@J{|}~    non-portable (GHC Extensions)internalcvs-ghc@haskell.orgUnsafea value of type  STRef s a' is a mutable variable in state thread s,  containing a value of type a  Build a new  in the current state thread Read the value of an  Write a new value into an       non-portable (GHC Extensions)internalcvs-ghc@haskell.orgUnsafeA mutable variable in the k monad  Build a new  Read the value of an  Write a new value into an        --non-portable (local universal quantification) provisionallibraries@haskell.org Trustworthy"A parser for a type a), represented as a function that takes a  u* and returns a list of possible parses as (a,u) pairs. @Note that this kind of backtracking parser is very inefficient; 1 reading a large structure may be quite slow (cf ). )Consumes and returns the next character. $ Fails if there is no input left. @Look-ahead: returns the part of the input that is left, without  consuming it. Always fails. Symmetric choice. 5Local, exclusive, left-biased choice: If left parser < locally produces any result at all, then right parser is  not used. 5Transforms a parser into one that does the same, but 2 in addition returns the exact characters read.  IMPORTANT NOTE: - gives a runtime error if its first argument 2 is built using any occurrences of readS_to_P. =Consumes and returns the next character, if it satisfies the  specified predicate. ,Parses and returns the specified character. (Succeeds iff we are at the end of input )Parses and returns the specified string. CParses the first zero or more characters satisfying the predicate. C Always succeds, exactly once having consumed all the characters , Hence NOT the same as (many (satisfy p)) BParses the first one or more characters satisfying the predicate. P Fails if none, else succeeds exactly once having consumed all the characters - Hence NOT the same as (many1 (satisfy p)) ,Combines all parsers in the specified list. Skips all whitespace.  count n p parses n occurrences of p in sequence. A list of  results is returned. between open close p parses open, followed by p and finally  close. Only the value of p is returned.  option x p will either parse p or return x without consuming  any input.  optional p optionally parses p and always returns (). 5Parses zero or more occurrences of the given parser. 4Parses one or more occurrences of the given parser. Like , but discards the result. Like , but discards the result.  sepBy p sep$ parses zero or more occurrences of p, separated by sep. ( Returns a list of values returned by p.  sepBy1 p sep# parses one or more occurrences of p, separated by sep. ( Returns a list of values returned by p.  endBy p sep$ parses zero or more occurrences of p, separated and ended  by sep.  endBy p sep# parses one or more occurrences of p, separated and ended  by sep.  chainr p op x$ parses zero or more occurrences of p, separated by op. ! Returns a value produced by a right associative application of all  functions returned by op!. If there are no occurrences of p, x is  returned.  chainl p op x$ parses zero or more occurrences of p, separated by op. ! Returns a value produced by a left associative application of all  functions returned by op!. If there are no occurrences of p, x is  returned. Like (, but parses one or more occurrences of p. Like (, but parses one or more occurrences of p. manyTill p end$ parses zero or more occurrences of p, until end 2 succeeds. Returns a list of values returned by p. 7Converts a parser into a Haskell ReadS-style function. ) This is the main way in which you can "run" a  parser:  the expanded type is  / readP_to_S :: ReadP a -> String -> [(a,String)]  7Converts a Haskell ReadS-style function into a parser. @ Warning: This introduces local backtracking in the resulting 2 parser, and therefore a possible inefficiency. 1   ##+    .0non-portable (uses Text.ParserCombinators.ReadP) provisionallibraries@haskell.org Trustworthy Haskell lexemes. Floating point literal Integer literal Haskell symbol, e.g. >>, :% Haskell identifier, e.g. foo, Baz %Punctuation or reserved symbol, e.g. (, :: )String literal, with escapes interpreted Character literal @Haskell lexer: returns the lexed string, rather than the lexeme 9                    +                     /0non-portable (uses Text.ParserCombinators.ReadP) provisionallibraries@haskell.org Trustworthy Lift a precedence-insensitive  to a . )Increases the precedence context by one. 'Resets the precedence context to zero.  (prec n p)+ checks whether the precedence context is  less than or equal to n, and  if not, fails  if so, parses p in context n. )Consumes and returns the next character. $ Fails if there is no input left. @Look-ahead: returns the part of the input that is left, without  consuming it. Symmetric choice. 5Local, exclusive, left-biased choice: If left parser < locally produces any result at all, then right parser is  not used. Always fails. ,Combines all parsers in the specified list.         non-portable (GHC Extensions)internalcvs-ghc@haskell.org TrustworthyH Parsing of us, producing values. Minimal complete definition:  (or, for GHC only, ) Derived instances of H' make the following assumptions, which  derived instances of  obey: A If the constructor is defined to be an infix operator, then the  derived H0 instance will parse only infix applications of * the constructor (not the prefix form). D Associativity is not used to reduce the occurrence of parentheses,  although precedence may be. @ If the constructor is defined using record syntax, the derived H G will parse only the record-syntax form, and furthermore, the fields @ must be given in the same order as the original declaration.  The derived H. instance allows arbitrary Haskell whitespace C between tokens of the input string. Extra parentheses are also  allowed. $For example, given the declarations   infixr 5 :^: - data Tree a = Leaf a | Tree a :^: Tree a the derived instance of H in Haskell 98 is equivalent to  * instance (Read a) => Read (Tree a) where  3 readsPrec d r = readParen (d > app_prec) / (\r -> [(Leaf m,t) | 7 ("Leaf",s) <- lex r, H (m,t) <- readsPrec (app_prec+1) s]) r  2 ++ readParen (d > up_prec) . (\r -> [(u:^:v,w) | D (u,s) <- readsPrec (up_prec+1) r, 6 (":^:",t) <- lex s, G (v,w) <- readsPrec (up_prec+1) t]) r   where app_prec = 10  up_prec = 5 !Note that right-associativity of :^: is unused. -The derived instance in GHC is equivalent to * instance (Read a) => Read (Tree a) where  1 readPrec = parens $ (prec app_prec $ do 7 Ident "Leaf" <- lexP 5 m <- step readPrec 3 return (Leaf m))  - +++ (prec up_prec $ do 5 u <- step readPrec 7 Symbol ":^:" <- lexP 5 v <- step readPrec 4 return (u :^: v))   where app_prec = 10  up_prec = 5  , readListPrec = readListPrecDefault Battempts to parse a value from the front of the string, returning C a list of (parsed value, remaining string) pairs. If there is no / successful parse, the returned list is empty. Derived instances of H and  satisfy the following:  (x,"") is an element of  ( d ( d x "")).  That is,  parses the string produced by  , and delivers the value that   started with.  The method ( is provided to allow the programmer to 4 give a specialised way of parsing lists of values. - For example, this is used by the predefined H instance of  the ] type, where values of type u should be are = expected to use double quotes, rather than square brackets. Proposed replacement for % using new-style parsers (GHC only). Proposed replacement for % using new-style parsers (GHC only).  The default definition uses . Instances that define   should also define  as .  { p parses what p parses, but surrounded with  parentheses.  x p parses what p parses, but optionally  surrounded with parentheses. *A possible replacement definition for the  method (GHC only). 7 This is only needed for GHC, and even then only for H instances  where  isn' t defined as . *A possible replacement definition for the  method,  defined using  (GHC only). The ; function reads a single lexeme from the input, discarding G initial white space, and returning the characters that constitute the 9 lexeme. If the input string contains only white space,  returns a  single successful `lexeme'( consisting of the empty string. (Thus   "" = [("","")]'.) If there is no legal lexeme at the  beginning of the input string,  fails (i.e. returns []). DThis lexer is not completely faithful to the Haskell lexical syntax  in the following respects: * Qualified names are not handled properly E Octal and hexadecimal numerics are not recognized as a single token # Comments are not treated properly ;Read a string representation of a character, using Haskell 3 source-language escape conventions. For example: / lexLitChar "\\nHello" = [("\\n", "Hello")] ;Read a string representation of a character, using Haskell E source-language escape conventions, and convert it to the character  that it encodes. For example: . readLitChar "\\nHello" = [('\n', "Hello")] ,Reads a non-empty string of decimal digits. Parse a single lexeme Parse a single lexeme  (paren p) parses "(P0)"  where p parses "P0" in precedence context zero  (parens p) parses "P", "(P0)", "((P0))", etc,  where p parses "P"$ in the current precedence context  and parses "P0" in precedence context zero (list p)# parses a list of things parsed by p, ( using the usual square-bracket syntax. 6Parse the specified lexeme and continue as specified. + Esp useful for nullary constructors; e.g.   choose [("A", return A), ("B" , return B)] 8 We match both Ident and Symbol because the constructor  might be an operator eg (:=:) 6H)the operator precedence of the enclosing  context (a number from 0 to 11). % Function application has precedence 10.      ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B CH    (2H     ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B Cnon-portable (GHC Extensions)internalcvs-ghc@haskell.org TrustworthylA l5 is an unsigned integral type, with the same size as `. m8-bit unsigned integer type n16-bit unsigned integer type o32-bit unsigned integer type p64-bit unsigned integer type :lmnop D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u lmnop D E F G5lm Gn Fo Ep D H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t unon-portable (GHC Extensions)internalcvs-ghc@haskell.org Trustworthya8-bit signed integer type b16-bit signed integer type c32-bit signed integer type d64-bit signed integer type .abcd v w x y z { | } ~  abcd v w x y*a yb xc wd v z { | } ~  portable experimentallibraries@haskell.org Trustworthy`abcd`abcdportable experimentallibraries@haskell.orgSafelmnoplmnop0 Trustworthy non-portableinternallibraries@haskell.org TrustworthySee              %portable provisionallibraries@haskell.org Trustworthy   Reads an unsigned B value in an arbitrary base. +Read an unsigned number in octal notation. -Read an unsigned number in decimal notation. 1Read an unsigned number in hexadecimal notation. / Both upper or lower case letters are allowed.  Reads an unsigned K value, + expressed in decimal scientific notation. Reads a signed I. value, given a reader for an unsigned value. Show  non-negative B numbers in base 10. Show a signed J value / using scientific (exponential) notation (e.g. 2.45e2, 1.5e-3).  In the call  digs val, if digs is , * the value is shown to full precision; if digs is  d,  then at most d+ digits after the decimal point are shown. Show a signed J value ' using standard decimal notation (e.g. 245000, 0.0015).  In the call  digs val, if digs is , * the value is shown to full precision; if digs is  d,  then at most d+ digits after the decimal point are shown. Show a signed J value J using standard decimal notation for arguments whose absolute value lies  between 0.1 and  9,999,999%, and scientific notation otherwise.  In the call  digs val, if digs is , * the value is shown to full precision; if digs is  d,  then at most d+ digits after the decimal point are shown. Shows a  non-negative B( number using the base specified by the K first argument, and the character representation specified by the second. Show  non-negative B numbers in base 16. Show  non-negative B numbers in base 8.   the base 5a predicate distinguishing valid digits in this base 4a function converting a valid digit character to an `  = =   non-portable (GHC Extensions)internalffi@haskell.orgUnsafe qA value of type q a* represents a pointer to an object, or an E array of objects, which may be marshalled to or from Haskell values  of type a.  The type a$ will often be an instance of class  3, which provides the marshalling operations. H However this is not essential, and you can provide your own operations C to access the pointer. For example you might write small foreign + functions to get or set the fields of a C struct. rA value of type r a% is a pointer to a function callable  from foreign code. The type a will normally be a  foreign type, 3 a function type with zero or more arguments where  the argument types are marshallable foreign types,  i.e. ], `, ^, _,  \, , , ,  , , ,  , , q a, r a,   a or a renaming of any of these  using newtype. G the return type is either a marshallable foreign type or has the form  k t where t# is a marshallable foreign type or (). A value of type r a) may be a pointer to a foreign function, @ either returned by another foreign function or imported with a  a static address import like  ' foreign import ccall "stdlib.h &free" % p_free :: FunPtr (Ptr a -> IO ()) 3or a pointer to a Haskell function created using a wrapper stub  declared to produce a r$ of the correct type. For example:  # type Compare = Int -> Int -> Bool  foreign import ccall "wrapper" / mkCompare :: Compare -> IO (FunPtr Compare) Calls to wrapper stubs like  mkCompare allocate storage, which  should be released with  when no  longer required.  To convert r0 values to corresponding Haskell functions, one  can define a dynamic* stub for the specific foreign type, e.g. " type IntFunction = CInt -> IO () ! foreign import ccall "dynamic" . mkFun :: FunPtr IntFunction -> IntFunction  The constant # contains a distinguished value of q 6 that is not associated with a valid memory location. The 4 function casts a pointer from one type to another. 9Advances the given address by the given offset in bytes. 8Given an arbitrary address and an alignment constraint,  2 yields the next higher address that fulfills the 0 alignment constraint. An alignment constraint x is fulfilled by  any address divisible by x!. This operation is idempotent.  AComputes the offset required to get from the second to the first  argument. We have ' p2 == p1 `plusPtr` (p2 `minusPtr` p1) ! The constant ! contains a  distinguished value of r that is not * associated with a valid memory location. "Casts a r to a r of a different type. #Casts a r to a q. Note:= this is valid only on architectures where data and function H pointers range over the same set of addresses, and should only be used F for bindings to external libraries whose interface already relies on  this assumption. $Casts a q to a r. Note:= this is valid only on architectures where data and function H pointers range over the same set of addresses, and should only be used F for bindings to external libraries whose interface already relies on  this assumption. qr !"#$ qr !"#$ qr !"#$ non-portable (GHC Extensions)internalffi@haskell.orgUnsafe>Create a stable pointer referring to the given Haskell value. jA stable pointer0 is a reference to a Haskell expression that is Nguaranteed not to be affected by garbage collection, i.e., it will neither be Jdeallocated nor will the value of the stable pointer itself change during Hgarbage collection (ordinary references may be relocated during garbage Kcollection). Consequently, stable pointers can be passed to foreign code, >which can treat it as an opaque reference to a Haskell value. A value of type  StablePtr a" is a stable pointer to a Haskell expression of type a. %DDissolve the association between the stable pointer and the Haskell 7 value. Afterwards, if the stable pointer is passed to  & or %, the behaviour is @ undefined. However, the stable pointer may still be passed to  ' , but the  () value returned  by '-, in this case, is undefined (in particular,  it may be ). Nevertheless, the call  to ' is guaranteed not to diverge. &CObtain the Haskell value referenced by a stable pointer, i.e., the 9 same value that was passed to the corresponding call to   makeStablePtr. If the argument to & has  already been freed using %, the behaviour of  & is undefined. 'DCoerce a stable pointer to an address. No guarantees are made about E the resulting value, except that the original stable pointer can be  recovered by (&. In particular, the address may not F refer to an accessible memory location and any attempt to pass it to # the member functions of the class 3 leads to  undefined behaviour. (The inverse of ', i.e., we have the identity  2 sp == castPtrToStablePtr (castStablePtrToPtr sp) for any stable pointer sp on which % has # not been executed yet. Moreover, ( may 8 only be applied to pointers that have been produced by  '. j %&'( j %&'(j %&'( portable provisionalffi@haskell.org Trustworthyj%&'(j&%'(non-portable (GHC Extensions)internalcvs-ghc@haskell.orgUnsafe  > ?    2 non-portableinternallibraries@haskell.org Trustworthy)%A mode that determines the effect of hSeek  hdl mode i. *the position of hdl is set to offset i  from the end of the file. +the position of hdl is set to offset i  from the current position. ,the position of hdl is set to i. -,Type of a device that can be used to back a  A (see also A). The ( standard libraries provide creation of As via 2 Posix file operations with file descriptors (see  J) with FD being the underlying  2 instance. &Users may provide custom instances of 2 4 which are expected to conform the following rules: .A raw+ (disk) device which supports block binary 4 read and write operations and may be seekable only - to positions of certain granularity (block-  aligned). /-A file that may be read or written, and also  may be seekable. 0,A duplex communications channel (results in  creation of a duplex A). The . standard libraries use this device type when  creating As for open sockets. 12The standard libraries do not have direct support 4 for this device type, but a user implementation is - expected to provide a list of file names in + the directory, in any order, separated by '\0'  characters, excluding the . and .. names. See  also . Seek 4 operations are not supported on directories (other  than to the zero position). 2I/)O operations required for implementing a Handle. 3ready dev write msecs returns { if the device has data  to read (if write is x!) or space to write new data (if  write is {). msecs specifies how long to wait, in  milliseconds. 4<closes the device. Further operations on the device should  produce exceptions. 5returns {) if the device is a terminal or console. 6returns { if the device supports 7 operations. 7,seek to the specified position in the data. 8)return the current position in the data. 9return the size of the data. :change the size of the data. ;?for terminal devices, changes whether characters are echoed on  the device. <$returns the current echoing status. =(some devices (e.g. terminals) support a raw mode where C characters entered are immediately made available to the program. 1 If available, this operations enables raw mode. > returns the - corresponding to this device. ?@duplicates the device, if possible. The new device is expected = to share a file pointer with the original device (like Unix dup). @dup2 source target, replaces the target device with the source D device. The target device is closed first, if necessary, and then < it is made into a duplicate of the first device (like Unix dup2). A A low-level I/.O provider where the data is bytes in memory. B?Read up to the specified number of bytes, returning the number C of bytes actually read. This function should only block if there ? is no data available. If there is not enough data available, C then the function should just return the available data. A return C value of zero indicates that the end of the data stream (e.g. end  of file) has been reached. C?Read up to the specified number of bytes, returning the number  of bytes actually read, or  if the end of the stream has  been reached. D%Write the specified number of bytes. EEWrite up to the specified number of bytes without blocking. Returns % the actual number of bytes written. )*+,-./0123456789:;<=>?@ABCDE )*+,-./0123456789:;<=>?@ABCDEABCDE23456789:;<=>?@-10/.),+*),+*-10/.23456789:;<=>?@ABCDE non-portable (GHC Extensions)internalffi@haskell.org Trustworthy  3portable provisionalffi@haskell.org Trustworthy F@The member functions of this class facilitate writing values of Fprimitive types to raw memory (which may have been allocated with the @above mentioned routines) and reading values from blocks of raw Dmemory. The class, furthermore, includes support for computing the Cstorage requirements and alignment restrictions of storable types. 3Memory addresses are represented as values of type q a , for some a which is an instance of class F. The type argument to q= helps provide some valuable type safety in FFI code (you can't Amix pointers of different types without an explicit cast), while Ghelping the Haskell type system figure out which marshalling method is needed for a given pointer. BAll marshalling between Haskell and a foreign language ultimately Bboils down to translating Haskell data structures into the binary @representation of a corresponding data structure of the foreign Elanguage and vice versa. To code this marshalling in Haskell, it is Dnecessary to manipulate primitive data types stored in unstructured memory blocks. The class F" facilitates this manipulation on Eall types for which it is instantiated, which are the standard basic !types of Haskell, the fixed size Int types (a, b, c, d), the fixed size Word types (m, n, o, p), j, all types from Foreign.C.Types,  as well as q. Minimal complete definition: G, H , one of M, I and K , and one of N, J and L. G>Computes the storage requirements (in bytes) of the argument. ( The value of the argument is not used. H7Computes the alignment constraint of the argument. An  alignment constraint x' is fulfilled by any address divisible  by x*. The value of the argument is not used. I5Read a value from a memory area regarded as an array C of values of the same kind. The first argument specifies F the start address of the array and the second the index into = the array (the first element of the array has index  0"). The following equality holds,  2 peekElemOff addr idx = IOExts.fixIO $ \result -> / peek (addr `plusPtr` (idx * sizeOf result)) ,Note that this is only a specification, not 8 necessarily the concrete implementation of the  function. J7Write a value to a memory area regarded as an array of A values of the same kind. The following equality holds:  pokeElemOff addr idx x = , poke (addr `plusPtr` (idx * sizeOf x)) x K4Read a value from a memory location given by a base < address and offset. The following equality holds: 2 peekByteOff addr off = peek (addr `plusPtr` off) L3Write a value to a memory location given by a base < address and offset. The following equality holds: 6 pokeByteOff addr off x = poke (addr `plusPtr` off) x M-Read a value from the given memory location. =Note that the peek and poke functions might require properly A aligned addresses to function correctly. This is architecture D dependent; thus, portable code should ensure that when peeking or  poking values of some type a, the alignment  constraint for a, as given by the function  H is fulfilled. N?Write the given value to the given memory location. Alignment  restrictions might apply; see M. FGHIJKLMN FGHIJKLMN FGHIJKLMNFGHIJKLMN 4portable provisionalffi@haskell.org TrustworthyW Haskell type representing the C jmp_buf type. X Haskell type representing the C fpos_t type. Y Haskell type representing the C FILE type. Z Haskell type representing the C  suseconds_t type. \ Haskell type representing the C  useconds_t type. ^ Haskell type representing the C time_t type. ` Haskell type representing the C clock_t type. b Haskell type representing the C  sig_atomic_t type. d Haskell type representing the C wchar_t type. f Haskell type representing the C size_t type. h Haskell type representing the C  ptrdiff_t type. j Haskell type representing the C double type. l Haskell type representing the C float type. n Haskell type representing the C unsigned long long type. p Haskell type representing the C  long long type. r Haskell type representing the C  unsigned long type. t Haskell type representing the C long type. v Haskell type representing the C  unsigned int type. x Haskell type representing the C int type. z Haskell type representing the C unsigned short type. | Haskell type representing the C short type. ~ Haskell type representing the C  unsigned char type.  Haskell type representing the C  signed char type.  Haskell type representing the C char type. jOPQRSTUVW X Y Z[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                   5OPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~5~|}z{xyvwturshifgdebcpqnoUVSTQROP`a^_\]Z[lmjkYXWNOPQRSTUVW X Y Z[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                   non-portable (GHC extensions)internalcvs-ghc@haskell.org Trustworthy8Selects alphabetic or numeric digit Unicode characters. FNote that numeric digits outside the ASCII range are selected by this  function but not by *. Such digits may be part of identifiers B but are not used by the printer and reader to represent numbers. "Selects ASCII hexadecimal digits,  i.e. '0'..'9', 'a'..'f', 'A'..'F'. !Selects ASCII octal digits, i.e. '0'..'7'. Selects ASCII digits, i.e. '0'..'9'. BSelects alphabetic Unicode characters (lower-case, upper-case and N title-case letters, plus letters of caseless scripts and modifiers letters).  This function is equivalent to . <Selects lower-case alphabetic Unicode characters (letters). JSelects upper-case or title-case alphabetic Unicode characters (letters). C Title case is used by a small number of letter ligatures like the  single-character form of Lj. Returns {2 for any Unicode space character, and the control  characters \t, \n, \r, \f, \v. %Selects printable Unicode characters = (letters, numbers, marks, punctuation, symbols and spaces). ESelects control characters, which are the non-printing characters of  the Latin-1 subset of Unicode. ?Selects the first 256 characters of the Unicode character set, : corresponding to the ISO 8859-1 (Latin-1) character set. ?Selects the first 128 characters of the Unicode character set, + corresponding to the ASCII character set. "Selects ASCII lower-case letters, ! i.e. characters satisfying both  and . "Selects ASCII upper-case letters, ! i.e. characters satisfying both  and . AConvert a letter to the corresponding lower-case letter, if any. , Any other character is returned unchanged. AConvert a letter to the corresponding upper-case letter, if any. , Any other character is returned unchanged. ?Convert a letter to the corresponding title-case or upper-case G letter, if any. (Title case differs from upper case only for a small  number of ligature letters.) , Any other character is returned unchanged.         ! " #         ! " #portablestablelibraries@haskell.org Trustworthy'?Unicode General Categories (column 2 of the UnicodeData table) 7 in the order they are listed in the Unicode standard. Cn: Other, Not Assigned Co: Other, Private Use Cs: Other, Surrogate Cf: Other, Format Cc: Other, Control Zp: Separator, Paragraph Zl: Separator, Line Zs: Separator, Space So: Symbol, Other Sk: Symbol, Modifier Sc: Symbol, Currency Sm: Symbol, Math Po: Punctuation, Other Pf: Punctuation, Final quote Pi: Punctuation, Initial quote Pe: Punctuation, Close Ps: Punctuation, Open Pd: Punctuation, Dash Pc: Punctuation, Connector No: Number, Other Nl: Number, Letter Nd: Number, Decimal Me: Mark, Enclosing Mc: Mark, Spacing Combining Mn: Mark, Non-Spacing Lo: Letter, Other Lm: Letter, Modifier Lt: Letter, Titlecase Ll: Letter, Lowercase Lu: Letter, Uppercase Convert a single digit ] to the corresponding `. 3 This function fails unless its argument satisfies , = but recognises both upper and lower-case hexadecimal digits  (i.e. '0'..'9', 'a'..'f', 'A'..'F'). /The Unicode general category of the character. BSelects alphabetic Unicode characters (lower-case, upper-case and N title-case letters, plus letters of caseless scripts and modifiers letters).  This function is equivalent to . BSelects Unicode mark characters, e.g. accents and the like, which ! combine with preceding letters. BSelects Unicode numeric characters, including digits from various  scripts, Roman numerals, etc. @Selects Unicode punctuation characters, including various kinds % of connectors, brackets and quotes. >Selects Unicode symbol characters, including mathematical and  currency symbols. 0Selects Unicode space and separator characters. '?]?] portablestablelibraries@haskell.org TrustworthyEThe - function drops the largest suffix of a list D in which the given predicate holds for all elements. For example: ' dropWhileEnd isSpace "foo\n" == "foo" - dropWhileEnd isSpace "foo bar" == "foo bar" C dropWhileEnd isSpace ("foo\n" ++ undefined) == "foo" ++ undefined The . function drops the given prefix from a list.  It returns + if the list did not start with the prefix  given, or ( the list after the prefix, if it does. * stripPrefix "foo" "foobar" == Just "bar" $ stripPrefix "foo" "foo" == Just "" ' stripPrefix "foo" "barfoo" == Nothing * stripPrefix "foo" "barfoobaz" == Nothing The 1 function returns the index of the first element & in the given list which is equal (by %) to the query element,  or  if there is no such element. The  function extends , by returning the I indices of all elements equal to the query element, in ascending order. The 7 function takes a predicate and a list and returns the 6 first element in the list matching the predicate, or  if  there is no such element. The 3 function takes a predicate and a list and returns F the index of the first element in the list satisfying the predicate,  or  if there is no such element. The  function extends , by returning the G indices of all elements satisfying the predicate, in ascending order. The & function takes two lists and returns { / iff the first list is a prefix of the second. The & function takes two lists and returns { / iff the first list is a suffix of the second.  Both lists must be finite. The & function takes two lists and returns { 5 iff the first list is contained, wholly and intact,  anywhere within the second.  Example: 5isInfixOf "Haskell" "I really like Haskell." == True 2isInfixOf "Ial" "I really like Haskell." == False O(n^2). The 2 function removes duplicate elements from a list. D In particular, it keeps only the first occurrence of each element.  (The name  means `essence'.)  It is a special case of (, which allows the programmer to supply  their own equality test. The  function behaves just like , except it uses a < user-supplied equality predicate instead of the overloaded %  function.  x! removes the first occurrence of x from its list argument.  For example,   delete 'a' "banana" == "bnana" It is a special case of !, which allows the programmer to ! supply their own equality test. The  function behaves like , but takes a # user-supplied equality predicate. The 0 function is list difference (non-associative).  In the result of xs  ys*, the first occurrence of each element of  ys( in turn (if any) has been removed from xs. Thus   (xs ++ ys) \\ xs == ys. It is a special case of , which allows the programmer $ to supply their own equality test. The 3 function returns the list union of the two lists.  For example,   "dog" `union` "cow" == "dogcw" ADuplicates, and elements of the first list, are removed from the E the second list, but if the first list contains duplicates, so will  the result.  It is a special case of (, which allows the programmer to supply  their own equality test. The + function is the non-overloaded version of . The 4 function takes the list intersection of two lists.  For example,  * [1,2,3,4] `intersect` [2,4,6,8] == [2,4] ;If the first list contains duplicates, so will the result.  . [1,2,2,3,4] `intersect` [6,4,4,2] == [2,2,4] It is a special case of !, which allows the programmer to ! supply their own equality test. The + function is the non-overloaded version of . The * function takes an element and a list and  ` intersperses'0 that element between the elements of the list.  For example, ( intersperse ',' "abcde" == "a,b,c,d,e"  xs xss is equivalent to ( ( xs xss)).  It inserts the list xs in between the lists in xss and concatenates the  result. The ; function transposes the rows and columns of its argument.  For example, 4 transpose [[1,2,3],[4,5,6]] == [[1,4],[2,5],[3,6]] The / function takes a predicate a list and returns ? the pair of lists of elements which do and do not satisfy the  predicate, respectively; i.e., 6 partition p xs == (filter p xs, filter (not . p) xs) The ( function behaves like a combination of  and  ;; it applies a function to each element of a list, passing E an accumulating parameter from left to right, and returning a final 7 value of this accumulator together with the new list. The ( function behaves like a combination of  and  ;; it applies a function to each element of a list, passing E an accumulating parameter from right to left, and returning a final 7 value of this accumulator together with the new list. The 6 function takes an element and a list and inserts the C element into the list at the last position where it is still less @ than or equal to the next element. In particular, if the list < is sorted before the call, the result will also be sorted.  It is a special case of !, which allows the programmer to ' supply their own comparison function. The non-overloaded version of . ( returns the maximum value from a list, : which must be non-empty, finite, and of an ordered type.  It is a special case of , which allows the 5 programmer to supply their own comparison function. ( returns the minimum value from a list, : which must be non-empty, finite, and of an ordered type.  It is a special case of , which allows the 5 programmer to supply their own comparison function. The 1 function takes a comparison function and a list J and returns the greatest element of the list by the comparison function. ( The list must be finite and non-empty. The 1 function takes a comparison function and a list G and returns the least element of the list by the comparison function. ( The list must be finite and non-empty. The & function is an overloaded version of . In % particular, instead of returning an `, it returns any type which is  an instance of F'. It is, however, less efficient than . The & function is an overloaded version of , which  accepts any B* value as the number of elements to take. The & function is an overloaded version of , which  accepts any B* value as the number of elements to drop. The & function is an overloaded version of , which  accepts any B* value as the position at which to split. The & function is an overloaded version of , which  accepts any B value as the index. The & function is an overloaded version of ,  which accepts any B- value as the number of repetitions to make. The 1 function takes four lists and returns a list of  quadruples, analogous to . The 1 function takes five lists and returns a list of  five-tuples, analogous to . The < function takes six lists and returns a list of six-tuples,  analogous to . The 2 function takes seven lists and returns a list of  seven-tuples, analogous to . The / function takes a function which combines four H elements, as well as four lists and returns a list of their point-wise  combination, analogous to . The / function takes a function which combines five H elements, as well as five lists and returns a list of their point-wise  combination, analogous to . The . function takes a function which combines six G elements, as well as six lists and returns a list of their point-wise  combination, analogous to . The 0 function takes a function which combines seven I elements, as well as seven lists and returns a list of their point-wise  combination, analogous to . The 6 function takes a list of quadruples and returns four  lists, analogous to . The 7 function takes a list of five-tuples and returns five  lists, analogous to . The 5 function takes a list of six-tuples and returns six  lists, analogous to . The 3 function takes a list of seven-tuples and returns  seven lists, analogous to . The . function takes a predicate and two lists and E returns the first list with the first occurrence of each element of  the second list removed. The 8 function takes a list and returns a list of lists such K that the concatenation of the result is equal to the argument. Moreover, H each sublist in the result contains only equal elements. For example,  < group "Mississippi" = ["M","i","ss","i","ss","i","pp","i"] It is a special case of (, which allows the programmer to supply  their own equality test. The + function is the non-overloaded version of . The 8 function returns all initial segments of the argument,  shortest first. For example,  $ inits "abc" == ["","a","ab","abc"]  Note that ( has the following strictness property:   inits _|_ = [] : _|_ The 6 function returns all final segments of the argument,  longest first. For example,  & tails "abc" == ["abc", "bc", "c",""]  Note that ( has the following strictness property:  tails _|_ = _|_ : _|_ The @ function returns the list of all subsequences of the argument. = subsequences "abc" == ["","a","b","ab","c","ac","bc","abc"] $The  $@ function returns the list of all subsequences of the argument,  except for the empty list. B nonEmptySubsequences "abc" == ["a","b","ab","c","ac","bc","abc"] The @ function returns the list of all permutations of the argument. = permutations "abc" == ["abc","bac","cba","bca","cab","acb"] The 1 function implements a stable sorting algorithm.  It is a special case of (, which allows the programmer to supply  their own comparison function. The + function is the non-overloaded version of . The  function is a `dual' to : while  $ reduces a list to a summary value,  builds a list from ; a seed value. The function takes the element and returns  - if it is done producing the list or returns  (a,b) , in which  case, a is a prepended to the list and b is used as the next , element in a recursive call. For example,  , iterate f == unfoldr (\x -> Just (x, f x)) In some cases,  can undo a  operation:  ! unfoldr f' (foldr f z xs) == xs if the following holds:   f' (f x y) = Just (x,y)  f' z = Nothing A simple use of unfoldr: > unfoldr (\b -> if b == 0 then Nothing else Just (b, b-1)) 10  [10,9,8,7,6,5,4,3,2,1] A strict version of .  is a variant of & that has no starting value argument, . and thus must be applied to non-empty lists. A strict version of  The 8 function computes the sum of a finite list of numbers. The < function computes the product of a finite list of numbers. 6 breaks a string up into a list of strings at newline = characters. The resulting strings do not contain newlines.  is an inverse operation to . @ It joins lines, after appending a terminating newline to each. ? breaks a string up into a list of words, which were delimited  by white space.  is an inverse operation to . ( It joins words with separating spaces. K % & ' ( ) * $ppK % & ' ( ) * $Unsafe"N The class N/ allows a concrete representation of a type to  be calculated. O$Variant for unary type constructors P%Variant for binary type constructors Q$Variant for 3-ary type constructors R$Variant for 4-ary type constructors S$Variant for 5-ary type constructors T$Variant for 6-ary type constructors U$Variant for 7-ary type constructors Takes a value of type a' and returns a concrete representation  of that type. The value& of the argument should be ignored by  any instance of N, so that it is safe to pass , as  the argument. 3An abstract representation of a type constructor.  objects can  be built using . 4A concrete representation of a (monomorphic) type.  ) supports reasonably efficient equality. 2Applies a type constructor to a sequence of types A special case of , which applies the function & type constructor to a pair of types. &Splits a type constructor application -Applies a type to a function type. Returns:  u if the . first argument represents a function of type t -> u and the / second argument represents a function of type t. Otherwise,  returns . &Adds a TypeRep argument to a TypeRep.  Builds a - object representing a type constructor. An  implementation of  Data.Typeable) should ensure that the following holds: > A==A' ^ B==B' ^ C==C' ==> mkTyCon A B C == mkTyCon A' B' C' 6Observe the type constructor of a type representation 4Observe the argument types of a type representation 1Observe string encoding of a type representation  For defining a N instance from any O instance.  For defining a O instance from any P instance.  For defining a P instance from any Q instance.  For defining a Q instance from any R instance.  For defining a R instance from any S instance. For defining a S instance from any T instance. For defining a T instance from any U instance. +3One Typeable6 instance for all Typeable7 instances ,3One Typeable5 instance for all Typeable6 instances -3One Typeable4 instance for all Typeable5 instances .3One Typeable3 instance for all Typeable4 instances /3One Typeable2 instance for all Typeable3 instances 03One Typeable1 instance for all Typeable2 instances 12One Typeable instance for all Typeable1 instances ?NOPQRSTU package name  module name !the name of the type constructor  A unique  object       2 3 4 5 6 7 8 9 + , - . / 0 1 : ; < =,NOPQRSTU     ,     NOPQRSTU1NOPQRSTU      2 3 4 5 6 7 8 9 + , - . / 0 1 : ; < =$portable experimentallibraries@haskell.org TrustworthyThe type-safe cast operation 4(DEPRECATED) Returns a unique key associated with a . % This function is deprecated because  itself is now an  instance of G(, so mappings can be made directly with   as the key. Backwards-compatible API 9A flexible variation parameterised in a type constructor Cast for * -> * Cast for * -> * -> *  >unique string  A unique  object -NOPQRSTU     0NOPQRSTU      >portable experimentallibraries@haskell.org TrustworthysThe s; type represents values with two possibilities: a value of type s a b is either | a or } b. The s6 type is sometimes used to represent a value which is /either correct or an error; by convention, the | constructor is $used to hold an error value and the } constructor is used to  hold a correct value (mnemonic: "right" also means "correct"). Case analysis for the s type.  If the value is | a, apply the first function to a;  if it is } b, apply the second function to b. Extracts from a list of s all the | elements  All the |" elements are extracted in order. Extracts from a list of s all the } elements  All the }" elements are extracted in order. Partitions a list of s into two lists  All the |0 elements are extracted, in order, to the first ) component of the output. Similarly the } elements are extracted ( to the second component of the output. s|}s|}s|}s|}0non-portable (uses Text.ParserCombinators.ReadP) provisionallibraries@haskell.org Trustworthyequivalent to  with a precedence of 0. The 3 function reads input from a string, which must be + completely consumed by the input process.  ?(HH ?non-portable (GHC extensions)internalcvs-ghc@haskell.orgUnsafe GA finalizer is represented as a pointer to a foreign function that, at G finalisation time, gets as an argument a plain pointer variant of the 8 foreign pointer that the finalizer is associated with. ! The type !+ represents references to objects that are B maintained in a foreign language, i.e., that are not part of the A data structures usually managed by the Haskell storage manager. " The essential difference between !s and vanilla memory  references of type Ptr a& is that the former may be associated  with  finalizers0. A finalizer is a routine that is invoked when D the Haskell storage manager detects that - within the Haskell heap D and stack - there are no more references left that are pointing to  the !/. Typically, the finalizer will, then, invoke C routines in the foreign language that free the resources bound by  the foreign object. The !% is parameterised in the same way as q. The  type argument of !# should normally be an instance of  class F. @8Turns a plain memory reference into a foreign object by E associating a finalizer - given by the monadic operation - with the @ reference. The storage manager will start the finalizer, in a < separate thread, some time after the last reference to the   ForeignPtr7 is dropped. There is no guarantee of promptness, and B in fact there is no guarantee that the finalizer will eventually  run at all. ANote that references from a finalizer do not necessarily prevent + another object from being finalized. If A's finalizer refers to B  (perhaps using '", then the only guarantee is that  B'*s finalizer will never be started before A's. If both A and B A are unreachable, then both finalizers will start together. See  '! for more on finalizer ordering. ""Allocate some memory and return a ! to it. The memory ) will be released automatically when the ! is discarded. " is equivalent to  6 do { p <- malloc; newForeignPtr finalizerFree p } Calthough it may be implemented differently internally: you may not $ assume that the memory returned by " has been  allocated with C.  GHC notes: " has a heavily optimised > implementation in GHC. It uses pinned memory in the garbage  collected heap, so the !! does not require a finalizer to  free the memory. Use of " and associated 4 functions is strongly recommended in preference to  newForeignPtr  with a finalizer. #This function is similar to ", except that the G size of the memory required is given explicitly as a number of bytes. A"Allocate some memory and return a ! to it. The memory ) will be released automatically when the ! is discarded.  GHC notes:  A has a heavily optimised > implementation in GHC. It uses pinned memory in the garbage E collected heap, as for mallocForeignPtr. Unlike mallocForeignPtr, a F ForeignPtr created with mallocPlainForeignPtr carries no finalizers. D It is not possible to add a finalizer to a ForeignPtr created with F mallocPlainForeignPtr. This is useful for ForeignPtrs that will live A only inside Haskell (such as those created for packed strings). E Attempts to add a finalizer to a ForeignPtr created this way, or to 3 finalize such a pointer, will throw an exception. BThis function is similar to #, except that ? the internally an optimised ForeignPtr representation with no > finalizer is used. Attempts to add a finalizer will cause an  exception to be thrown. $AThis function adds a finalizer to the given foreign object. The  finalizer will run before# all other finalizers for the same , object which have already been registered. %Like % but allows the finalizer to be @ passed an additional environment parameter to be passed to the E finalizer. The environment passed to the finalizer is fixed by the  second argument to % C,This function adds a finalizer to the given  ForeignPtr. The  finalizer will run before# all other finalizers for the same , object which have already been registered. This is a variant of addForeignPtrFinalizer, where the finalizer  is an arbitrary IO, action. When it is invoked, the finalizer  will run in a new thread. DNB. Be very careful with these finalizers. One common trap is that @ if a finalizer references another finalized value, it does not : prevent that value from being finalized. In particular, Handles = are finalized objects, so a finalizer should not refer to a Handle  (including stdout, stdin or stderr). &BTurns a plain memory reference into a foreign pointer that may be % associated with finalizers by using $. '1This function ensures that the foreign object in < question is alive at the given place in the sequence of IO  actions. In particular   does a ' after it  executes the user action. CNote that this function should not be used to express dependencies  between finalizers on !"s. For example, if the finalizer  for a ! F1 calls ' on a second  ! F20, then the only guarantee is that the finalizer  for F2+ is never started before the finalizer for F1. They / might be started together if for example both F1 and F2 are D otherwise unreachable, and in that case the scheduler might end up  running the finalizer for F2 first. @In general, it is not recommended to use finalizers on separate A objects with ordering constraints between them. To express the ; ordering robustly requires explicit synchronisation using MVars B between the finalizers, but even then the runtime sometimes runs : multiple finalizers sequentially in a single thread (for C performance reasons), so synchronisation between finalizers could ? result in artificial deadlock. Another alternative is to use  explicit reference counting. (:This function extracts the pointer component of a foreign A pointer. This is a potentially dangerous operations, as if the  argument to ( is the last usage E occurrence of the given foreign pointer, then its finalizer(s) will > be run, which potentially invalidates the plain pointer just  obtained. Hence, ' must be used D wherever it has to be guaranteed that the pointer lives on - i.e.,  has another usage occurrence. =To avoid subtle coding errors, hand written marshalling code  should preferably use  rather  than combinations of ( and  ' . However, the latter routines @ are occasionally preferred in tool generated marshalling code. )This function casts a ! . parameterised by one type into another type. *BCauses the finalizers associated with a foreign pointer to be run  immediately. ! D E F G H I J K! L @"# A B$% M C N O P&' Q()* R S T ! L @"# A B$% C&'()* D G F E H K J I! L @"# A B$% M C N O P&' Q()* R S T7#non-portable (requires concurrency) provisionalffi@haskell.org Trustworthy+DTurns a plain memory reference into a foreign object by associating D a finalizer - given by the monadic operation - with the reference. @ The finalizer will be executed after the last reference to the F foreign object is dropped. There is no guarantee of promptness, and B in fact there is no guarantee that the finalizer will eventually  run at all. ,,This function adds a finalizer to the given !. G The finalizer will run after the last reference to the foreign object  is dropped, but before. all previously registered finalizers for the  same object. +,+,+,+,8portable experimentallibraries@haskell.org Trustworthy-A value of type -3 is an object encapsulated together with its type. A -7 may only represent a monomorphic value; an attempt to  create a value of type - from a polymorphically-typed 4 expression will result in an ambiguity error (see .). Ling a value of type -) returns a pretty-printed representation  of the object's type; useful for debugging. .3Converts an arbitrary value into an object of type -. .The type of the object must be an instance of N, which E ensures that only monomorphically-typed objects may be converted to  -(. To convert a polymorphic object into - , give it - a monomorphic type signature. For example:  toDyn (id :: Int -> Int) / Converts a -/ object back into an ordinary Haskell value of  the correct type. See also 0. 0 Converts a -/ object back into an ordinary Haskell value of  the correct type. See also /. U- V./the dynamically-typed object a default value -returns: the value of the first argument, if 1 it has the correct type, otherwise the value of  the second argument. 0the dynamically-typed object  returns:  a, if the dynamically-typed " object has the correct type (and a is its value),  or  otherwise. 123 W X4NOPQRSTU     -./0123-./0123 U- V./0123 W Xportable experimentallibraries@haskell.org TrustworthyXDClass for string-like datastructures; used by the overloaded string , extension (-foverloaded-strings in GHC). 4X Y4XuuX4X4 Yportable provisionalffi@haskell.org Trustworthy4DA signed integral type that can be losslessly converted to and from  Ptr2. This type is also compatible with the C99 type intptr_t, and 1 can be marshalled to and from that type safely. 5GAn unsigned integral type that can be losslessly converted to and from  Ptr1. This type is also compatible with the C99 type  uintptr_t, and 1 can be marshalled to and from that type safely. 6.Release the storage associated with the given r, which E must have been obtained from a wrapper stub. This should be called E whenever the return value from a foreign import wrapper function is ? no longer required; otherwise, the storage it uses will leak. 7casts a Ptr to a WordPtr 8casts a WordPtr to a Ptr 9casts a Ptr to an IntPtr : casts an IntPtr to a Ptr 4 Z5 [6789: \ ] ^ _qr !"#$456789:q r!"#$649:578 4 Z5 [6789: \ ] ^ _non-portable (GHC Extensions)internalcvs-ghc@haskell.orgUnsafe;BA weak pointer object with a key and a value. The value has type v. AA weak pointer expresses a relationship between two objects, the key and the value/: if the key is considered to be alive by the Cgarbage collector, then the value is also alive. A reference from the value to the key does not keep the key alive. 1A weak pointer may also have a finalizer of type IO (); if it does, Ethen the finalizer will be run at most once, at a time after the key 'has become unreachable by the program ("dead"). The storage manager Eattempts to run the finalizer(s) for an object soon after the object *dies, but promptness is not guaranteed. BIt is not guaranteed that a finalizer will eventually run, and no Fattempt is made to run outstanding finalizers when the program exits. ETherefore finalizers should not be relied on to clean up resources - Gother methods (eg. exception handlers) should be employed, possibly in addition to finalisers. EReferences from the finalizer to the key are treated in the same way Bas references from the value to the key: they do not keep the key Aalive. A finalizer may therefore ressurrect the key, perhaps by 'storing it in the same data structure. CThe finalizer, and the relationship between the key and the value, Aexist regardless of whether the program keeps a reference to the ; object or not. @There may be multiple weak pointers with the same key. In this Acase, the finalizers for each of these weak pointers will all be Crun in some arbitrary order, or perhaps concurrently, when the key Cdies. If the programmer specifies a finalizer that assumes it has Dthe only reference to an object (for example, a file that it wishes Bto close), then the programmer must ensure that there is only one such finalizer. DIf there are no other threads to run, the runtime system will check Ffor runnable finalizers before declaring the system to be deadlocked. <Establishes a weak pointer to k , with value v and a finalizer. @This is the most general interface for building a weak pointer. =>Dereferences a weak pointer. If the key is still alive, then  v is returned (where v is the value! in the weak pointer), otherwise  is returned. The return value of =' depends on when the garbage collector runs, hence it is in the k monad. >@Causes a the finalizer associated with a weak pointer to be run  immediately. ; `<key value  finalizer returns: a weak pointer object => a; `<=> a; `<=> a,portable experimentallibraries@haskell.org Trustworthy?Make a ; pointer to an +, using the second argument as a finalizer  to run when  is garbage-collected @Mutate the contents of an  A'Atomically modifies the contents of an . "This function is useful for using " in a safe way in a multithreaded  program. If you only have one  , then using A to 4 access and modify it will prevent race conditions. $Extending the atomicity to multiple s is problematic, so it A is recommended that if you need to do anything more complicated  then using ) instead is a good idea. ?@A?@A@A??@A:portable experimentallibraries@haskell.org TrustworthyB8Maybe monoid returning the rightmost non-Nothing value. E7Maybe monoid returning the leftmost non-Nothing value. HMonoid under multiplication. KMonoid under addition. N"Boolean monoid under disjunction. Q"Boolean monoid under conjunction. T/The monoid of endomorphisms under composition. W<The dual of a monoid, obtained by swapping the arguments of \. ZFThe class of monoids (types with an associative binary operation that A has an identity). Instances should satisfy the following laws:  mappend mempty x = x mappend x mempty = x 1mappend x (mappend y z) = mappend (mappend x y) z  mconcat =  mappend memptyCThe method names refer to the monoid of lists under concatenation, % but there are many other instances. Minimal complete definition: [ and \. ;Some types can be viewed as a monoid in more than one way, 3 e.g. both addition and multiplication on numbers.  In such cases we often define newtypes and make those instances  of Z, e.g. K and H. [ Identity of \ \An associative operation ]Fold a list using the monoid. , For most types, the default definition for ] will be ? used, but the function is included in the class definition so ? that an optimized version can be provided for specific types. ^An infix synonym for \. bLift a semigroup into  forming a Z according to   #http://en.wikipedia.org/wiki/Monoid: "Any semigroup S may be 5 turned into a monoid simply by adjoining an element e not in S  and defining e*e = e and  e*s = s = s*e for all s " S." Since  there is no " Semigroup" typeclass providing just \, we  use Z instead. .BCDEFGHIJKLMNOPQRSTUVWXYZ[\]^ c d b e f g h i j k l m n o p q rBCDEFGHIJKLMNOPQRSTUVWXYZ[\]^Z[\]^WXYTUVQRSNOPKLMHIJEFGBCDBCDEFGHIJKLMNOPQRSTUVWXYZ[\]^ c d b e f g h i j k l m n o p q rportable experimentallibraries@haskell.org Trustworthy\x{\x{ portablestablelibraries@haskell.org Trustworthy%??%;portable provisionallibraries@haskell.org Trustworthy `7A sample (and useful) hash function for Int and Int32, ? implemented by extracting the uppermost 32 bits of the 64-bit C result of multiplying by a 33-bit constant. The constant is from ' Knuth, derived from the golden ratio:  & golden = round ((sqrt 5 - 1) * 2^32) +We get good key uniqueness on small inputs % (a problem with previous versions): 5 (length $ group $ sort $ map hashInt [-32767..65536]) == 65536 + 32768 a@A sample hash function for Strings. We keep multiplying by the 2 golden ratio and adding. The implementation is:   hashString = foldl' f golden < where f m c = fromIntegral (ord c) * magic + hashInt32 m  magic = 0xdeadbeef 3Where hashInt32 works just as hashInt shown above. >Knuth argues that repeated multiplication by the golden ratio 2 will minimize gaps in the hash space, and thus it's a good choice 3 for combining together multiple keys to form one. DHere we know that individual characters c are often small, and this 8 produces frequent collisions if we use ord c alone. A = particular problem are the shorter low ASCII and ISO-8859-1 B character strings. We pre-multiply by a magic twiddle factor to A obtain a good distribution. In fact, given the following test:   testp :: Int32 -> Int A testp k = (n - ) . length . group . sort . map hs . take n $ ls : where ls = [] : [c : l | l <- ls, c <- ['\0'..'\xff']]  hs = foldl' f golden 8 f m c = fromIntegral (ord c) * k + hashInt32 m  n = 100000 "We discover that testp magic = 0. b0A prime larger than the maximum hash table size cFCreates a new hash table. The following property should hold for the eq  and hash functions passed to c:  eq A B => hash A == hash B d6Creates a new hash table with the given minimum size. e Inserts a key/#value mapping into the hash table.  Note that e doesn'(t remove the old entry from the table - 2 the behaviour is like an association list, where h returns A the most-recently-inserted mapping for a key in the table. The  reason for this is to keep e as efficient as possible. If / you need to update a mapping, then we provide g. f%Remove an entry from the hash table. g.Updates an entry in the hash table, returning { if there was # already an entry for this key, or x otherwise. After g H there will always be exactly one entry for the given key in the table. e is more efficient than g if you don' t care about A multiple entries, or you know for sure that multiple entries can't  occur. However, g is more efficient than f followed  by e. h/Looks up the value of a key in the hash table. iConvert a list of key/1value pairs into a hash table. Equality on keys 1 is taken from the Eq instance for the key type. j&Converts a hash table to a list of key/ value pairs. k:This function is useful for determining whether your hash E function is working well for your data set. It returns the longest  chain of key/5value pairs in the hash table for which all the keys D hash to the same bucket. If this chain is particularly long (say, E longer than 14 elements or so), then it might be a good idea to try  a different hash function. ? s t u v w x y z { | } ~  _ ` ab ceq!: An equality comparison on keys hash: A hash function on keys Returns: an empty hash table deq!: An equality comparison on keys hash: A hash function on keys minSize: initial table size Returns: an empty hash table e fghij k _`abcdefghijk _cdefhgij`abk- s u t v w x y z { | } ~  _ ` ab c de fghij k portablestablelibraries@haskell.org Trustworthyl ' comparing p x y = compare (p x) (p y) 2Useful combinator for use in conjunction with the xxxBy family  of functions from  Data.List, for example: " ... sortBy (comparing fst) ... l &Gf~l G&f~llportable provisionalffi@haskell.orgUnsafem;Turns a plain memory reference into a foreign pointer, and C associates a finalizer with the reference. The finalizer will be E executed after the last reference to the foreign object is dropped. D There is no guarantee of promptness, however the finalizer will be $ executed before the program exits. n5This is a way to look at the pointer living inside a : foreign object. This function takes a function which is ( applied to that pointer. The resulting k action is then < executed. The foreign object is kept alive at least during 3 the whole action, even if it is not used directly = inside. Note that it is not safe to return the pointer from < the action and use it after the action completes. All uses % of the pointer should be inside the  n bracket. The reason for $ this unsafeness is the same as for  ( below: the finalizer > may run earlier than expected, because the compiler can only  track usage of the ! object, not  a q object made from it. 7This function is normally used for marshalling data to & or from the object pointed to by the  ! , using the operations from the  F class. oThis variant of m" adds a finalizer that expects an D environment in addition to the finalized pointer. The environment I that will be passed to the finalizer is fixed by the second argument to  o. pThis function is similar to L, F but yields a memory area that has a finalizer attached that releases  the memory area. As with ", it is not guaranteed that & the block of memory was allocated by C. qThis function is similar to L, F but yields a memory area that has a finalizer attached that releases  the memory area. As with ", it is not guaranteed that & the block of memory was allocated by C. mnopq !"#$%&'()*mnopqmnopq5portable provisionalffi@haskell.org Trustworthy !"#$%&')*mnopq! m&$o%n*')"#pq6portable provisionalffi@haskell.orgUnsafe((portable provisionalffi@haskell.orgUnsafer !"#$%&')*mnopqrr=non-portable (GHC Extensions)internalcvs-ghc@haskell.org TrustworthywBA mutable array of bytes that can be passed to foreign functions. AThe buffer is represented by a record, where the record contains  the raw buffer and the start/'end points of the filled portion. The B buffer contents itself is mutable, but the rest of the record is @ immutable. This is a slightly odd mix, but it turns out to be B quite practical: by making all the buffer metadata immutable, we A can have operations on buffer metadata outside of the IO monad. The live. elements of the buffer are those between the | and  } offsets. In an empty buffer, | is equal to }, but E they might not be zero: for exmaple, the buffer might correspond to ( a memory-mapped file and in which case | will point to the E next location to be written, which is not necessarily the beginning  of the file. 3slides the contents of the buffer to the beginning *stuvwxyz{|}~  (stuvwxyz{|}~(wxyz{|}sutv~"sutvwxyz{|}~  > non-portableinternallibraries@haskell.org Trustworthy AStopped because there are sufficient free elements in the output H to output at least one encoded ASCII character, but the input contains ( an invalid or unrepresentable sequence ?Stopped because the output contains insufficient free elements DStopped because the input contains insufficient available elements, ? or all of the input sequence has been sucessfully translated. A + is a specification of a conversion scheme A between sequences of bytes and sequences of Unicode characters. HFor example, UTF-8 is an encoding of Unicode characters into a sequence  of bytes. The  for UTF-8 is utf8. a string that can be passed to mkTextEncoding to  create an equivalent . GCreates a means of decoding bytes into characters: the result must not K be shared between several byte sequences or simultaneously across threads ECreates a means of encode characters into bytes: the result must not P be shared between several character sequences or simultaneously across threads The encode, function translates elements of the buffer from  to the buffer to4. It should translate as many elements as possible E given the sizes of the buffers, including translating zero elements ' if there is either not enough room in to, or from does not ( contain a complete multibyte sequence. LThe fact that as many elements as possible are translated is used by the IO A library in order to report translation errors at the point they < actually occur, rather than when the buffer is translated. LTo allow us to use iconv as a BufferCode efficiently, character buffers are Q defined to contain lone surrogates instead of those private use characters that R are used for roundtripping. Thus, Chars poked and peeked from a character buffer P must undergo surrogatifyRoundtripCharacter and desurrogatifyRoundtripCharacter  respectively. 5For more information on this, see Note [Roundtripping] in GHC.IO.Encoding.Failure. The recover' function is used to continue decoding H in the presence of invalid or unrepresentable sequences. This includes  both those detected by encode returning InvalidSequence and those E that occur because the input byte sequence appears to be truncated. CProgress will usually be made by skipping the first element of the from I buffer. This function should only be called if you are certain that you % wish to do this skipping and if the to! buffer has at least one element N of free space. Because this function deals with decoding failure, it assumes 0 that the from buffer has at least one element. recover7 may raise an exception rather than skipping anything. #Currently, some implementations of recover may mutate the input buffer. C In particular, this feature is used to implement transliteration. <Resources associated with the encoding may now be released.  The encode0 function may not be called again after calling  close. 'Return the current state of the codec. AMany codecs are not stateful, and in these case the state can be  represented as '()''. Other codecs maintain a state. For A example, UTF-16 recognises a BOM (byte-order-mark) character at A the beginning of the input, and remembers thereafter whether to @ use big-endian or little-endian mode. In this case, the state B of the codec would include two pieces of information: whether we @ are at the beginning of the stream (the BOM only occurs at the A beginning), and if not, whether to use the big or little-endian  encoding.   @non-portable (GHC Extensions)internalcvs-ghc@haskell.org TrustworthyThe purpose of ' is to provide a common interface for I/O F devices that can read and write data through a buffer. Devices that  implement . include ordinary files, memory-mapped files, 8 and bytestrings. The underlying device implementing a Handle must  provide . 9allocate a new buffer. The size of the buffer is at the = discretion of the device; e.g. for a memory-mapped file the - buffer will probably cover the entire file. <reads bytes into the buffer, blocking if there are no bytes > available. Returns the number of bytes read (zero indicates # end-of-file), and the new buffer. ;reads bytes into the buffer without blocking. Returns the C number of bytes read (Nothing indicates end-of-file), and the new  buffer. =Prepares an empty write buffer. This lets the device decide A how to set up a write buffer: the buffer may need to point to a C specific location in memory, for example. This is typically used ; by the client when switching from reading to writing on a  buffered read/write device. EThere is no corresponding operation for read buffers, because before % reading the client will always call . EFlush all the data from the supplied write buffer out to the device. = The returned buffer should be empty, and ready for writing. <Flush data from the supplied write buffer out to the device @ without blocking. Returns the number of bytes written and the  remaining buffer.    non-portableinternallibraries@haskell.org TrustworthyASpecifies the translation, if any, of newline characters between D internal Strings and the external file or stream. Haskell Strings , are assumed to represent newlines with the '\n' character; the ) newline mode specifies how to translate '\n' on output, and what to  translate into '\n' on input. (the representation of newlines on input )the representation of newlines on output @The representation of a newline in the external file or stream. '\r\n' '\n' 9Three kinds of buffering are supported: line-buffering, B block-buffering or no-buffering. These modes have the following 0 effects. For output, items are written out, or flushed, 8 from the internal buffer according to the buffer mode:  line-buffering&: the entire output buffer is flushed 9 whenever a newline is output, the buffer overflows,  a % is issued, or the handle is closed.  block-buffering/: the entire buffer is written out whenever it  overflows, a % is issued, or the handle is closed.   no-buffering2: output is written immediately, and never stored  in the buffer. ?An implementation is free to flush the buffer more frequently, 0 but not less frequently, than specified above. B The output buffer is emptied as soon as it has been written out. ESimilarly, input occurs according to the buffer mode for the handle:  line-buffering/: when the buffer for the handle is not empty, C the next item is obtained from the buffer; otherwise, when the E buffer is empty, characters up to and including the next newline E character are read into the buffer. No characters are available D until the newline character is available or the buffer is full.  block-buffering0: when the buffer for the handle becomes empty, 4 the next block of data is read into the buffer.   no-buffering,: the next input item is read and returned.  The + operation implies that even a no-buffered / handle may require a one-character buffer. 6The default buffering mode when a handle is opened is C implementation-dependent and may depend on the file system object # which is attached to that handle. K For most implementations, physical files will normally be block-buffered / and terminals will normally be line-buffered. /block-buffering should be enabled if possible.  The size of the buffer is n items if the argument  is  n, and is otherwise implementation-dependent. .line-buffering should be enabled if possible. #buffering is disabled if possible. KHaskell defines operations to read and write characters from and to files,  represented by values of type Handle . Each value of this type is a  handle2: a record used by the Haskell run-time system to manage I/O L 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; E 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 where the next 4 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. H Once it is closed it can no longer be used for either input or output, E though an implementation cannot re-use its storage while references # remain to it. Handles are in the L and ? classes. The string E produced by showing a handle is system dependent; it should include G enough information to identify the handle for debugging. A handle is  equal according to % only to itself; no attempt J is made to compare the internal state of different handles for equality. <The native newline representation for the current platform:   on Unix systems,  on Windows. Map '\r\n' into '\n' on input, and '\n' to the native newline G represetnation on output. This mode can be used on any platform, and F works with text files using any newline convention. The downside is  that readFile >>= writeFile might yield a different file. 9 universalNewlineMode = NewlineMode { inputNL = CRLF, B outputNL = nativeNewline } ?Use the native newline representation on both input and output = nativeNewlineMode = NewlineMode { inputNL = nativeNewline ? outputNL = nativeNewline } "Do no newline translation at all. F noNewlineTranslation = NewlineMode { inputNL = LF, outputNL = LF } 3   7          non-portableinternallibraries@haskell.org TrustworthyD*The Haskell 98 type for exceptions in the k monad.  Any I/O operation may raise an D instead of returning a result. G For a more general type of exception, including also those that arise  in pure code, see Control.Exception.Exception. 'In Haskell 98, this is an opaque type. EExceptions that occur in the IO monad.  An  IOException3 records a more specific error type, a descriptive > string and maybe the handle that was used when the error was  flagged. F Construct an D+ value with a string describing the error.  The ( method of the k instance of the C class raises a  F, thus:  instance Monad IO where  ... " fail s = ioError (userError s) ;An abstract type that contains a value for each variant of D. 2Defines the exit codes that a program can return. -indicates program failure with an exit code. ) The exact interpretation of the code is 9 operating-system dependent. In particular, some values 9 may be prohibited (e.g. 0 on a POSIX-compliant system). "indicates successful termination; )Exceptions generated by array operations 1An attempt was made to evaluate an element of an & array that had not been initialized. .An attempt was made to index an array outside  its declared bounds. Asynchronous exceptions. :This exception is raised by default in the main thread of = the program when the user requests to terminate the program = via the usual mechanism(s) (e.g. Control-C in the console). +This exception is raised by another thread  calling S, or by the system . if it needs to terminate the thread for some  reason.  The program'"s heap is reaching its limit, and 8 the program should take action to reduce the amount of  live data it has. Notes: 7 It is undefined which thread receives this exception.  GHC currently does not throw  exceptions. The current thread's stack exceeded its limit. / Since an exception has been raised, the thread's stack 2 will certainly be below its limit again, but the ( programmer should take remedial action  immediately.  was applied to x. =There are no runnable threads, so the program is deadlocked.  The Deadlock. exception is raised in the main thread only. DThe 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 thread is blocked on an MVar$, but there are no other references  to the MVar so it can't ever continue.  Raise an D in the k monad. L DE F   : DE F   & DE F   Cportable provisionalffi@haskell.org Trustworthy.A pointer to a foreign function equivalent to , which may be  used as a finalizer (cf ) for storage  allocated with , ,  or . EAllocate a block of memory that is sufficient to hold values of type  a7. The size of the area allocated is determined by the G  method from the instance of F for the appropriate type. $The memory may be deallocated using  or  when  no longer required. 9Allocate a block of memory of the given number of bytes. B The block of memory is sufficiently aligned for any of the basic D foreign types that fits into a memory block of the allocated size. $The memory may be deallocated using  or  when  no longer required.  f executes the computation f, passing as argument D a pointer to a temporarily allocated block of memory sufficient to  hold values of type a. The memory is freed when f' terminates (either normally or via an & exception), so the pointer passed to f must not be used after this.  n f executes the computation f, passing as argument 9 a pointer to a temporarily allocated block of memory of n bytes. B The block of memory is sufficiently aligned for any of the basic D foreign types that fits into a memory block of the allocated size. The memory is freed when f' terminates (either normally or via an & exception), so the pointer passed to f must not be used after this. -Resize a memory area that was allocated with  or  , to the size needed to store values of type b. The returned pointer F may refer to an entirely different memory area, but will be suitably  aligned to hold values of type b". The contents of the referenced C memory area will be the same as of the original pointer up to the = minimum of the original size and the size of values of type b. If the argument to  is ,  behaves like  . -Resize a memory area that was allocated with  or  C to the given size. The returned pointer may refer to an entirely H different memory area, but will be sufficiently aligned for any of the F basic foreign types that fits into a memory block of the given size. C The contents of the referenced memory area will be the same as of E the original pointer up to the minimum of the original size and the  given size. If the pointer argument to  is ,   behaves like . If the requested size is 0,   behaves like . /Free a block of memory that was allocated with ,  , , , K  or any of the newX functions in Foreign.Marshal.Array or  Foreign.C.String.      D non-portableinternallibraries@haskell.org TrustworthyThe  is used to construct  TextEncodings, and . specifies how they handle illegal sequences. 9Use the private-use escape mechanism to attempt to allow ' illegal sequences to be roundtripped. 6Replace with the closest visual match upon an illegal  sequence 8Attempt to ignore and recover if an illegal sequence is  encountered 7Throw an error when an illegal sequence is encountered ;In transliterate mode, we use this character when decoding  unknown bytes. 3This is the defined Unicode replacement character:   <http://www.fileformat.info/info/unicode/char/0fffd/index.htm Some characters are actually  surrogate codepoints defined for D use in UTF-16. We need to signal an invalid character if we detect " them when encoding a sequence of ]s into ms because they  won't give valid Unicode. BWe may also need to signal an invalid character if we detect them  when encoding a sequence of ]s into ms because the  0 mode creates these to round-trip bytes through  our internal UTF-16 encoding.    E non-portableinternallibraries@haskell.org Trustworthy      F non-portableinternallibraries@haskell.org Trustworthy   byte to check  lower bound  upper bound    G non-portableinternallibraries@haskell.org Trustworthy !"#$%&'()*  +,-      !"#$%&'()*  +,-H non-portableinternallibraries@haskell.org Trustworthy  ./ 0123456789:;<          ./ 0123456789:;<Iportable provisionalffi@haskell.org Trustworthy Execute an k action, throwing a F if the predicate yields  {, when applied to the result returned by the k action. B If no exception is raised, return the result of the computation. Like , but discarding the result &Guards against negative result values Like , but discarding the result Guards against null pointers Discard the return value of an k action %error condition on the result of the k action 1computes an error message from erroneous results  of the k action the k action to be executed Kportable provisionalffi@haskell.org Trustworthy =+Basic C routines needed for memory copying 7Allocate a block of memory and marshal a value into it  (the combination of  and N). 5 The size of the area allocated is determined by the 3  method from the instance of F for the appropriate type. $The memory may be deallocated using C or  C when no longer required.    val f executes the computation f, passing as argument A a pointer to a temporarily allocated block of memory into which  val) has been marshalled (the combination of  and N). The memory is freed when f' terminates (either normally or via an & exception), so the pointer passed to f must not be used after this. !Convert a Haskell \ to its numeric representation "?Convert a Boolean in numeric representation to a Haskell value #=Allocate storage and marshal a storable value wrapped into a   the  is used to represent  $ Converts a withXXX1 combinator into one marshalling a value wrapped  into a , using  to represent . %/Convert a peek combinator into a one returning  if applied to a   & Replicates a withXXX7 combinator over a list of objects, yielding a list of  marshalled objects 'HCopies the given number of bytes from the second area (source) into the + first (destination); the copied areas may not overlap (HCopies the given number of bytes from the second area (source) into the ' first (destination); the copied areas may overlap >= !"#$%&'(  !"#$%&'(  !"#$%&'( >= !"#$%&'(Lportable provisionalffi@haskell.org Trustworthy)EAllocate storage for the given number of elements of a storable type  (like C, but for multiple elements). *Like )., but add an extra position to hold a special  termination element. +<Temporarily allocate space for the given number of elements  (like C, but for multiple elements). ,Like +., but add an extra position to hold a special  termination element. -Adjust the size of an array .LAdjust the size of an array including an extra position for the end marker. /JConvert an array of given length into a Haskell list. The implementation 5 is tail-recursive and so uses constant stack space. 0HConvert an array terminated by the given end marker into a Haskell list 10Write the list elements consecutive into memory 2LWrite the list elements consecutive into memory and terminate them with the  given marker element 3FWrite a list of storable elements into a newly allocated, consecutive  sequence of storable values  (like K, but for multiple elements). 4FWrite a list of storable elements into a newly allocated, consecutive M sequence of storable values, where the end is fixed by the given end marker 56Temporarily store a list of storable values in memory  (like K, but for multiple elements). 6Like 5+, but the action gets the number of values  as an additional parameter 7Like 52, but a terminator indicates where the array ends 8Like 62, but a terminator indicates where the array ends 9JCopy the given number of elements from the second array (source) into the 1 first array (destination); the copied areas may not overlap :JCopy the given number of elements from the second array (source) into the - first array (destination); the copied areas may overlap ;DReturn the number of elements in an array, excluding the terminator <@Advance a pointer into an array by the given number of elements )*+,-./0123456789:;<)*+,-./0123456789:;<)*+,-./0123457689:;<)*+,-./0123456789:;<M non-portableinternallibraries@haskell.org Trustworthy=9Marshal a NUL terminated C string into a Haskell string. >?Marshal a C string with explicit length into a Haskell string. ?9Marshal a Haskell string into a NUL terminated C string.  the Haskell string may not contain any NUL characters 7 new storage is allocated for the C string and must be  explicitly freed using  or  . @DMarshal a Haskell string into a C string (ie, character array) with  explicit length information. 7 new storage is allocated for the C string and must be  explicitly freed using  or  . AHMarshal a Haskell string into a NUL terminated C string using temporary  storage.  the Haskell string may not contain any NUL characters @ the memory is freed when the subcomputation terminates (either B normally or via an exception), so the pointer to the temporary  storage must not be used after this. B?Marshal a Haskell string into a C string (ie, character array) 9 in temporary storage, with explicit length information. @ the memory is freed when the subcomputation terminates (either B normally or via an exception), so the pointer to the temporary  storage must not be used after this. C>Determines whether a character can be accurately encoded in a ?. GPretty much anyone who uses this function is in a state of sin because I whether or not a character is encodable will, in general, depend on the  context in which it occurs. @?AB=>?@ABCCDEEncoding of CString String in Haskell terms FEncoding of CString to create Null-terminate? String to encode 0Worker that can safely use the allocated memory GEncoding of CString to create Null-terminate? String to encode H=>?@ABC=>?@ABC@?AB=>?@ABCCDEFGHNportable provisionalffi@haskell.org TrustworthyD<A wide character string with explicit length information in ds E instead of a terminating NUL (allowing NUL characters in the middle  of the string). E@A C wide string is a reference to an array of C wide characters  terminated by NUL. F@A string with explicit length information in bytes instead of a H terminating NUL (allowing NUL characters in the middle of the string). GIA C string is a reference to an array of C characters terminated by NUL. H9Marshal a NUL terminated C string into a Haskell string. I?Marshal a C string with explicit length into a Haskell string. J9Marshal a Haskell string into a NUL terminated C string.  the Haskell string may not contain any NUL characters 7 new storage is allocated for the C string and must be  explicitly freed using C or  C. KDMarshal a Haskell string into a C string (ie, character array) with  explicit length information. 7 new storage is allocated for the C string and must be  explicitly freed using C or  C. LHMarshal a Haskell string into a NUL terminated C string using temporary  storage.  the Haskell string may not contain any NUL characters @ the memory is freed when the subcomputation terminates (either B normally or via an exception), so the pointer to the temporary  storage must not be used after this. M?Marshal a Haskell string into a C string (ie, character array) 9 in temporary storage, with explicit length information. @ the memory is freed when the subcomputation terminates (either B normally or via an exception), so the pointer to the temporary  storage must not be used after this. OIConvert a C byte, representing a Latin-1 character, to the corresponding  Haskell character. P.Convert a Haskell character to a C character. 9 This function is only safe on the first 256 characters. Q Convert a C  unsigned char', representing a Latin-1 character, to & the corresponding Haskell character. R#Convert a Haskell character to a C  unsigned char. 9 This function is only safe on the first 256 characters. S Convert a C  signed char+, representing a Latin-1 character, to the " corresponding Haskell character. T#Convert a Haskell character to a C  signed char. 9 This function is only safe on the first 256 characters. U9Marshal a NUL terminated C string into a Haskell string. V?Marshal a C string with explicit length into a Haskell string. W9Marshal a Haskell string into a NUL terminated C string.  the Haskell string may not contain any NUL characters 7 new storage is allocated for the C string and must be  explicitly freed using C or  C. XDMarshal a Haskell string into a C string (ie, character array) with  explicit length information. 7 new storage is allocated for the C string and must be  explicitly freed using C or  C. YHMarshal a Haskell string into a NUL terminated C string using temporary  storage.  the Haskell string may not contain any NUL characters @ the memory is freed when the subcomputation terminates (either B normally or via an exception), so the pointer to the temporary  storage must not be used after this. Z?Marshal a Haskell string into a C string (ie, character array) 9 in temporary storage, with explicit length information. @ the memory is freed when the subcomputation terminates (either B normally or via an exception), so the pointer to the temporary  storage must not be used after this. [>Marshal a NUL terminated C wide string into a Haskell string. \DMarshal a C wide string with explicit length into a Haskell string. ]>Marshal a Haskell string into a NUL terminated C wide string.  the Haskell string may not contain any NUL characters 9 new storage is allocated for the C wide string and must  be explicitly freed using C or  C. ^IMarshal a Haskell string into a C wide string (ie, wide character array) # with explicit length information. 9 new storage is allocated for the C wide string and must  be explicitly freed using C or  C. _CMarshal a Haskell string into a NUL terminated C wide string using  temporary storage.  the Haskell string may not contain any NUL characters @ the memory is freed when the subcomputation terminates (either B normally or via an exception), so the pointer to the temporary  storage must not be used after this. `9Marshal a Haskell string into a C wide string (i.e. wide = character array) in temporary storage, with explicit length  information. @ the memory is freed when the subcomputation terminates (either B normally or via an exception), so the pointer to the temporary  storage must not be used after this. $DEFGHIJKLMNOPQRSTUVWXYZIJ[\]^_`KLMNODEFGHIJKLMNOPQRSTUVWXYZ[\]^_`GFHIJKLMNPORQTSUVWXYZED[\]^_`$DEFGHIJKLMNOPQRSTUVWXYZIJ[\]^_`KLMNOOportable provisionalffi@haskell.org TrustworthyaHaskell representation for errno values. C The implementation is deliberately exposed, to allow users to add  their own definitions of a values. Yield { if the given a value is valid on the system.  This implies that the ? instance of a is also system dependent + as it is only defined for valid values of a. Get the current value of errno in the current thread. Reset the current thread's errno value to c.  Throw an D' corresponding to the current value of .  Throw an D' corresponding to the current value of   if the result value of the k# action meets the given predicate. as !, but discards the result of the k action after  error handling. as , but retry the k action when it yields the  error code / - this amounts to the standard retry loop for ! interrupted POSIX system calls. as %, but additionally if the operation  yields the error code j or , an alternative % action is executed before retrying. as , but discards the result. as , but discards the result.  Throw an D' corresponding to the current value of   if the k action returns a result of -1. as , but discards the result.  Throw an D' corresponding to the current value of   if the k action returns a result of -1, but retries in case of  an interrupted operation. as , but discards the result. as ., but checks for operations that would block. as , but discards the result.  Throw an D' corresponding to the current value of   if the k action returns .  Throw an D' corresponding to the current value of   if the k action returns , 0 but retry in case of an interrupted operation. as ., but checks for operations that would block. as :, but exceptions include the given path when appropriate. as -, but exceptions include the given path when  appropriate. as -, but exceptions include the given path when  appropriate. as -, but exceptions include the given path when  appropriate. as -, but exceptions include the given path when  appropriate. as -, but exceptions include the given path when  appropriate.  Construct an D based on the given a value. A The optional information can be used to improve the accuracy of  error messages. abPQRcdefghijklmnopqrstuvwxyz{|}~*textual description of the error location 'predicate to apply to the result value  of the k operation $textual description of the location the k operation to be executed 'predicate to apply to the result value  of the k operation $textual description of the location the k operation to be executed %action to execute before retrying if  an immediate retry would block &the location where the error occurred the error number *optional handle associated with the error ,optional filename associated with the error Sabcdefghijklmnopqrstuvwxyz{|}~abcdefghijklmnopqrstuvwxyz{|}~abPQRcdefghijklmnopqrstuvwxyz{|}~Sportable provisionalffi@haskell.orgSafeOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~DEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~Pportable provisionalsven.panne@aedion.de TrustworthyA memory pool. Allocate a fresh memory pool. HDeallocate a memory pool and everything which has been allocated in the  pool itself. EExecute an action with a fresh memory pool, which gets automatically E deallocated (including its contents) after the action has finished. IAllocate space for storable type in the given pool. The size of the area  allocated is determined by the G method from the instance of  F for the appropriate type. ;Allocate the given number of bytes of storage in the pool. HAdjust the storage area for an element in the pool to the given size of  the required type. FAdjust the storage area for an element in the pool to the given size. LAllocate storage for the given number of elements of a storable type in the  pool. LAllocate storage for the given number of elements of a storable type in the K pool, but leave room for an extra element to signal the end of the array. /Adjust the size of an array in the given pool. BAdjust the size of an array with an end marker in the given pool. JAllocate storage for a value in the given pool and marshal the value into  this storage. HAllocate consecutive storage for a list of values in the given pool and  marshal these values into it. HAllocate consecutive storage for a list of values in the given pool and J marshal these values into it, terminating the end with the given marker. TTportable provisionalffi@haskell.orgSafe< !"#$%&'()*+,-./0123456789:;<Qportable provisionalffi@haskell.orgUnsafeGSometimes an external entity is a pure function, except that it passes  arguments and/'or results via pointers. The function unsafeLocalState0 permits the packaging of such entities as pure  functions. :The only IO operations allowed in the IO action passed to unsafeLocalState are (a) local allocation (alloca,  allocaBytes and derived operations such as  withArray and  withCString ), and (b) pointer operations (Foreign.Storable and  Foreign.Ptr ) on the @pointers to local storage, and (c) foreign functions whose only  observable effect is to read and/or write the locally allocated @memory. Passing an IO operation that does not obey these rules  results in undefined behaviour. +It is expected that this operation will be *replaced in a future revision of Haskell. = !"#$%&'()*+,-./0123456789:;<<portable provisionalffi@haskell.orgUnsafe`abcdjlmnopqrfghijklmnopqrstuvwxyz !"#$%&'(FGHIJKLMN !"#$%&')*456789:mnopqr !"#$%&'()*+,-./0123456789:;<! m&$o%n*')"#pqrTnon-portable (GHC extensions)internalcvs-ghc@haskell.orgUnsafe.AShared memory locations that support atomic memory transactions. /A monad supporting atomic memory transactions. The current status of a thread *the thread received an uncaught exception 'the thread is blocked on some resource the thread has finished ,the thread is currently runnable or running )blocked on some other resource. Without  -threaded,  I/O and  threadDelay show up as , with  -threaded  they show up as . currently in a foreign call  blocked in  in an STM transaction  blocked in  7blocked on a computation in progress by another thread blocked on on ] A 8 is an abstract type representing a handle to a thread.  is an instance of ?, G and L, where the G6 instance implements an arbitrary total ordering over s. The L/ instance lets you convert an arbitrary-valued  to string form; showing a  value is occasionally Buseful when debugging or diagnosing the behaviour of a concurrent  program. Note: in GHC, if you have a , you essentially have Aa pointer to the thread itself. This means the thread itself can't be %garbage collected until you drop the . =This misfeature will hopefully be corrected at a later date. Note9: Hugs does not provide any operations on other threads;  it defines  as a synonym for (). #Sparks off a new thread to run the k computation passed as the  first argument, and returns the  of the newly created thread. JThe new thread will be a lightweight thread; if you want to use a foreign ,library that uses thread-local storage, use S instead. &GHC note: the new thread inherits the masked state of the parent (see U). DThe newly created thread has an exception handler that discards the  exceptions , , and 2, and passes all other exceptions to the uncaught exception handler. !This function is deprecated; use forkIOWIthUnmask instead Like 5, but the child thread is passed a function that can > be used to unmask asynchronous exceptions. This function is % typically used in the following way  , ... mask_ $ forkIOWithUnmask $ \unmask -> , catch (unmask ...) handler Aso that the exception handler in the child thread is established A with asynchronous exceptions masked, meanwhile the main body of 5 the child thread is executed in the unmasked state. @Note that the unmask function passed to the child thread should B only be used in that thread; the behaviour is undefined if it is  invoked in a different thread. Like 5, but lets you specify on which processor the thread should run. Unlike a  thread, a thread created by  9will stay on the same processor for its entire lifetime ( Cthreads can migrate between processors according to the scheduling  policy). 5 is useful for overriding the scheduling policy when 8you know in advance how best to distribute the threads. The ` argument specifies a capability number (see  2). Typically capabilities correspond to physical Fprocessors, but the exact behaviour is implementation-dependent. The value passed to + is interpreted modulo the total number of capabilities as returned by  . 9GHC note: the number of capabilities is specified by the +RTS -N Boption when the program is started. Capabilities can be fixed to actual processor cores with +RTS -qa if the underlying operating Gsystem supports that, although in practice this is usually unnecessary F(and may actually degrade perforamnce in some cases - experimentation is recommended). !This function is deprecated; use  instead !This function is deprecated; use forkOnWIthUnmask instead  Like (, but the child thread is pinned to the  given CPU, as with .  the value passed to the +RTS -N flag. This is the number of @ Haskell threads that can run truly simultaneously at any given I time, and is typically set to the number of physical processor cores on  the machine. &Strictly speaking it is better to use   , because 3 the number of capabilities might vary at runtime.  9Returns the number of Haskell threads that can run truly Dsimultaneously (on separate physical processors) at any given time. The number passed to  is interpreted modulo this value. BAn implementation in which Haskell threads are mapped directly to BOS threads might return the number of physical processor cores in the machine, and " would be implemented using the OS's ?affinity facilities. An implementation that schedules Haskell Dthreads onto a smaller number of OS threads (like GHC) would return Bthe number of such OS threads that can be running simultaneously. AGHC notes: this returns the number passed as the argument to the +RTS -N7 flag. In current implementations, the value is fixed Cwhen the program starts and never changes, but it is possible that @in the future the number of capabilities might vary at runtime.  DSet the number of Haskell threads that can run truly simultaneously 5(on separate physical processors) at any given time. @GHC notes: in the current implementation, the value may only be  increased, not decreased, by calling  . The initial value is given by the +RTS -N flag, and the current value may be obtained using  . ?Returns the number of sparks currently in the local spark pool  raises the  exception in the given thread (GHC only). + killThread tid = throwTo tid ThreadKilled @ raises an arbitrary exception in the target thread (GHC only). < does not return until the exception has been raised in the target thread. 7The calling thread can thus be certain that the target Fthread has received the exception. This is a useful property to know Ewhen dealing with race conditions: eg. if there are two threads that Ccan kill each other, it is guaranteed that only one of the threads will get to kill the other. AWhatever work the target thread was doing when the exception was Craised is not lost: the computation is suspended until required by another thread. BIf the target thread is currently making a foreign call, then the (exception will not be raised (and hence  will not return) Funtil the call has completed. This is the case regardless of whether the call is inside a X) or not. However, in GHC a foreign call can be annotated as  interruptible, in which case a  will Bcause the RTS to attempt to cause the call to return; see the GHC  documentation for more details. !Important note: the behaviour of  differs from that described in  the paper ""Asynchronous exceptions in Haskell" ( =http://research.microsoft.com/~simonpj/Papers/asynch-exns.htm). In the paper, 8 is non-blocking; but the library implementation adopts #a more synchronous design in which % does not return until the exception Yis received by the target thread. The trade-off is discussed in Section 9 of the paper. Like any blocking operation, 0 is therefore interruptible (see Section 5.3 of =the paper). Unlike other interruptible operations, however,  is always4 interruptible, even if it does not actually block. EThere is no guarantee that the exception will be delivered promptly, =although the runtime will endeavour to ensure that arbitrary  delays don'9t occur. In GHC, an exception can only be raised when a thread reaches a  safe point%, where a safe point is where memory Dallocation occurs. Some loops do not perform any memory allocation 9inside the loop and therefore cannot be interrupted by a . If the target of + is the calling thread, then the behaviour is the same as U, except that the exception Eis thrown as an asynchronous exception. This means that if there is Fan enclosing pure computation, which would be the case if the current IO operation is inside O or Q, that Acomputation is not permanently replaced by the exception, but is ;suspended as if it had received an asynchronous exception.  Note that if * is called with the current thread as the Etarget, the exception will be thrown even if the thread is currently inside X or Z.  Returns the # of the calling thread (GHC only). The 7 action allows (forces, in a co-operative multitasking B implementation) a context-switch to any other currently runnable @ threads (if any), and is occasionally useful when implementing  concurrency abstractions. 2 stores a string as identifier for this thread if Hyou built a RTS with debugging support. This identifier will be used in Ethe debugging output to make distinction of different threads easier 0(otherwise you only have the thread state object's address in the heap). BOther applications like the graphical Concurrent Haskell Debugger ( +http://www.informatik.uni-kiel.de/~fhu/chd/) may choose to overload  for their purposes as well. 1Internal function used by the RTS to run sparks. Freturns the number of the capability on which the thread is currently C running, and a boolean indicating whether the thread is locked to C that capability or not. A thread is locked to a capability if it  was created with forkOn. AUnsafely performs IO in the STM monad. Beware: this is a highly  dangerous thing to do. = The STM implementation will often run transactions multiple C times, so you need to be prepared for this if your IO has any  side effects. B The STM implementation will abort transactions that are known to I be invalid and need to be restarted. This may happen in the middle  of , so make sure you don't acquire any resources G that need releasing (exception handlers are ignored when aborting F the transaction). That includes doing any IO using Handles, for J example. Getting this wrong will probably lead to random deadlocks. C The transaction may have seen an inconsistent view of memory when D the IO runs. Invariants that you expect to be true throughout C your program may not be true inside a transaction, due to the < way transactions are implemented. Normally this wouldn' t be visible " to the programmer, but using  can expose it. ,Perform a series of STM actions atomically. You cannot use  inside an O or Q. I Any attempt to do so will result in a runtime error. (Reason: allowing L this would effectively allow a transaction inside a transaction, depending * on exactly when the thunk is evaluated.)  However, see #, which can be called inside O, 3 and which allows top-level TVars to be allocated. FRetry execution of the current memory transaction because it has seen H values in TVars which mean that it should not continue (e.g. the TVars G represent a shared buffer that is now empty). The implementation may H block the thread until one of the TVars that it has read from has been  udpated. (GHC only) ECompose two alternative STM actions (GHC only). If the first action D completes without retrying then it forms the result of the orElse. C Otherwise, if the first action retries, then the second action is A tried in its place. If both actions retry then the orElse as a  whole retries.  A variant of +" that can only be used within the  monad. Throwing an exception in STM+ aborts the transaction and propagates the  exception.  Although / has a type that is an instance of the type of +, the % two functions are subtly different:  " throw e `seq` x ===> throw e  throwSTM e `seq` x ===> x +The first example will cause the exception e to be raised,  whereas the second one won' t. In fact,  will only cause 6 an exception to be raised when it is used within the  monad.  The ) variant should be used in preference to + to  raise an exception within the  monad because it guarantees  ordering with respect to other  operations, whereas +  does not. 'Exception handling within STM actions. UBLow-level primitive on which always and alwaysSucceeds are built. > checkInv differs form these in that (i) the invariant is not > checked when checkInv is called, only at the end of this and B subsequent transcations, (ii) the invariant failure is indicated  by raising an exception.  BalwaysSucceeds adds a new invariant that must be true when passed B to alwaysSucceeds, at the end of the current transaction, and at > the end of every subsequent transaction. If it fails at any > of those points then the transaction violating it is aborted : and the exception raised by the invariant is propagated. !@always is a variant of alwaysSucceeds in which the invariant is C expressed as an STM Bool action that must return True. Returning G False or raising an exception are both treated as invariant failures. "+Create a new TVar holding a value supplied #IO version of "). This is useful for creating top-level  s using ', because using   inside ' isn't  possible. $+Return the current value stored in a TVar.  This is equivalent to  % readTVarIO = atomically . readTVar 'but works much faster, because it doesn't perform a complete 5 transaction, it just reads the current value of the . %*Return the current value stored in a TVar &%Write the supplied value into a TVar TVWXYZ[\]^     _`abcU !"#$%&'()*+d,-efghijk=      !"#$%&'()*+,-=      !"#%$&'(,-+*)GVWXYZ[\]^     _`abcU !"#$%&'()*+d,-efghijk"non-portable (extended exceptions) experimentallibraries@haskell.org Trustworthy.)Thrown when the program attempts to call  atomically , from the stm ! package, inside another call to  atomically. 0?Thrown when the runtime system detects that the computation is C guaranteed not to terminate. Note that there is no guarantee that A the runtime system will notice whether any given computation is ! guaranteed to terminate or not. 2CA class method without a definition (neither a default definition, ? nor a definition in the appropriate instance) was called. The  String. gives information about which method it was. 4;A record update was performed on a constructor without the > appropriate field. This can only happen with a datatype with A multiple constructors, where some fields are in one constructor  but not another. The String$ gives information about the source  location of the record update. 6,An uninitialised record field was used. The String gives < information about the source location where the record was  constructed. 8;A record selector was applied to a constructor without the > appropriate field. This can only happen with a datatype with A multiple constructors, where some fields are in one constructor  but not another. The String$ gives information about the source " location of the record selector. :A pattern match failed. The String gives information about the ! source location of the pattern. <>This is the simplest of the exception-catching functions. It A takes a single argument, runs it, and if an exception is raised  the "handler"; is executed, with the value of the exception passed as an G argument. Otherwise, the result is returned as normal. For example:   catch (readFile f) 5 (\e -> do let err = show (e :: IOException) R hPutStr stderr ("Warning: Couldn't open " ++ f ++ ": " ++ err)  return "") .Note that we have to give a type signature to e, or the program C will not typecheck as the type is ambiguous. While it is possible 2 to catch exceptions of any type, see the section " Catching all  exceptions" (in Control.Exception4) for an explanation of the problems with doing so. %For catching exceptions in pure (non-k) expressions, see the  function [. Note that due to Haskell'#s unspecified evaluation order, an C expression may throw one of several possible exceptions: consider  the expression (error "urk") + (1 `div` 0). Does  the expression throw   ErrorCall "urk", or  DivideByZero? The answer is "it might throw either"; the choice is G non-deterministic. If you are catching any type of exception then you ( might catch either. If you are calling catch with type  .IO Int -> (ArithException -> IO Int) -> IO Int then the handler may  get run with  DivideByZero as an argument, or an  ErrorCall "urk" C exception may be propogated further up. If you call it again, you 9 might get a the opposite behaviour. This is ok, because < is an  k computation. Note that the Prelude also exports a function called   with a similar type to U,  except that the Prelude& version only catches the IO and user 5 families of exceptions (as required by Haskell 98). We recommend either hiding the Prelude version of   when importing Control.Exception:   import Prelude hiding (catch)  or importing Control.Exception# qualified, to avoid name-clashes:  ) import qualified Control.Exception as C and then using C.catch = The function = is like <, but it takes an extra  argument which is an exception predicate, a function which $ selects which type of exceptions we're interested in.  \ catchJust (\e -> if isDoesNotExistErrorType (ioeGetErrorType e) then Just () else Nothing)  (readFile f) C (\_ -> do hPutStrLn stderr ("No such file: " ++ show f)  return "") <Any other exceptions which are not matched by the predicate 2 are re-raised, and may be caught by an enclosing  <, =, etc. > A version of <. with the arguments swapped around; useful in E situations where the code for the handler is shorter. For example: = do handle (\NonTermination -> exitWith (ExitFailure 1)) $  ... ? A version of =( with the arguments swapped around (see  >). @AThis function maps one exception into another as proposed in the  paper "$A semantics for imprecise exceptions". A Similar to <, but returns an s result which is  (} a) if no exception of type e was raised, or (| ex)  if an exception of type e was raised and its value is ex. E If any other type of exception is raised than it will be propogated - up to the next enclosing exception handler.  2 try a = catch (Right `liftM` a) (return . Left)  Note that System.IO.Error also exports a function called  & with a similar type to U, D except that it catches only the IO and user families of exceptions  (as required by the Haskell 98 IO module). B A variant of A- that takes an exception predicate to select # which exceptions are caught (c.f. =). If the exception 0 does not match the predicate, it is re-thrown. CLike E5, but only performs the final action if there was an & exception raised by the computation. D?When you want to acquire a resource, do some work with it, and 5 then release the resource, it is a good idea to use D,  because D1 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 D will 8 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 D2 are in this order so that we can partially apply  it, e.g.: : withFile name mode = bracket (openFile name mode) hClose EA specialised variant of D with just a computation to run  afterward. F A variant of D3 where the return value from the first computation  is not required. GLike D5, but only performs the final action if there was an 1 exception raised by the in-between computation. 2 ./0123456789:;<The computation to run ,Handler to invoke if an exception is raised =Predicate to select exceptions Computation to run Handler >?@ABCDcomputation to run first ("acquire resource") computation to run last ("release resource") computation to run in-between Ecomputation to run first 3computation to run afterward (even if an exception  was raised) FGcomputation to run first ("acquire resource") computation to run last ("release resource") computation to run in-between HIlmnopqrstuvwxyT  !"#$%&'()*+EGHIJRSTUVWXYZ[./0123456789:;<=>?@ABCDEFGHIT)*&'(E#"! 01./23:;678945$%R+<=>?ABC[@XWZYGJIHUSTVDFGE  HI+ ./0123456789:;<=>?@ABCDEFGHIlmnopqrstuvwxy)non-portable (concurrency) experimentallibraries@haskell.org TrustworthyJThis is a combination of ` and a; ie. it takes the value  from the ]4, puts it back, and also returns it. This function G is atomic only if there are no other producers (i.e. threads calling  a ) for this ]. KTake a value from an ], put a new value into the ] and D return the value taken. This function is atomic only if there are  no other producers for this ]. LL< is an exception-safe wrapper for operating on the contents  of an ]9. This operation is exception-safe: it will replace the  original contents of the ] if an exception is raised (see  Control.Exception/). However, it is only atomic if there are no  other producers for this ]. M;An exception-safe wrapper for modifying the contents of an ].  Like L, N' will replace the original contents of  the ]7 if an exception is raised during the operation. This C function is only atomic if there are no other producers for this  ]. NA slight variation on M that allows a value to be  returned (b+) in addition to the modified value of the ]. JKLMN]^_`abcdeJKLMN]^_`aJKbcdLMNeJKLMNU"non-portable (extended exceptions) experimentallibraries@haskell.org TrustworthyOYou need this when using Q. QHSometimes you want to catch two different sorts of exception. You could do something like  = f = expr `catch` \ (ex :: ArithException) -> handleArith ex = `catch` \ (ex :: IOException) -> handleIO ex IHowever, there are a couple of problems with this approach. The first is Ethat having two exception handlers is inefficient. However, the more Iserious issue is that the second exception handler will catch exceptions ,in the first, e.g. in the example above, if  handleArith throws an  IOException2 then the second exception handler will catch it. Instead, we provide a function Q, which would be used thus: K f = expr `catches` [Handler (\ (ex :: ArithException) -> handleArith ex), K Handler (\ (ex :: IOException) -> handleIO ex)] RWhen invoked inside X!, this function allows a blocked < asynchronous exception to be raised, if one exists. It is : equivalent to performing an interruptible operation (see   interruptible-), but does not involve any actual blocking. When called outside X , or inside Z, this  function has no effect. OPQzRN !"#$%&'()*+EGHIJRSTUVWXYZ[./0123456789:;<=>?@ABCDEFGOPQRN)*&'(E#"! 01./23:;678945$%+R<QOP=>?AB[@XWZYGJIHURSTVDFGECOPQzR'portable provisionallibraries@haskell.orgUnsafeSA slightly faster version of  that may not be C safe to use with multiple threads. The unsafety arises when used  like this:   unsafeFixIO $ \r ->  forkIO (print r)  return (...) .In this case, the child thread will receive a NonTermination / exception instead of waiting for the value of r to be computed. SOPQSOPQSS&portable provisionallibraries@haskell.org TrustworthyTThe construct T comp( exposes IO errors which occur within a / computation, and which are not fully handled. Non-I/:O exceptions are not caught by this variant; to catch all  exceptions, use U from Control.Exception. UThe U7 function is deprecated. Please use the new exceptions  variant, U from Control.Exception , instead. V Construct an D- of the given type where the second argument @ describes the error location and the third and fourth argument C contain the file handle and file path of the file involved in the  error if applicable. WAn error indicating that an k operation failed because & one of its arguments already exists. XAn error indicating that an k operation failed because & one of its arguments does not exist. YAn error indicating that an k operation failed because A one of its arguments is a single-use resource, which is already B being used (for example, opening the same file twice for writing  might give this error). ZAn error indicating that an k operation failed because  the device is full. [An error indicating that an k operation failed because # the end of file has been reached. \An error indicating that an k operation failed because ! the operation was not possible. " Any computation which returns an k result may fail with  \0. In some cases, an implementation will not be F able to distinguish between the possible error causes. In this case  it should fail with \. ]An error indicating that an k operation failed because > the user does not have sufficient operating system privilege  to perform that operation. ^3A programmer-defined error value constructed using F. _I/@O error where the operation failed because one of its arguments  already exists. `I/@O error where the operation failed because one of its arguments  does not exist. aI/@O error where the operation failed because one of its arguments 8 is a single-use resource, which is already being used. bI/?O error where the operation failed because the device is full. cI/?O error where the operation failed because the end of file has  been reached. dI/-O error where the operation is not possible. eI/=O error where the operation failed because the user does not G have sufficient operating system privilege to perform that operation. fI/$O error that is programmer-defined. gI/@O error where the operation failed because one of its arguments  already exists. hI/@O error where the operation failed because one of its arguments  does not exist. iI/@O error where the operation failed because one of its arguments 8 is a single-use resource, which is already being used. jI/?O error where the operation failed because the device is full. kI/?O error where the operation failed because the end of file has  been reached. lI/-O error where the operation is not possible. mI/=O error where the operation failed because the user does not G have sufficient operating system privilege to perform that operation. nI/$O error that is programmer-defined. y Catch any D, that occurs in the computation and throw a  modified version. zBAdds a location description and maybe a file path and file handle  to an D7. If any of the file handle or file path is not given  the corresponding value in the D remains unaltered. {The {2 function establishes a handler that receives any  D# raised in the action protected by {.  An D is caught by F the most recent handler established by one of the exception handling  functions. These handlers are  not selective: all D%s are caught. Exception propagation E must be explicitly provided in a handler by re-raising any unwanted  exceptions. For example, in  M f = catchIOError g (\e -> if IO.isEOFError e then return [] else ioError e)  the function f returns [] when an end-of-file exception  (cf. [ ) occurs in g; otherwise, the 4 exception is propagated to the next outer handler. CWhen an exception propagates outside the main program, the Haskell  system prints the associated D value and exits the program. Non-I/:O exceptions are not caught by this variant; to catch all  exceptions, use U from Control.Exception. |The |7 function is deprecated. Please use the new exceptions  variant, U from Control.Exception , instead. )TUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|-DFTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|-DFVzWXYZ[\]^oqprstuvwx_`abcdefghijklmn{|TUy)TUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|V Trustworthy}~{|}~}~~}}~{|}~Wnon-portable (requires POSIX) provisionallibraries@haskell.org TrustworthyE))71 Trustworthynon-portable (requires POSIX)internalcvs-ghc@haskell.org Trustworthyu     u     u     portable provisionalffi@haskell.orgSafe`abcdjlmnopqrfghijklmnopqrstuvwxyz !"#$%&'(FGHIJKLMN !"#$%&')*456789:mnopq !"#$%&'()*+,-./0123456789:;<X non-portableinternallibraries@haskell.org Trustworthy  ? non-portableinternallibraries@haskell.org Trustworthy+The Unicode encoding of the current locale BThe Unicode encoding of the current locale, but where undecodable > bytes are replaced with their closest visual match. Used for  the CString marshalling functions in Foreign.C.String CThe Unicode encoding of the current locale, but allowing arbitrary 3 undecodable bytes to be round-tripped through it. This 5 is used to decode and encode command line arguments 5 and environment variables on non-Windows platforms. COn Windows, this encoding *should not* be used if possible because B the use of code pages is deprecated: Strings should be retrieved  via the wide! W-family of UTF-16 APIs instead ;The Latin1 (ISO8859-1) encoding. This encoding maps bytes B directly to the first 256 Unicode code points, and is thus not a J complete Unicode encoding. An attempt to write a character greater than  '\255' to a Handle using the # encoding will result in an error. The UTF-8 Unicode encoding BThe UTF-8 Unicode encoding, with a byte-order-mark (BOM; the byte 7 sequence 0xEF 0xBB 0xBF). This encoding behaves like , D except that on input, the BOM sequence is ignored at the beginning > of the stream, and on output, the BOM sequence is prepended. =The byte-order-mark is strictly unnecessary in UTF-8, but is 4 sometimes used to identify the encoding of a file. AThe UTF-16 Unicode encoding (a byte-order-mark should be used to  indicate endianness). +The UTF-16 Unicode encoding (litte-endian) )The UTF-16 Unicode encoding (big-endian) AThe UTF-32 Unicode encoding (a byte-order-mark should be used to  indicate endianness). +The UTF-32 Unicode encoding (litte-endian) )The UTF-32 Unicode encoding (big-endian) AAn encoding in which Unicode code points are translated to bytes @ by taking the code point modulo 256. When decoding, bytes are 5 translated directly into the equivalent code point. BThis encoding never fails in either direction. However, encoding ? discards information, so encode followed by decode is not the  identity. 4Look up the named Unicode encoding. May fail with  isDoesNotExistError if the encoding is unknown GThe set of known encodings is system-dependent, but includes at least:  UTF-8 UTF-16, UTF-16BE, UTF-16LE  UTF-32, UTF-32BE, UTF-32LE =On systems using GNU iconv (e.g. Linux), there is additional = notation for specifying how illegal characters are handled:  a suffix of //IGNORE, e.g. UTF-8//IGNORE, will cause @ all illegal sequences on input to be ignored, and on output A will drop all code points that have no representation in the  target encoding.  a suffix of //TRANSLIT% will choose a replacement character * for illegal sequences or code points. @On Windows, you can access supported code pages with the prefix  CP; for example, "CP1250". !"#$%&&!"#$% non-portableinternallibraries@haskell.org Trustworthy&5syncs the file with the buffer, including moving the E file pointer backwards in the case of a read buffer. This can fail  on a non-seekable read Handle. '5flushes the Char buffer only. Works on all Handles.  makes a new  like , except that a  is created with two E independent buffers, one for reading and one for writing. Used for / full-duplex streams, such as network sockets. :()*+,-./0123456789:;<=>?@ABCDEFGH&'IJKLMN.the underlying IO device, which must support  2,  and N a string describing the , e.g. the file + path for a file. Used in error messages. OPQRSTUVWXYZ[\'(+,-./02367:<=>?BCEF&'IJKLMNPQRWXY[\:()*+,-./0123456789:;<=>?@ABCDEFGH&'IJKLMNOPQRSTUVWXYZ[\ Trustworthy]>Copy part of the source array into the destination array. The 3 destination array is resized if not large enough. ^>Copy part of the source array into the destination array. The 3 destination array is resized if not large enough. _AComputes the next-highest power of two for a particular integer,  n. If n$ is already a power of two, returns n. If n is = zero, returns zero, even though zero is not a power of two. `abcdefghijklmnopqrstuvwxy]^z_bfijklmnpqstuvwxy]z`abcdefghijklmnopqrstuvwxy]^z_ Trustworthy{8Return the current time, in seconds since Jan. 1, 1970. |}~{{|}~{Unsafe=The structure used to tell the IO manager thread what to do. @Create the structure (usually a pipe) used for waking up the IO % manager thread from another thread. ;Close the control structure used by the IO manager thread. ~ Unsafe Event notification backend. >Poll backend for new events. The provided callback is called + once per file descriptor with new events. =Register, modify, or unregister interest in the given events  on the given file descriptor. 1A type alias for timeouts, specified in seconds. An I/ O event. Data is available to be read. 0The file descriptor is ready to accept a write. +Another thread closed the file descriptor.  Throw an IOError' corresponding to the current value of   if the result value of the k action is -1 and   is not !. If the result value is -1 and   returns & 0 is returned. Otherwise the result  value is returned.  TrustworthyCreate a new epoll backend. ?Change the set of events we are interested in for a given file  descriptor. 6Select a set of file descriptors which are ready for I/O  operations and call f- for all ready file descriptors, passing the  events that are ready. UCreate a new epoll context, returning a file descriptor associated with the context. @ The fd may be used for subsequent calls to this epoll context. SThe size parameter to epoll_create is a hint about the expected number of handles. IThe file descriptor returned from epoll_create() should be destroyed via - a call to close() after polling is finished &state timeout in milliseconds I/ O callback portable provisionallibraries@haskell.org Trustworthy A map of integers to values a. A Nat- is a natural machine word (an unsigned Int)  O(min(n,W))1 Lookup the value at a key in the map. See also  .  O(min(n,W))". Is the key a member of the map? 0 member 5 (fromList [(5,'a'), (3,'b')]) == True 1 member 1 (fromList [(5,'a'), (3,'b')]) == False O(1) The empty map.  empty == fromList []  size empty == 0  O(min(n,W))5 Insert with a function, combining new value and old  value. insertWith f key value mp will insert the pair (key,  value) into mp4 if key does not exist in the map. If the key does < exist, the function will insert the pair (key, f new_value B old_value). The result is a pair where the first element is the D old value, if one was present, and the second is the modified map.  O(min(n,W))5. Delete a key and its value from the map. When the D key is not a member of the map, the original map is returned. The B result is a pair where the first element is the value associated E with the deleted key, if one existed, and the second element is the  modified map. O(n)1. Fold the keys and values in the map, such that   f z ==  (uncurry f) z .  toAscList.  For example,  1 keys map = foldWithKey (\k x ks -> k:ks) [] map A let f k a result = result ++ "(" ++ (show k) ++ ":" ++ a ++ ")" J foldWithKey f "Map: " (fromList [(5,"a"), (3,"b")]) == "Map: (5:a)(3:b)" O(n)". Convert the map to a list of key/ value pairs. < toList (fromList [(5,"a"), (3,"b")]) == [(3,"b"), (5,"a")]  toList empty == [] O(n)1. Return all keys of the map in ascending order. - keys (fromList [(5,"a"), (3,"b")]) == [3,5]  keys empty == [] bin7 assures that we never have empty trees within a tree. highestBitMask. returns a word where only the highest bit is E set. It is found by first setting all bits in lower positions than C the highest bit and than taking an exclusive or with the original A value. Allthough the function may look expensive, GHC compiles C this into excellent C code that subsequently compiled into highly A efficient machine code. The algorithm is derived from Jorg Arndt's  FXT library. $ ! Trustworthy Trustworthy TrustworthyA mapping from keys k to priorites p. E k p binds the key k with the priority p. O(1)$ The number of elements in a queue. O(1) True if the queue is empty. O(log n)6 The priority and value of a given key, or Nothing if  the key is not bound. O(1)! Build a queue with one element.  O(log n)8 Insert a new key, priority and value in the queue. If B the key is already present in the queue, the associated priority > and value are replaced with the supplied priority and value.  O(log n)2 Delete a key and its priority and value from the A queue. When the key is not a member of the queue, the original  queue is returned.  O(log n)5 Update a priority at a specific key with the result @ of the provided function. When the key is not a member of the ( queue, the original queue is returned.   O(n*log n)! Build a queue from a list of keypriorityvalue D tuples. If the list contains more than one priority and value for D the same key, the last priority and value for the key is retained.  O(n) Convert to a list of keypriorityvalue tuples. O(n) Convert to an ascending list. O(n) Convert to a descending list. O(1)' The element with the lowest priority. O(log n)7 Delete the element with the lowest priority. Returns ' an empty queue if the queue is empty. O(log n)7 Retrieve the binding with the least priority, and the - rest of the queue stripped of that binding. O(r*(log n - log r))& Return a list of elements ordered by " key whose priorities are at most pt. Balance factor ATake two pennants and returns a new pennant that is the union of B the two with the precondition that the keys in the rst tree are 4 strictly smaller than the keys in the second tree.  A version of / that can be used if the shape of the tree has 5 not changed or if the tree is known to be balanced. G !"#$%&'()*     +,-./0123456789:;<=>?@ABCDEFGHI"%&'()*     : !"$#%&'()*     +,-./0123456789:;<=>?@ABCDEFGHI TrustworthyThe event manager state. JAn edit to apply to a K. K6A priority search queue, with timeouts as priorities. $Callback invoked on timeout events. A timeout registration cookie. Callback invoked on I/ O events. 'A file descriptor registration cookie. Create a new event manager. 9Asynchronously shuts down the event manager, if running. @Start handling events. This function loops until told to stop,  using . Note%: This loop can only be run once per , as it 7 closes all of its control resources when it finishes. @Register interest in the given events, without waking the event  manager thread. The \$ return value indicates whether the " event manager ought to be woken. registerFd mgr cb fd evs" registers interest in the events evs  on the file descriptor fd. cb is called for each event that 1 occurs. Returns a cookie that can be handed to . LWake up the event manager. ADrop a previous file descriptor registration, without waking the E event manager thread. The return value indicates whether the event  manager ought to be woken. .Drop a previous file descriptor registration. ,Close a file descriptor in a race-safe way. =Register a timeout in the given number of microseconds. The  returned / can be used to later unregister or update the E timeout. The timeout is automatically unregistered after the given  time has passed. Unregister an active timeout. 8Update an active timeout to fire in the given number of  microseconds. M?Call the callbacks corresponding to the given file descriptor. 1NOPQRSTJKUVWXYZ[\]^_`abcdefLghMcdefLNOPQRSTJKUYXWVZ[\]^_`abcdefLghM Trustworthyi?Suspends the current thread for a given number of microseconds  (GHC only). CThere is no guarantee that the thread will be rescheduled promptly C when the delay has expired, but the thread will never continue to  run earlier than specified. j?Set the value of returned TVar to True after a given number of C microseconds. The caveats associated with threadDelay also apply. kBBlock the current thread until data is available to read from the  given file descriptor. This will throw an IOError# if the file descriptor was closed C while this thread was blocked. To safely close a file descriptor  that has been used with k, use l. m=Block the current thread until the given file descriptor can  accept data to write. This will throw an IOError# if the file descriptor was closed C while this thread was blocked. To safely close a file descriptor  that has been used with m, use l. l3Close a file descriptor in a concurrency-safe way. 8Any threads that are blocked on the file descriptor via  k or m will be unblocked by having  IO exceptions thrown. #Retrieve the system event manager. This function always returns ) the system event manager when using the  threaded RTS and  otherwise. nopijkml Action that performs the close. File descriptor to close. qrstijkmlt nopijkmlqrstnon-portable (GHC extensions)internalcvs-ghc@haskell.org Trustworthy@Block the current thread until data is available to read on the # given file descriptor (GHC only). This will throw an IOError# if the file descriptor was closed C while this thread was blocked. To safely close a file descriptor  that has been used with , use . :Block the current thread until data can be written to the # given file descriptor (GHC only). This will throw an IOError# if the file descriptor was closed C while this thread was blocked. To safely close a file descriptor  that has been used with , use . BClose a file descriptor in a concurrency-safe way (GHC only). If  you are using  or  to perform  blocking I/O, you must! use this function to close file 3 descriptors, or blocked threads may not be woken. 8Any threads that are blocked on the file descriptor via   or  will be unblocked by having  IO exceptions thrown. ?Suspends the current thread for a given number of microseconds  (GHC only). CThere is no guarantee that the thread will be rescheduled promptly C when the delay has expired, but the thread will never continue to  run earlier than specified. ?Set the value of returned TVar to True after a given number of C microseconds. The caveats associated with threadDelay also apply. u/Low-level action that performs the real close. File descriptor to close. uRnon-portable (GHC extensions)internalcvs-ghc@haskell.orgUnsafeE      !"#$%&'*+,-}~E      !"#%$&'~},-+* non-portableinternallibraries@haskell.org TrustworthyvOpen a file and make an w% for it. Truncates the file to zero  size when the  is  . xMake a w4 from an existing file descriptor. Fails if the FD 5 refers to a directory. If the FD refers to a file, x locks 3 the file according to the Haskell 98 single writer/multiple reader , locking semantics (this is why we need the  argument too). 8wyz{|}~v file to open mode in which to open the file $open the file in non-blocking mode? xis a socket (on Windows)  is in non-blocking mode on Unix wyz{vx5wyz{|}~vx non-portableinternallibraries@haskell.org Trustworthy  Computation  hdl t * waits until input is available on handle hdl.  It returns {" as soon as input is available on hdl,  or x! if no input is available within t milliseconds. Note that   waits until one or more full  characters are available, > which means that it needs to do decoding, and hence may fail  with a decoding error. If t is less than zero, then  hWaitForInput waits indefinitely. This operation may fail with:  [& if the end of file has been reached. E a decoding error, if the input begins with an invalid byte sequence  in this Handle' s encoding. 'NOTE for GHC users: unless you use the  -threaded flag,  hWaitForInput t where t >= 0 will block all other Haskell : threads for the duration of the call. It behaves like a  safe foreign call in this respect.  Computation  hdl$ reads a character from the file or  channel managed by hdl+, blocking until a character is available. This operation may fail with:  [& if the end of file has been reached.  Computation  hdl reads a line from the file or  channel managed by hdl. This operation may fail with:  [0 if the end of file is encountered when reading  the first character of the line. If 9 encounters end-of-file at any other point while reading A in a line, it is treated as a line terminator and the (partial)  line is returned.  Computation  hdl returns the list of characters D corresponding to the unread portion of the channel or file managed  by hdl+, which is put into an intermediate state,  semi-closed.  In this state, hdl is effectively closed,  but items are read from hdl( on demand and accumulated in a special  list returned by  hdl. 5Any operation that fails because a handle is closed, ? also fails if a handle is semi-closed. The only exception is hClose. & A semi-closed handle becomes closed:  if hClose is applied to it;  if an I/5O error occurs when reading an item from the handle; : or once the entire contents of the handle has been read. >Once a semi-closed handle becomes closed, the contents of the D associated list becomes fixed. The contents of this final list is E only partially specified: it will contain at least all the items of E the stream that were evaluated prior to the handle becoming closed. Any I/>O errors encountered while a handle is semi-closed are simply  discarded. This operation may fail with:  [& if the end of file has been reached.  Computation  hdl ch writes the character ch to the  file or channel managed by hdl!. Characters may be buffered if  buffering is enabled for hdl. This operation may fail with:  Z if the device is full; or  ]5 if another system resource limit would be exceeded.  Computation  hdl s writes the string  s# to the file or channel managed by hdl. This operation may fail with:  Z if the device is full; or  ]5 if another system resource limit would be exceeded.  The same as  , but adds a newline character.   hdl buf count writes count 8-bit bytes from the  buffer buf to the handle hdl. It returns (). / ignores any text encoding that applies to the , > writing the bytes directly to the underlying file or device.  ignores the prevailing  TextEncoding and   on the , and writes bytes directly. This operation may fail with:   , if the handle is a pipe or socket, and the H reading end is closed. (If this is a POSIX system, and the program E has not asked to ignore SIGPIPE, then a SIGPIPE may be delivered @ instead, whose default action is to terminate the program).   hdl buf count reads data from the handle hdl  into the buffer buf until either EOF is reached or  count 8-bit bytes have been read. D It returns the number of bytes actually read. This may be zero if 1 EOF was reached before any data was read (or if count is zero). ; never raises an EOF exception, instead it returns a value  smaller than count. 7If the handle is a pipe or socket, and the writing end  is closed, $ will behave as if EOF was reached.  ignores the prevailing  TextEncoding and   on the , and reads bytes directly.   hdl buf count reads data from the handle hdl  into the buffer buf+. If there is any data available to read,  then 1 returns it immediately; it only blocks if there  is no data to be read. CIt returns the number of bytes actually read. This may be zero if 1 EOF was reached before any data was read (or if count is zero). ; never raises an EOF exception, instead it returns a value  smaller than count. 7If the handle is a pipe or socket, and the writing end  is closed, $ will behave as if EOF was reached.  ignores the prevailing  TextEncoding and   on the , and reads bytes directly.   hdl buf count reads data from the handle hdl  into the buffer buf! until either EOF is reached, or  count@ 8-bit bytes have been read, or there is no more data available  to read immediately.  is identical to , except that it will F never block waiting for data to become available, instead it returns E only whatever data is available. To wait for data to arrive before  calling , use . 7If the handle is a pipe or socket, and the writing end  is closed, $ will behave as if EOF was reached.  ignores the prevailing  TextEncoding and   on the , and reads bytes directly. <NOTE: on Windows, this function does not work correctly; it  behaves identically to . ((A non-portable provisionallibraries@haskell.org Trustworthy The action  hdl& causes any items buffered for output  in handle hdl1 to be sent immediately to the operating system. This operation may fail with:   isFullError if the device is full;  isPermissionError/ if a system resource limit would be exceeded. I It is unspecified whether the characters in the buffer are discarded + or retained under these circumstances.  Computation  hdl makes handle hdl closed. Before the  computation finishes, if hdl& is writable its buffer is flushed as  for .  Performing : on a handle that has already been closed has no effect; O doing so is not an error. All other operations on a closed handle will fail.  If : fails for any reason, any further operations (apart from  &) on the handle will still fail as if hdl had been successfully  closed.  For a handle hdl$ which attached to a physical file,   hdl/ returns the size of that file in 8-bit bytes.  hdl size) truncates the physical file with handle hdl to size bytes. For a readable handle hdl,  hdl returns  {' if no further input can be taken from hdl or for a  physical file, if the current I/%O position is equal to the length of " the file. Otherwise, it returns x. NOTE: 3 may block, because it has to attempt to read from D the stream to determine whether there is any more data to be read.  Computation , returns the next character from the handle G without removing it from the input buffer, blocking until a character  is available. This operation may fail with:   isEOFError& if the end of file has been reached.  Computation  hdl mode sets the mode of buffering for  handle hdl! on subsequent reads and writes. #If the buffer mode is changed from  or   to , then  if hdl+ is writable, the buffer is flushed as for ;  if hdl; is not writable, the contents of the buffer is discarded. This operation may fail with:  isPermissionError1 if the handle has already been used for reading H or writing and the implementation does not allow the buffering mode  to be changed.  The action  hdl encoding changes the text encoding  for the handle hdl to encoding. The default encoding when a  is  created is localeEncoding., namely the default encoding for the current  locale.  To create a  with no encoding at all, use openBinaryFile. To 2 stop further encoding or decoding on an existing , use  . 4 may need to flush buffered data in order to change  the encoding. Return the current  for the specified , or   if the  is in binary mode. Note that the & remembers nothing about the state of  the encoder/decoder in use on this . For example, if the ' encoding in use is UTF-16, then using  and  3 to save and restore the encoding may result in an 2 extra byte-order-mark being written to the file.  The action  hdl flushes all buffered data in hdl, B including any buffered read data. Buffered read data is flushed E by seeking the file position back to the point before the bufferred ( data was read, and hence only works if hdl is seekable (see  ). This operation may fail with:   isFullError if the device is full;  isPermissionError/ if a system resource limit would be exceeded. I It is unspecified whether the characters in the buffer are discarded + or retained under these circumstances;  isIllegalOperation if hdl$ has buffered read data, and is not  seekable.  Computation  hdl returns the current I/O position of  hdl! as a value of the abstract type .  If a call to  hdl returns a position p,  then computation  p sets the position of hdl 4 to the position it held at the time of the call to . This operation may fail with:  isPermissionError/ if a system resource limit would be exceeded.  Computation   hdl mode i sets the position of handle  hdl depending on mode.  The offset i# is given in terms of 8-bit bytes. If hdlE is block- or line-buffered, then seeking to a position which is not M in the current buffer will first cause any items in the output buffer to be I written to the device, and then cause the input buffer to be discarded. ' Some handles may not be seekable (see ), or only support a J subset of the possible positioning operations (for instance, it may only H be possible to seek to the end of a tape, or to a positive offset from % the beginning or current position). ' It is not possible to set a negative I/O position, or for  a physical file, an I/+O position beyond the current end-of-file. This operation may fail with:  isIllegalOperationError( if the Handle is not seekable, or does * not support the requested seek mode.  isPermissionError/ if a system resource limit would be exceeded.  Computation  hdl% returns the current position of the  handle hdl/, as the number of bytes from the beginning of = the file. The value returned may be subsequently passed to  3 to reposition the handle to the current position. This operation may fail with:  isIllegalOperationError if the Handle is not seekable.  Computation  hdl$ returns the current buffering mode  for hdl. <Set the echoing status of a handle connected to a terminal. <Get the echoing status of a handle connected to a terminal. 'Is the handle connected to a terminal? Select binary mode ({) or text mode (x) on a open handle.  (See also openBinaryFile.) $This has the same effect as calling  with  , together  with  with . Set the  on the specified . All buffered  data is flushed first. AReturns a duplicate of the original handle, with its own buffer. C The two Handles will share a file pointer, however. The original  handle':s buffer is flushed, including discarding any input data, " before the handle is duplicated. FMakes the second handle a duplicate of the first handle. The second 3handle will be closed first, if it is not already. @This can be used to retarget the standard Handles, for example: ' do h <- openFile "mystdout" WriteMode  hDuplicateTo h stdout  is in the k, monad, and gives more comprehensive output  than the (pure) instance of L for . )@)*+,@),+*(J non-portableinternallibraries@haskell.org Trustworthy /A handle managing output to the Haskell program's standard output channel.  0A handle managing input from the Haskell program's standard input channel.  /A handle managing output to the Haskell program's standard error channel.  The computation   is identical to ,  except that it works only on  .   Computation    file mode# allocates and returns a new, open  handle to manage the file file. It manages input if mode  is   , output if mode is   or  , & and both input and output if mode is  . EIf the file does not exist and it is opened for output, it should be  created as a new file. If mode is   and the file = already exists, then it should be truncated to zero length. E Some operating systems delete empty files, so there is no guarantee ' that the file will exist following an   with mode   4 unless it is subsequently written to successfully. 4 The handle is positioned at the end of the file if mode is   4, and otherwise at the beginning (in which case its  internal position is 0). 6 The initial buffer mode is implementation-dependent. This operation may fail with:  isAlreadyInUseError5 if the file is already open and cannot be reopened;  isDoesNotExistError if the file does not exist; or  isPermissionError8 if the user does not have permission to open the file. CNote: if you will be working with files containing binary data, you' ll want to  be using .  Like  0, but opens the file in ordinary blocking mode. B This can be useful for opening a FIFO for reading: if we open in D non-blocking mode then the open will fail if there are no writers, < whereas a blocking open will block until a writer appears. Like  $, but open the file in binary mode. @ On Windows, reading a file in text mode (which is the default) C will translate CRLF to LF, and writing will translate LF to CRLF. C This is usually what you want with text files. With binary files H this is undesirable; also, as usual under Microsoft operating systems, G text mode treats control-Z as EOF. Binary mode turns off all special 6 treatment of end-of-line and end-of-file characters.  (See also .) 'Old API kept to avoid breaking clients ATurn an existing file descriptor into a Handle. This is used by - various external libraries to make Handles. BMakes a binary Handle. This is for historical reasons; it should A probably be a text Handle with the default encoding and newline  translation instead.                       non-portable (GHC Extensions)internalcvs-ghc@haskell.org Trustworthy is wrapped around  (or whatever main is D called in the program). It catches otherwise uncaught exceptions,  and also flushes stdout/stderr before exiting.  is wrapped around every foreign export and foreign  import "wrapper"/ to mop up any uncaught exceptions. Thus, the  result of running B in a foreign-exported ? function is the same as in the main thread: it terminates the  program. Like 8, but in the event of an exception that causes an exit,  we don'7t shut down the system cleanly, we just exit. This is E useful in some cases, because the safe exit version will give other ? threads a chance to clean up first, which might shut down the / system in a different way. For example, try Fmain = forkIO (runIO (exitWith (ExitFailure 1))) >> threadDelay 10000 This will sometimes exit with  interrupted and code 0, because the H main thread is given a chance to shut down when the child thread calls M safeExit. There is a race to shut down between the main and child threads.  The same as ), but for non-IO computations. Used for  wrapping foreign export and foreign import "wrapper" when these 9 are used to export Haskell functions with non-IO types.  *+portablestablelibraries@haskell.org TrustworthyThe 7 function outputs a value of any printable type to the  standard output device. 7 Printable types are those that are instances of class L;  1 converts values to strings for output using the  operation and  adds a newline. @For example, a program to print the first 20 integers and their " powers of 2 could be written as: * main = print ([(n, 2^n) | n <- [0..19]]) 0Write a character to the standard output device  (same as  ). -Write a string to the standard output device  (same as  ).  The same as  , but adds a newline character. 0Read a character from the standard input device  (same as   ). +Read a line from the standard input device  (same as   ). The 6 operation returns all user input as a single string, & which is read lazily as it is needed  (same as   ). The # function takes a function of type String->String F as its argument. The entire input from the standard input device is F passed to this function as its argument, and the resulting string is ' output on the standard output device. The  function reads a file and / returns the contents of the file as a string. - The file is read lazily, on demand, as with . The computation  file str function writes the string str,  to the file file. The computation  file str function appends the string str,  to the file file.  Note that  and  write a literal string = to a file. To write a value of any printable type, as with ,  use the 2 function to convert the value to a string first. @ main = appendFile "squares" (show [(x,x*x) | x <- [0,0.1..2]]) The  function combines  and . The  function is similar to  except that it signals  parse failure to the k+ monad instead of terminating the program. +The Unicode encoding of the current locale LThis is the initial locale encoding: if it has been subsequently changed by  * this value will not reflect that change.  Computation  hdl( indicates whether at least one item is ! available for input from handle hdl. This operation may fail with:  && if the end of file has been reached.   Computation   hdl t% writes the string representation of t  given by the , function to the file or channel managed by hdl  and appends a newline. This operation may fail with:  & if the device is full; or  &5 if another system resource limit would be exceeded. !! name mode act opens a file using   and passes ) the resulting handle to the computation act. The handle will be  closed on exit from !&, whether by normal termination or by H raising an exception. If closing the handle raises an exception, then " this exception will be raised by ! rather than any exception  raised by act. "" name mode act opens a file using  4 and passes the resulting handle to the computation act. The handle  will be closed on exit from ", whether by normal ) termination or by raising an exception. $9The function creates a temporary file in ReadWrite mode.  The created file isn'<t deleted automatically, so you need to delete it manually. @The file is creates with permissions such that only the current  user can read/ write it. DWith some exceptions (see below), the file will be created securely ; in the sense that an attacker should not be able to cause E openTempFile to overwrite another file on the filesystem using your E credentials, by putting symbolic links (on Unix) in the place where 3 the temporary file is to be created. On Unix the O_CREAT and  O_EXCL6 flags are used to prevent this attack, but note that  O_EXCL: is sometimes not supported on NFS filesystems, so if you B rely on this behaviour it is best to use local filesystems only. %Like $), but opens the file in binary mode. See  for more comments. &Like $(, but uses the default file permissions 'Like %(, but uses the default file permissions  !"#$&Directory in which to create the file 'File name template. If the template is "foo.ext" then  the created file will be " fooXXX.ext" where XXX is some  random number. %&'jkK    )*+,     !"#$%&'jk#K  !      ),+* "$%&' !"#$%&'Z"non-portable (extended exceptions) experimentallibraries@haskell.org Trustworthy!(BThe type of exceptions. Every kind of system-generated exception  has a constructor in the ( type, and values of other  types may be injected into ( by coercing them to  -) (see the section on Dynamic Exceptions:  &Control.OldException#DynamicExceptions). )3An attempt was made to update a field in a record,  where the record doesn'&t have the requested field. This can = only occur with multi-constructor records, when one or more 8 fields are missing from some of the constructors. The  u$ argument gives the location of the & record update in the source program. *6A field selection was attempted on a constructor that  doesn'2t have the requested field. This can happen with 7 multi-constructor records when one or more fields are - missing from some of the constructors. The  u$ argument gives the location of the ) record selection in the source program. +4An attempt was made to evaluate a field of a record 9 for which no value was given at construction time. The  u$ argument gives the location of the , record construction in the source program. ,!A pattern matching failure. The u argument should contain a > descriptive message including the function name, source file  and line number. -7The current thread is stuck in an infinite loop. This 8 exception may or may not be thrown when the program is  non-terminating. .7An attempt was made to invoke a class method which has : no definition in this instance, and there was no default : definition given in the class declaration. GHC issues a 8 warning when you compile an instance which has missing  methods. /2These are the standard IO exceptions generated by  Haskell's IO operations. See also System.IO.Error. 0The 0 exception is thrown by B (and  B). The ExitCode argument is the value passed  to B. An unhandled 0 exception in the E main thread will cause the program to be terminated with the given  exit code. 1The 1 exception is thrown by . The u  argument of 1 is the string passed to  when it was  called. 2ADynamically typed exceptions (see section on Dynamic Exceptions: &Control.OldException#DynamicExceptions). 31There are no runnable threads, so the program is  deadlocked. The 3 exception is + raised in the main thread only (see also: Control.Concurrent). 4<The runtime detected an attempt to nest one STM transaction 3 inside another one, presumably due to the use of  unsafePeformIO with . 5EThe current thread was waiting to retry an atomic memory transaction I that could never become possible to complete because there are no other 1 threads referring to any of the TVars involved. 6+The current thread was executing a call to  ) that could never return, / because there are no other references to this MVar. 7AAsynchronous exceptions (see section on Asynchronous Exceptions: +Control.OldException#AsynchronousExceptions). 8 This exception is thrown by the   operation when the condition  fails. The u argument contains the 2 location of the assertion in the source program. 9#Exceptions raised by array-related 2 operations. (NOTE: GHC currently does not throw  9s). : Exceptions raised by arithmetic 2 operations. (NOTE: GHC currently does not throw  : s except for  DivideByZero). ;>This is the simplest of the exception-catching functions. It A takes a single argument, runs it, and if an exception is raised  the "handler"; is executed, with the value of the exception passed as an G argument. Otherwise, the result is returned as normal. For example:   catch (openFile f ReadMode) D (\e -> hPutStr stderr ("Couldn't open "++f++": " ++ show e)) %For catching exceptions in pure (non-k) expressions, see the  function [. Note that due to Haskell'#s unspecified evaluation order, an D expression may return one of several possible exceptions: consider  the expression error "urk" + 1 `div` 0. Does  ; execute the handler passing   ErrorCall "urk", or ArithError DivideByZero? The answer is "either": ; makes a B non-deterministic choice about which exception to catch. If you C call it again, you might get a different exception back. This is  ok, because ; is an k computation.  Note that ;3 catches all types of exceptions, and is generally  used for " cleaning up"' before passing on the exception using  R8. It is not good practice to discard the exception and @ continue, without first checking the type of the exception (it  might be a  ThreadKilled3, for example). In this case it is usually better  to use <. and select the kinds of exceptions to catch. Also note that the Prelude also exports a function called   with a similar type to ;,  except that the Prelude& version only catches the IO and user 7 families of exceptions (as required by Haskell 98). We recommend either hiding the Prelude version of   when importing Control.OldException:   import Prelude hiding (catch)  or importing Control.OldException# qualified, to avoid name-clashes:  , import qualified Control.OldException as C and then using C.catch < The function < is like ;, but it takes an extra  argument which is an exception predicate, a function which $ selects which type of exceptions we're interested in. There are < some predefined exception predicates for useful subsets of  exceptions: E, F, and so on. For example,  to catch just calls to the  function, we could use  7 result <- catchJust errorCalls thing_to_try handler <Any other exceptions which are not matched by the predicate 2 are re-raised, and may be caught by an enclosing  ; or <. = A version of ;. with the arguments swapped around; useful in E situations where the code for the handler is shorter. For example: 0 do handle (\e -> exitWith (ExitFailure 1)) $  ... > A version of <( with the arguments swapped around (see  =). ?AThis function maps one exception into another as proposed in the  paper "$A semantics for imprecise exceptions". @ Similar to ;, but returns an s result which is  (} a) if no exception was raised, or (| e) if an ' exception was raised and its value is e.  2 try a = catch (Right `liftM` a) (return . Left) Note: as with ;6, it is only polite to use this variant if you intend H to re-throw the exception after performing whatever cleanup is needed.  Otherwise, A' is generally considered to be better. Also note that System.IO.Error also exports a function called  & with a similar type to @, D except that it catches only the IO and user families of exceptions  (as required by the Haskell 98 IO module). A A variant of @- that takes an exception predicate to select # which exceptions are caught (c.f. <). If the exception 0 does not match the predicate, it is re-thrown. B7Raise any value as an exception, provided it is in the  N class. C A variant of B) that throws the dynamic exception to an " arbitrary thread (GHC only: c.f. ). D:Catch dynamic exceptions of the required type. All other E exceptions are re-thrown, including dynamic exceptions of the wrong  type. >When using dynamic exceptions it is advisable to define a new D datatype to use for your exception type, to avoid possible clashes 2 with dynamic exceptions used in other libraries. L?When you want to acquire a resource, do some work with it, and 5 then release the resource, it is a good idea to use L,  because L1 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 L will 8 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 L3 are in this order so that we can partially apply  it, e.g.: : withFile name mode = bracket (openFile name mode) hClose MA specialised variant of L with just a computation to run  afterward. N A variant of L3 where the return value from the first computation  is not required. OBLike bracket, but only performs the final action if there was an 1 exception raised by the in-between computation. 1()*+,-./0123456789:;The computation to run ,Handler to invoke if an exception is raised <Predicate to select exceptions Computation to run Handler =>?@ABCDEFGHIJKLcomputation to run first ("acquire resource") computation to run last ("release resource") computation to run in-between Mcomputation to run first 4computation to run afterward (even if an exception  was raised) NOcomputation to run first ("acquire resource") computation to run last ("release resource") computation to run in-between PQA !"#+ERST[()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQA(:9876543210/.-,+*)E#"! R+;<=>@A[?EFGIHJKBCDSTLNOMPQ(:9876543210/.-,+*);<=>?@ABCDEFGHIJKLMNOPQ Trustworthy          portablestablelibraries@haskell.org TrustworthyR8Strict (call-by-value) application, defined in terms of . R !"#$%&'()*+,6789=>?@ABCEFGHIJKL\]^_`efhksux{|}~,-./0123456789>?@ABCDFK{|}~|R\x{s|}f~]u?%G&>!"#$=`e_^hF'I9B4567898A23 @K-./01J{|}~>?BC@A67C)*,(E+,RLHkKDF|Rnon-portable (GHC Extensions)internalcvs-ghc@haskell.org Trustworthy-non-portable (local universal quantification) experimentallibraries@haskell.org Trustworthy<DThe D+ class comprehends a fundamental primitive d for Efolding over constructor applications, say terms. This primitive can Cbe instantiated in several ways to map over the immediate subterms of a term; see the gmap- combinators later in this class. Indeed, a Igeneric programmer does not necessarily need to use the ingenious gfoldl #primitive but rather the intuitive gmap combinators. The d Dprimitive is completed by means to query top-level constructors, to Dturn constructor representations into proper terms, and to list all Dpossible datatype constructors. This completion allows us to serve Jgeneric programming scenarios like read, show, equality, term generation. The combinators j, m, o, etc are all provided with  default definitions in terms of d, leaving open the opportunity *to provide datatype-specific definitions. (The inclusion of the gmap! combinators as members of class D Gallows the programmer or the compiler to derive specialised, and maybe #more efficient code per datatype. Note: d is more higher-order  than the gmap7 combinators. This is subject to ongoing benchmarking )experiments. It might turn out that the gmap combinators will be moved out of the class D.) $Conceptually, the definition of the gmap combinators in terms of the  primitive d$ requires the identification of the d function Garguments. Technically, we also need to identify the type constructor cD for the construction of the result type from the folded term type. In the definition of gmapQx" combinators, we use phantom type constructors for the c in the type of d because the result type Iof a query does not involve the (polymorphic) type of the term argument. In the definition of k' we simply use the plain constant type constructor because d) is left-associative anyway and so it is Dreadily suited to fold a left-associative binary operation over the Bimmediate subterms. In the definition of gmapQr, extra effort is Dneeded. We use a higher-order accumulation trick to mediate between Fleft-associative constructor application vs. right-associative binary operation (e.g., (:)/). When the query is meant to compute a value of type r2, then the result type withing generic folding is r -> r. DSo the result of folding is a function to which we finally pass the  right unit.  With the -XDeriveDataTypeable+ option, GHC can generate instances of the D: class automatically. For example, given the declaration  4 data T a b = C1 a b | C2 deriving (Typeable, Data) 4GHC will generate an instance that is equivalent to  1 instance (Data a, Data b) => Data (T a b) where , gfoldl k z (C1 a b) = z C1 `k` a `k` b  gfoldl k z C2 = z C2  + gunfold k z c = case constrIndex c of + 1 -> k (k (z C1)) # 2 -> z C2   toConstr (C1 _ _) = con_C1  toConstr C2 = con_C2   dataTypeOf _ = ty_T  ' con_C1 = mkConstr ty_T "C1" [] Prefix ' con_C2 = mkConstr ty_T "C2" [] Prefix 1 ty_T = mkDataType "Module.T" [con_C1, con_C2] @This is suitable for datatypes that are exported transparently. SFixity of constructors V(Unique index for datatype constructors, B counting from 1 in the order they are given in the program text. W&Public representation of constructors \#Public representation of datatypes bCRepresentation of constructors. Note that equality on constructors @ with different types may not work -- i.e. the constructors for x and   may compare equal. cRepresentation of datatypes. I A package of constructor representations with names of type and module. 2The type constructor used in definition of gmapMp 2The type constructor used in definition of gmapQr 0Type constructor for adding counters to queries BThe constant type constructor needed for the definition of gmapQl AThe identity type constructor needed for the definition of gmapT d>Left-associative fold operation for constructor applications.  The type of d1 is a headache, but operationally it is a simple  generalisation of a list fold. The default definition for d is   , which is 8 suitable for abstract datatypes with no substructures. e#Unfolding constructor applications f.Obtaining the constructor from a given datum. B For proper terms, this is meant to be the top-level constructor. E Primitive datatypes are here viewed as potentially infinite sets of  values (i.e., constructors). g'The outer type constructor of the type h+Mediate types and unary type constructors.  In D instances of the form T a, h should be defined  as . The default definition is  , which is appropriate " for non-unary type constructors. i,Mediate types and binary type constructors.  In D instances of the form T a b, i should be  defined as . The default definition is  , which is appropriate # for non-binary type constructors. j?A generic transformation that maps over the immediate subterms 9The default definition instantiates the type constructor c in the  type of d0 to an identity datatype constructor, using the / isomorphism pair as injection and projection. k8A generic query with a left-associative binary operator l9A generic query with a right-associative binary operator mIA generic query that processes the immediate subterms and returns a list J of results. The list is given in the same order as originally specified . in the declaratoin of the data constructors. n?A generic query that processes one child by index (zero-based) oGA generic monadic transformation that maps over the immediate subterms 9The default definition instantiates the type constructor c in  the type of d- to the monad datatype constructor, defining  injection and projection using , and ). p?Transformation of at least one immediate subterm does not fail q5Transformation of one immediate subterm with success rBuild a term skeleton s5Build a term and use a generic function for subterms tMonadic variation on s u/Gets the type constructor including the module v+Gets the public presentation of a datatype w#Gets the datatype of a constructor x-Gets the public presentation of constructors y,Look up a constructor by its representation z!Constructs an algebraic datatype {Constructs a constructor |/Gets the constructors of an algebraic datatype }<Gets the field labels of a constructor. The list of labels C is returned in the same order as they were given in the original  constructor declaration. ~!Gets the fixity of a constructor "Gets the string for a constructor "Lookup a constructor via a string Test for an algebraic type =Gets the constructor for an index (algebraic datatypes only) ;Gets the index of a constructor (algebraic datatypes only) <Gets the maximum constructor index of an algebraic datatype Constructs the ` type Constructs the _ type ,This function is now deprecated. Please use  instead. Constructs the ] type  Helper for , ,  ,This function is now deprecated. Please use  instead. ,This function is now deprecated. Please use  instead. ,This function is now deprecated. Please use  instead. Makes a constructor for ]. Deprecated version (misnamed) ;Constructs a non-representation for a non-presentable type "Test for a non-representable type 'Gets the unqualified type constructor:  drop *.*.*... before name 'Gets the module of a type constructor:  take *.*.*... before name Equality of constructors DSTUVWXYZ[\]^_`abc !"#$%&'()*d2defines how nonempty constructor applications are 6 folded. It takes the folded tail of the constructor 7 application and its head, i.e., an immediate subterm,  and combines them in some way. 1defines how the empty constructor application is  folded, like the neutral / start element for list  folding. structure to be folded. (result, with a type defined in terms of a, but 6 variability is achieved by means of type constructor  c1 for the construction of the actual result type. efghijklmnopqrstuvwxyz{|}~+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxoDNOPQRSTU     STUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~BDdefghijklmnopqczu\a`_^]vy|bVSUT{wW[ZYXx}~rst~DdefghijklmnopqSUTVW[ZYX\a`_^]bc !"#$%&'()*rstuvwxyz{|}~+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxportable experimentallibraries@haskell.orgSafe! type class. Minimal definition: < or  #Instances should satisfy the laws:  Naturality :  ? liftM (f *** g) (mzip ma mb) = mzip (liftM f ma) (liftM g mb)  Information Preservation: + liftM (const ()) ma = liftM (const ()) mb  ==>  munzip (mzip ma mb) = (ma, mb) <y<<<yY Trustworthynon-portable (GHC extensions)internalcvs-ghc@haskell.org Trustworthy[ Trustworthy      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}\portable experimentalashley@semantic.org Trustworthy~A class for categories. " id and (.) must form a monoid. the identity morphism morphism composition Right-to-left composition Left-to-right composition ~z~~~z] Trustworthy{{^non-portable (GHC Extensions)internalcvs-ghc@haskell.orgNone returns a '[String]', representing the current call stack. This  can be useful for debugging. CThe implementation uses the call-stack simulation maintined by the = profiler, so it only works if the program was compiled with -prof 6 and contains suitable SCC annotations (e.g. by using  -fprof-auto). 7 Otherwise, the list returned is likely to be empty or  uninformative.    _portable provisionallibraries@haskell.orgUnsafeThe 7 function outputs the trace message from the IO monad. = This sequences the output with respect to other IO actions. Deprecated. Use . The A function outputs the trace message given as its first argument, 4before returning the second argument as its result. 'For example, this returns the value of f x but first outputs the message.  / trace ("calling f with x = " ++ show x) (f x) The  function should only* be used for debugging, or for monitoring Mexecution. The function is not referentially transparent: its type indicates Hthat it is a pure function but it has the side effect of outputting the trace message. Like  , but uses $ on the argument to convert it to a u. MThis makes it convenient for printing the values of interesting variables or Jexpressions inside a function. For example here we print the value of the  variables x and z:  f x y =  traceShow (x, z) $ result  where  z = ...  ... The  function behaves like  with the difference that L the message is emitted to the eventlog, if eventlog profiling is available  and enabled at runtime. :It is suitable for use in pure code. In an IO context use   instead. Note that when using GHC'0s SMP runtime, it is possible (but rare) to get M duplicate events emitted if two CPUs simultaneously evaluate the same thunk  that uses . The 7 function emits a message to the eventlog, if eventlog 0 profiling is available and enabled at runtime.  Compared to , % sequences the event with respect to  other IO actions. like 1, but additionally prints a call stack if one is  available. :In the current GHC implementation, the call stack is only + availble if the program was compiled with -prof ; otherwise   behaves exactly like . Entries in the call  stack correspond to SCC* annotations, so it is a good idea to use   -fprof-auto or -fprof-auto-calls' to add SCC annotations automatically. ||non-portable (GHC Extensions)internalcvs-ghc@haskell.orgUnsafeThe 0 function uses the user supplied function which N projects an element out of every list element in order to to first sort the L input list and then to form groups by equality on these projected elements The F type allows you to reverse sort order conveniently. A value of type   a contains a value of type a (represented as  a).  If a has an G0 instance associated with it then comparing two L values thus wrapped will give you the opposite of their normal sort order. N This is particularly useful when sorting in generalised list comprehensions,  as in: then sortWith by  x 9 ensures that all the elements of the list are identical & and then returns that unique element The - function sorts a list of elements using the A user supplied function to project something out of each element }~4X]^_`ilqrtvwyz                           ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~                            ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5+`zl_y^w]vqrX4t }~ non-portableinternallibraries@haskell.org Trustworthy8    )*+,+,-36:<=>?W    non-portable (GHC Extensions)internalcvs-ghc@haskell.orgUnsafe  K k !"#$%&'(DEFK LL MMNOPQ N J O PRSTV[ V \ W X Y Z [] _           `Safe1Global garbage collection and memory statistics.  Total number of bytes allocated (Number of garbage collections performed )Maximum number of live bytes seen so far #Number of byte usage samples taken 3 | Sum of all byte usage samples, can be used with   to calculate averages with ? arbitrary weighting (if you are sampling this record multiple  times). !Number of bytes copied during GC Current number of live bytes %Current number of bytes lost to slop <Maximum number of bytes lost to slop at any one time so far &Maximum number of megabytes allocated B | CPU time spent running mutator threads. This does not include + any profiling overhead or initialization. >Wall clock time spent running mutator threads. This does not  include initialization. CPU time spent running GC !Wall clock time spent running GC +Total CPU time elapsed since program start *Total wall clock time elapsed since start A | Number of bytes copied during GC, minus space held by mutable 3 lists held by the capabilities. Can be used with  , to determine how well parallel GC utilized  all cores. <Sum of number of bytes copied each GC by the most active GC  thread each GC. The ratio of  divided by  ) approaches 1 for a maximally sequential ? run and approaches the number of threads (set by the RTS flag  -N ) for a maximally parallel run. BRetrieves garbage collection and memory statistics as of the last E garbage collection. If you would like your statistics as recent as  possible, first run a t. a non-portable experimentallibraries@haskell.org Trustworthy,An abstract unique object. Objects of type  may be 4 compared for equality and ordering and hashed into `. Creates a new object of type . The value returned will . not compare equal to any other value of type  returned by  previous calls to &. There is no limit on the number of  times  may be called.  Hashes a  into an `. Two s may hash to the 9 same value, although in practice this is unlikely. The ` ! returned makes a good hash key. portable provisionallibraries@haskell.orgSafe()*+,CEE+C)*,(!portable provisionallibraries@haskell.org TrustworthyAn infix synonym for +. +EE+bnon-portable (concurrency) experimentallibraries@haskell.org Trustworthy = is an abstract type representing an unbounded FIFO channel. $Build and returns a new instance of . Write a value to a . Read the next value from the .  Duplicate a :: the duplicate channel begins empty, but data written to N either channel from then on will be available from both. Hence this creates F a kind of broadcast channel, where data written by anyone is seen by  everyone else. >(Note that a duplicated channel is not equal to its original.  So: fmap (c /=) $ dupChan c returns True for all c.) JPut a data item back onto a channel, where it will be the next item read. Returns { if the supplied  is empty. =Return a lazy list representing the contents of the supplied   , much like . #Write an entire list of items to a .    cnon-portable (concurrency) experimentallibraries@haskell.org TrustworthyA 8 is a simple quantity semaphore, in which the available  "quantity"' is always dealt with in units of one.  Build a new # with a supplied initial quantity. + The initial quantity must be at least 0. $Wait for a unit to become available Signal that a unit of the  is available dnon-portable (concurrency) experimentallibraries@haskell.org TrustworthyA 1 is a quantity semaphore, in which the available  "quantity"6 may be signalled or waited for in arbitrary amounts.  Build a new # with a supplied initial quantity. + The initial quantity must be at least 0. 4Wait for the specified quantity to become available 7Signal that a given quantity is now available from the . enon-portable (concurrency) experimentallibraries@haskell.org Trustworthy6Sample variables are slightly different from a normal ]:  Reading an empty  causes the reader to block.  (same as ` on empty ])  Reading a filled  empties it and returns value.  (same as `)  Writing to an empty  fills it with a value, and 8 potentially, wakes up a blocked reader (same as for a on  empty ]).  Writing to a filled  overwrites the current value.  (different from a on full ].) Build a new, empty,  Build a  with an initial value. BIf the SampleVar is full, leave it empty. Otherwise, do nothing. ?Wait for a value to become available, then take it and return. Write a value into the &, overwriting any previous value that  was there. Returns { if the  is currently empty. ANote that this function is only useful if you know that no other + threads can be modifying the state of the  , because  otherwise the state of the  may have changed by the time  you see the result of . Snon-portable (concurrency) experimentallibraries@haskell.org Trustworthy{! if bound threads are supported.  If rtsSupportsBoundThreads is x,   will always return x and both  and  will  fail. Like *, this sparks off a new thread to run the k :computation passed as the first argument, and returns the  of the newly created thread.  However,  creates a bound# thread, which is necessary if you >need to call foreign (non-Haskell) libraries that make use of (thread-local state, such as OpenGL (see Control.Concurrent#boundthreads). Using  instead of # makes no difference at all to the Dscheduling behaviour of the Haskell runtime system. It is a common #misconception that you need to use  instead of  to Cavoid blocking all the Haskell threads when making a foreign call; this isn'7t the case. To allow foreign calls to be made without Eblocking all the Haskell threads (with GHC), it is only necessary to use the  -threaded4 option when linking your program, and to make sure !the foreign import is not marked unsafe. Returns { if the calling thread is bound, that is, if it is H safe to use foreign libraries that rely on thread-local state from the  calling thread. Run the kA computation passed as the first argument. If the calling thread is not bound), a bound thread is created temporarily. runInBoundThread doesn't finish until the k computation finishes. PYou can wrap a series of foreign function calls that rely on thread-local state with runInBoundThread6 so that you can use them without knowing whether the current thread is bound. Run the kA computation passed as the first argument. If the calling thread is bound1, an unbound thread is created temporarily using . runInBoundThread doesn't finish until the k computation finishes. Use this function only4 in the rare case that you have actually observed a Aperformance loss due to the use of bound threads. A program that doesn' t need it'$s main thread to be bound and makes heavy use of concurrency *(e.g. a web server), might want to wrap it's main action in runInUnboundThread. ONote that exceptions which are thrown to the current thread are thrown in turn Ito the thread that is executing the given computation. This ensures there's +always a way of killing the forked thread. @Block the current thread until data is available to read on the # given file descriptor (GHC only). This will throw an D# if the file descriptor was closed C while this thread was blocked. To safely close a file descriptor  that has been used with , use  . :Block the current thread until data can be written to the # given file descriptor (GHC only). This will throw an D# if the file descriptor was closed C while this thread was blocked. To safely close a file descriptor  that has been used with , use  . <]^_`abcde  JKLMN  f non-portable experimentallibraries@haskell.org TrustworthyWrap an k$ computation to time out and return Nothing in case no result  is available within n microseconds (1/10^6 seconds). In case a result * is available before the timeout expires, Just a is returned. A negative  timeout interval means "wait indefinitely"!. When specifying long timeouts,  be careful not to exceed maxBound :: Int. ?The design of this combinator was guided by the objective that  timeout n f # should behave exactly the same as f as long as f doesn't time out. This  means that f has the same # it would have without the timeout  wrapper. Any exceptions f. might throw cancel the timeout and propagate " further up. It also possible for f' to receive exceptions thrown to it by  another thread. BA tricky implementation detail is the question of how to abort an IO L computation. This combinator relies on asynchronous exceptions internally. H The technique works very well for computations executing inside of the % Haskell runtime system, but it doesn'$t work at all for non-Haskell code. D Foreign function calls, for example, cannot be timed out with this B combinator simply because an arbitrary C function cannot receive  asynchronous exceptions. When timeout" is used to wrap an FFI call that M blocks, no timeout event can be delivered until the FFI call returns, which J pretty much negates the purpose of the combinator. In practice, however, = this limitation is less severe than it may sound. Standard I/ O functions  like , , Network.Socket.accept, or  + appear to be blocking, but they really don't < because the runtime system uses scheduling mechanisms like  select(2) to  perform asynchronous I/2O, so it is possible to interrupt standard socket  I/ O or file I/O using this combinator. gportable experimentallibraries@haskell.orgSafe f* is the least fixed point of the function f,  i.e. the least defined x such that f x = x. (*) `on` f = \x y -> f x * f y. Typical usage:  ( `on` ). Algebraic properties:  (*) `on`  = (*) (if (*) "  {",  "}) ((*) `on` f) `on` g = (*) `on` (f . g)  on f .  on g =  on (g . f) portable experimentallibraries@haskell.org Trustworthy-*The fixed point of a monadic computation.  - f executes the action f only once, with the eventual & output fed back as the input. Hence f should not be strict,  for then - f would diverge. V"Monads having fixed points with a ' knot-tying' semantics.  Instances of V$ should satisfy the following laws:  purity  - (, . h) = , ( h) left shrinking (or  tightening)  - (\ x -> a >>= \y -> f x y) = a >>= \y -> - (\ x -> f x y) sliding  - (  h . f) =   h (- (f . h)),  for strict h. nesting  - (\x -> - (\y -> f x y)) = - (\ x -> f x x) 7This class is used in the translation of the recursive do notation  supported by GHC and Hugs. -V-VV-V- portable provisionallibraries@haskell.org Trustworthy.Lift a function to an arrow. 0;Send the first component of the input through the argument 5 arrow, and copy the rest unchanged to the output. 2;Fanin: Split the input between the two argument arrows and  merge their outputs. ?The default definition may be overridden with a more efficient  version if desired. The 3: operator expresses computations in which an output value B is fed back as input, although the computation occurs only once.  It underlies the rec. value recursion construct in arrow notation.  3$ should satisfy the following laws:   extension  3 (. f) = . (\ b ->  ( (\ (c,d) -> f (b,d)))) left tightening  3 (0 h >>> f) = h >>> 3 f right tightening  3 (f >>> 0 h) = 3 f >>> h sliding  3 (f >>> . ( *** k)) = 3 (. ( *** k) >>> f)  vanishing  3 (3 f) = 3 (. unassoc >>> f >>> . assoc)  superposing   (3 f) = 3 (. assoc >>>  f >>> . unassoc) where  assoc ((a,b),c) = (a,(b,c))  unassoc (a,(b,c)) = ((a,b),c) The  class is equivalent to C: any monad gives rise  to a  arrow, and any instance of  defines a monad. ?Some arrows allow application of arrow inputs to other inputs. . Instances should satisfy the following laws:  0 (. (\x -> . (\y -> (x,y)))) >>> 1 =  0 (. (g >>>)) >>> 1 =  g >>> 1 0 (. (>>> h)) >>> 1 = 1 >>> h*Such arrows are equivalent to monads (see ). >Choice, for arrows that support it. This class underlies the  if and case constructs in arrow notation.  Minimal complete definition: , satisfying the laws   (. f) = . ( f)  (f >>> g) =  f >>>  g  f >>> . | = . | >>> f  f >>> . ( +++ g) = . ( +++ g) >>>  f  ( f) >>> . assocsum = . assocsum >>>  fwhere  # assocsum (Left (Left x)) = Left x , assocsum (Left (Right y)) = Right (Left y) & assocsum (Right z) = Right (Right z) CThe other combinators have sensible default definitions, which may  be overridden for efficiency. ;Feed marked inputs through the argument arrow, passing the ) rest through unchanged to the output. A mirror image of . ?The default definition may be overridden with a more efficient  version if desired. ;Split the input between the two argument arrows, retagging  and merging their outputs. / Note that this is in general not a functor. ?The default definition may be overridden with a more efficient  version if desired. A monoid on arrows. 'An associative operation with identity . Kleisli arrows of a monad. The basic arrow class. Minimal complete definition: . and 0, satisfying the laws  . id =  . (f >>> g) = . f >>> . g 0 (. f) = . (0 f) 0 (f >>> g) = 0 f >>> 0 g 0 f >>> .  = .  >>> f 0 f >>> . ( *** g) = . ( *** g) >>> 0 f 0 (0 f) >>> . assoc = . assoc >>> 0 fwhere   assoc ((a,b),c) = (a,(b,c)) 9The other combinators have sensible default definitions, ) which may be overridden for efficiency. A mirror image of 0. ?The default definition may be overridden with a more efficient  version if desired. <Split the input between the two argument arrows and combine > their output. Note that this is in general not a functor. ?The default definition may be overridden with a more efficient  version if desired. ;Fanout: send the input to both argument arrows and combine  their output. ?The default definition may be overridden with a more efficient  version if desired. ,The identity arrow, which plays the role of , in arrow notation. %Precomposition with a pure function. &Postcomposition with a pure function. =Precomposition with a pure function (right-to-left variant). >Postcomposition with a pure function (right-to-left variant). Any instance of ! can be made into an instance of   by defining  = . 1Beware that for many monads (those for which the ) operation  is strict) this instance will not" satisfy the right-tightening law  required by the  class. *.0123 .0123 .0213312.0non-portable (GHC extensions)internalcvs-ghc@haskell.org Trustworthy/5/5/5/5:non-portable (requires universal quantification for runST) experimentallibraries@haskell.orgUnsafeiLMN:non-portable (requires universal quantification for runST) experimentallibraries@haskell.org TrustworthyiLiL#:non-portable (requires universal quantification for runST) experimentallibraries@haskell.orgUnsafeMNMNh:non-portable (requires universal quantification for runST) experimentallibraries@haskell.orgUnsafeiLiL:non-portable (requires universal quantification for runST) provisionallibraries@haskell.orgUnsafe"The lazy state-transformer monad.  A computation of type  s a& transforms an internal state indexed  by s, and returns a value of type a.  The s parameter is either 6 an unstantiated type variable (inside invocations of ), or  i (inside invocations of ). BIt serves to keep the internal states of different invocations of  2 separate from each other and from invocations of . The ) and *7 operations are not strict in the state. For example, 5 (writeSTRef _|_ v >>= readSTRef _|_ >> return 2) = 2>Return the value computed by a state transformer computation.  The forall- ensures that the internal state used by the  9 computation is inaccessible to the rest of the program. HAllow the result of a state transformer computation to be used (lazily)  inside the computation.  Note that if f is strict,  f = _|_. Convert a strict 0 computation into a lazy one. The strict state thread passed to & is not performed until the result of .the lazy state thread it returns is demanded. Convert a lazy  computation into a strict one. =A monad transformer embedding lazy state transformers in the k  monad. The i- parameter indicates that the internal state  used by the . computation is a special one supplied by the k < monad, and thus distinct from those used by invocations of .  i i:non-portable (requires universal quantification for runST) provisionallibraries@haskell.org Trustworthyiiportable experimentallibraries@haskell.org TrustworthyY4A functor with application, providing operations to  embed pure expressions (), and 2 sequence computations and combine their results (). DA minimal complete definition must include implementations of these * functions satisfying the following laws:  identity     v = v  composition   (.)  u  v  w = u  (v  w)  homomorphism   f   x =  (f x)  interchange  u   y =  ( y)  u DThe other methods have the following default definitions, which may < be overridden with equivalent specialized implementations:    u  v =  ( )  u  v  u  v =    u  v $As a consequence of these laws, the E instance for f will satisfy    + f x =  f  x If f is also a C, it should satisfy  = , and  () =  (which implies that  and  satisfy the  applicative functor laws). Lists, but with an Y# functor based on zipping, so that f   xs1  ...   xsn =  (zipWithn f xs1 ... xsn)"A monoid on applicative functors. Minimal complete definition:  and .  If defined,  and  should be the least solutions  of the equations:   some v = (:)  v  many v many v = some v   []The identity of   An associative binary operation  One or more. Zero or more. Lift a value. Sequential application. >Sequence actions, discarding the value of the first argument. ?Sequence actions, discarding the value of the second argument.  A variant of  with the arguments reversed. Lift a function to actions. * This function may be used as a value for + in a E instance. #Lift a binary function to actions. $Lift a ternary function to actions.  One or none. 1Y     Y     Y     !Y     portable experimentallibraries@haskell.org Trustworthy#Z$Data structures that can be folded. Minimal complete definition:  or  . For example, given a data type  9 data Tree a = Empty | Leaf a | Node (Tree a) a (Tree a) a suitable instance would be   instance Foldable Tree where  foldMap f Empty = mempty  foldMap f (Leaf x) = f x M foldMap f (Node l k r) = foldMap f l `mappend` f k `mappend` foldMap f r CThis is suitable even for abstract types, as the monoid is assumed > to satisfy the monoid laws. Alternatively, one could define foldr:  instance Foldable Tree where  foldr f z Empty = z  foldr f z (Leaf x) = f x z ; foldr f z (Node l k r) = foldr f (f k (foldr f z r)) l 4Combine the elements of a structure using a monoid. /Map each element of the structure to a monoid,  and combine the results.  'Right-associative fold of a structure.   f z =  f z . 0!&Left-associative fold of a structure. ! f z =  f z . 0" A variant of   that has no base case, 7 and thus may only be applied to non-empty structures. " f =  f . 0# A variant of ! that has no base case, 7 and thus may only be applied to non-empty structures. # f =  f . 0$'Fold over the elements of a structure, ) associating to the right, but strictly. %/Monadic fold over the elements of a structure, 4 associating to the right, i.e. from right to left. &'Fold over the elements of a structure, ( associating to the left, but strictly. '/Monadic fold over the elements of a structure, 3 associating to the left, i.e. from left to right. (7Map each element of a structure to an action, evaluate ; these actions from left to right, and ignore the results. )) is ( with its arguments flipped. *>Map each element of a structure to a monadic action, evaluate ; these actions from left to right, and ignore the results. ++ is * with its arguments flipped. ,:Evaluate each action in the structure from left to right,  and ignore the results. -BEvaluate each monadic action in the structure from left to right,  and ignore the results. .1The sum of a collection of actions, generalizing 1. /1The sum of a collection of actions, generalizing 1. 0!List of elements of a structure. 1?The concatenation of all the elements of a container of lists. 2DMap a function over all the elements of a container and concatenate  the resulting lists. 33; returns the conjunction of a container of Bools. For the  result to be { , the container must be finite; x , however,  results from a x' value finitely far from the left end. 44; returns the disjunction of a container of Bools. For the  result to be x , the container must be finite; { , however,  results from a {' value finitely far from the left end. 5IDetermines whether any element of the structure satisfies the predicate. 6HDetermines whether all elements of the structure satisfy the predicate. 7The 7: function computes the sum of the numbers of a structure. 8The 8> function computes the product of the numbers of a structure. 9.The largest element of a non-empty structure. :AThe largest element of a non-empty structure with respect to the  given comparison function. ;,The least element of a non-empty structure. <?The least element of a non-empty structure with respect to the  given comparison function. =)Does the element occur in the structure? >> is the negation of =. ?The ?8 function takes a predicate and a structure and returns B the leftmost element of the structure matching the predicate, or   if there is no such element. &Z !"#$%&'()*+,-./0123456789:;<=>?#Z !"#$%&'()*+,-./0123456789:;<=>?#Z !"#$&%'(),.*+-/0123456789:;<=>? Z !"#$%&'()*+,-./0123456789:;<=>?portable experimentallibraries@haskell.org Trustworthy [AFunctors representing data structures that can be traversed from  left to right. Minimal complete definition: @ or A. Instances are similar to E, e.g. given a data type  9 data Tree a = Empty | Leaf a | Node (Tree a) a (Tree a) a suitable instance would be  ! instance Traversable Tree where " traverse f Empty = pure Empty ' traverse f (Leaf x) = Leaf <$> f x M traverse f (Node l k r) = Node <$> traverse f l <*> f k <*> traverse f r :This is suitable even for abstract types, as the laws for   imply a form of associativity. 7The superclass instances should satisfy the following:  In the E instance, +# should be equivalent to traversal + with the identity applicative functor (H).  In the Z instance,   should be @ equivalent to traversal with a constant applicative functor  (I). @7Map each element of a structure to an action, evaluate < these actions from left to right, and collect the results. A:Evaluate each action in the structure from left to right,  and collect the results. B>Map each element of a structure to a monadic action, evaluate < these actions from left to right, and collect the results. CBEvaluate each monadic action in the structure from left to right,  and collect the results. DD is @ with its arguments flipped. EE is B with its arguments flipped. FThe F( function behaves like a combination of +  and 8; it applies a function to each element of a structure, E passing an accumulating parameter from left to right, and returning D a final value of this accumulator together with the new structure. GThe G( function behaves like a combination of +  and foldr8; it applies a function to each element of a structure, E passing an accumulating parameter from right to left, and returning D a final value of this accumulator together with the new structure. H)This function may be used as a value for + in a E  instance, provided that @ is defined. (Using  H with a [ instance defined only by  A% will result in infinite recursion.) I)This function may be used as a value for    in a Z instance. [@ABCDEFGHI [@ABCDEFGHI [@ABCDEFGHI[@ABCDEFGHIj:non-portable (requires universal quantification for runST) provisionallibraries@haskell.orgUnsafek:non-portable (requires universal quantification for runST) provisionallibraries@haskell.orgUnsafeJK iJK iJKJK :non-portable (requires universal quantification for runST) provisionallibraries@haskell.orgNoneiLlportable provisionallibraries@haskell.org Trustworthy L'Complex numbers are an algebraic type. For a complex number z,  z# is a number with the magnitude of z, 6 but oriented in the positive real direction, whereas  z  has the phase of z, but unit magnitude. M3forms a complex number from its real and imaginary  rectangular components. N,Extracts the real part of a complex number. O1Extracts the imaginary part of a complex number. P#The conjugate of a complex number. QDForm a complex number from polar components of magnitude and phase. RR t# is a complex value with magnitude 1  and phase t (modulo 2*). S The function S takes a complex number and 6 returns a (magnitude, phase) pair in canonical form: : the magnitude is nonnegative, and the phase in the range (-, ]; 1 if the magnitude is zero, then so is the phase. T/The nonnegative magnitude of a complex number. U,The phase of a complex number, in the range (-, ]. 1 If the magnitude is zero, then so is the phase. LMNOPQRSTU LMNOPQRSTU LMNOQRSTUP LMNOPQRSTUmportable experimental$Ashley Yakeley <ashley@semantic.org> Trustworthy V%resolution of 10^-12 = .000000000001 X!resolution of 10^-9 = .000000001 Zresolution of 10^-6 = .000001 \resolution of 10^-3 = .001 ^?resolution of 10^-2 = .01, useful for many monetary currencies `resolution of 10^-1 = .1 b0resolution of 1, this works the same as Integer f,The type parameter should be an instance of d. ggeneralisation of 6 to any instance of Real hgeneralisation of 9 to any instance of Real igeneralisation of 7 to any instance of Real j0First arg is whether to chop off trailing zeros 4VWXYZ[\]^_`abcdefghij VWXYZ[\]^_`abcdefghijgihfdejcba`_^]\[ZYXWV+VWXYZ[\]^_`abcdefghij portablestablelibraries@haskell.org TrustworthyMMportablestablelibraries@haskell.orgSafekk), applied to two real fractional numbers x and epsilon, - returns the simplest rational number within epsilon of x.  A rational number y is said to be simpler than another y' if   (; y) <=  (; y'), and  < y <= < y'. 7Any real interval contains a unique simplest rational;  in particular, note that 0/1" is the simplest rational of all. kgh:;<kgh:;<kk+$non-portable (uses Control.Monad.ST) experimentallibraries@haskell.org TrustworthylMutate the contents of an  lllln)non-portable (uses Control.Monad.ST.Lazy) experimentallibraries@haskell.orgSafemnopmnopmnopmnop +non-portable (uses Control.Monad.ST.Strict) provisionallibraries@haskell.orgSafelo6non-portable (local universal quantification in ReadP) experimentallibraries@haskell.org TrustworthyqA q0 represents the version of a software entity. An instance of ?. is provided, which implements exact equality %modulo reordering of the tags in the t field. An instance of G- is also provided, which gives lexicographic ordering on the s( fields (i.e. 2.1 > 2.0, 1.2.3 > 1.2.2, Getc.). This is expected to be sufficient for many uses, but note that Ayou may need to use a more specific ordering for your versioning Gscheme. For example, some versioning schemes may include pre-releases which have tags "pre1", "pre2"%, and so on, and these would need to Fbe taken into account when determining ordering. In some cases, date Cordering may be more appropriate, so the application would have to  look for date tags in the t field and compare those. The bottom line is, don't always assume that  and other G )operations are the right thing for every q. ASimilarly, concrete representations of versions may differ. One 2possible concrete representation is provided (see u and v9), but depending on the application a different concrete (representation may be more appropriate. s8The numeric branch for this version. This reflects the = fact that most software versions are tree-structured; there : is a main trunk which is tagged with versions at various = points (1,2,3...), and the first branch off the trunk after 9 version 3 is 3.1, the second branch off the trunk after 8 version 3 is 3.2, and so on. The tree can be branched * arbitrarily, just by adding more digits. %We represent the branch as a list of `, so  version 3.2.1 becomes [3,2,1]. Lexicographic ordering  (i.e. the default instance of G for [Int]) gives # the natural ordering of branches. t;A version can be tagged with an arbitrary list of strings. > The interpretation of the list of tags is entirely dependent - on the entity that this version applies to. u2Provides one possible concrete representation for q. For  a version with s = [1,2,3] and t  = ["tag1","tag2"], the output will be 1.2.3-tag1-tag2. v0A parser for versions in the format produced by u. qrstuv  qrstuvqrstuvqrstuv  pportable experimentallibraries@haskell.orgSafe w@Describes whether an option takes an argument or not, and if so 3 how the argument is injected into a value of type a. xoptional argument yoption requires argument zno argument expected {Each { describes a single option. The arguments to | are: ! list of short option characters & list of long option strings (without "--")  argument descriptor  explanation of option for user }.What to do with options following non-options ~wrap non-options into options +freely intersperse options and non-options ,no option processing after first non-option @Return a string describing the usage of a command, derived from ? the header (first argument) and the options described by the  second argument. EProcess the command-line, and return the list of values that matched (and those that didn't). The arguments are:  The order requirements (see })  The option descriptions (see {) 9 The actual command line arguments (presumably got from  r ). = returns a triple consisting of the option arguments, a list .of non-options, and a list of error messages. This is almost the same as , but returns a quadruple Econsisting of the option arguments, a list of non-options, a list of 4unrecognized options, and a list of error messages.   wxyz{|}~ wxyz{|}~ }~{|wzyx  wzyx{|}~qportable provisionallibraries@haskell.org Trustworthy Computation , returns the number of picoseconds CPU time ? used by the current program. The precision of this result is  implementation-dependent. The 0 constant is the smallest measurable difference D in CPU time that the implementation can record, and is given as an ! integral number of picoseconds.   rportable provisionallibraries@haskell.orgSafe Computation  returns a list of the program' s command 2 line arguments (not including the program name).  Computation + returns the name of the program as it was  invoked. BHowever, this is hard-to-impossible to implement on some non-Unix GOSes, so instead, for maximum portability, we just return the leafname @of the program as invoked. Even then there are some differences Ebetween platforms: on Windows, for example, a program invoked as foo is probably really FOO.EXE, and that is what  will return.  Computation  var returns the value  of the environment variable var.  This computation may fail with:  &  if the environment variable  does not exist.  args act - while executing action act, have  return args.  name act - while executing action act, have  return name. ' retrieves the entire environment as a  list of  (key,value) pairs. ,If an environment entry does not contain an '=' character,  the key is the whole entry and the value is the empty string. !"#$%&'()*+,!"#$%&'()*+,Bportable provisionallibraries@haskell.org Trustworthy Computation  code throws  code. 1 Normally this terminates the program, returning code to the  program' s caller. %On program termination, the standard Handles stdout and  stderr/ are flushed automatically; any other buffered Handles B need to be flushed manually, otherwise the buffered data will be  discarded. >A program that fails in any other way is treated as if it had  called . 8 A program that terminates successfully without calling  + explicitly is treated as it it had called  . As an  is not an D,  bypasses  the error handling in the k$ monad and cannot be intercepted by  | from the Prelude. However it is a  SomeException , and can " be caught using the functions of Control.Exception. This means & that cleanup computations added with U  (from Control.Exception ) are also executed properly on . Note: in GHC, ( should be called from the main program @ thread in order to exit the process. When called from another  thread,  will throw an  ExitException as normal, but the 6 exception will not cause the process itself to exit. The computation  is equivalent to   ( exitfail),  where exitfail is implementation-dependent. The computation  is equivalent to   , It terminates the program  successfully. sportable experimentallibraries@haskell.orgSafeThe version of % with which the program was compiled  or is being interpreted. 6The operating system on which the program is running. :The machine architecture on which the program is running. ?The Haskell implementation with which the program was compiled  or is being interpreted. --tportable provisionallibraries@haskell.orgSafe)Triggers an immediate garbage collection u non-portable experimentallibraries@haskell.org TrustworthyDAn abstract name for an object, that supports equality and hashing. *Stable names have the following property:  If sn1 :: StableName and sn2 :: StableName and  sn1 == sn2  then sn1 and sn2 were created by calls to makeStableName on  the same object. AThe reverse is not necessarily true: if two stable names are not L equal, then the objects they name may still be equal. Note in particular  that  mkStableName may return a different  after an  object is evaluated. -Stable Names are similar to Stable Pointers (Foreign.StablePtr), $ but differ in the following ways:  There is no freeStableName operation, unlike Foreign.StablePtrs. F Stable names are reclaimed by the runtime system when they are no  longer needed.  There is no deRefStableName operation. You can't get back from B a stable name to the original Haskell object. The reason for G this is that the existence of a stable name for an object does not J guarantee the existence of the object itself; it can still be garbage  collected. Makes a 0 for an arbitrary object. The object passed as ( the first argument is not evaluated by .  Convert a  to an `. The ` returned is not  necessarily unique; several s may map to the same ` D (in practice however, the chances of this are small, so the result  of  makes a good hash key). ././9 non-portable experimentallibraries@haskell.org TrustworthyA specialised version of <", where the key and the value are  the same object: 4 mkWeakPtr key finalizer = mkWeak key key finalizer A specialised version of  , where the ; object @ returned is simply thrown away (however the finalizer will be = remembered by the garbage collector, and will still be run % when the key becomes unreachable). Note: adding a finalizer to a  using   won'0t work as well as using the specialised version   because the latter . version adds the finalizer to the primitive  'ForeignPtr#' object  inside, whereas the generic  will add the finalizer to F the box. Optimisations tend to remove the box, which may cause the C finalizer to run earlier than you intended. The same motivation  justifies the existence of  ) and  ,% (the non-uniformity is accidental). A specialised version of <$ where the value is actually a pair  of the key and value passed to :  ? mkWeakPair key val finalizer = mkWeak key (key,val) finalizer :The advantage of this is that the key can be retrieved by =  in addition to the value. ;<=>;<=>vportable provisionallennart@augustsson.netSafeThe 0 class provides the variable argument magic for  8. Its implementation is intentionally not visible from  this module. The 0 class provides the variable argument magic for  8. Its implementation is intentionally not visible from A this module. If you attempt to pass an argument of a type which % is not an instance of this class to  or , then 6 the compiler will report it as a missing instance of . JFormat a variable number of arguments with the C-style formatting string.  The return value is either u or (k a). 6The format string consists of ordinary characters and / conversion  specifications/3, which specify how to format one of the arguments M to printf in the output string. A conversion specification begins with the  character %2, followed by one or more of the following flags:  1 - left adjust (default is right adjust) = + always use a sign (+ or -) for signed conversions . 0 pad with zeroes rather than spaces &followed optionally by a field width:   num field width 0 * as num, but taken from argument list $followed optionally by a precision:  0 .num precision (number of decimal places) !and finally, a format character:  ; c character Char, Int, Integer, ... ; d decimal Char, Int, Integer, ... ; o octal Char, Int, Integer, ... ; x hexadecimal Char, Int, Integer, ... ; X hexadecimal Char, Int, Integer, ... ; u unsigned decimal Char, Int, Integer, ... 1 f floating point Float, Double 1 g general format float Float, Double 1 G general format float Float, Double 1 e exponent format float Float, Double 1 E exponent format float Float, Double * s string String EMismatch between the argument types and the format string will cause ' an exception to be thrown at runtime.  Examples:  > printf "%d\n" (23::Int)  23 & > printf "%s %s\n" "Hello" "World"  Hello World  > printf "%.2f\n" pi  3.14  Similar to *, except that output is via the specified  $. The return type is restricted to (k a). 80123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`a.0543216789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`aportable provisionallibraries@haskell.orgSafebbcxxxx !"#$%&'x(x)x*x+x,-.x/0x123456789:9;<x=x>x?x@xA B CD E F G HIJKLMN O PQR9STUVxWXxYZ9[\]^_`abcdefg h ijklmnon}npnqnrstunvwxyn{z{|x}n~nnnnnnnn9999999999 xxxxxxxxxxxxxx"z"""""""""""y|~                               $ !"#$%%&'())*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUV(WXYZ[\]*^*_*`*a*b*c*d*e*f*g*h*i*j*k*l*m*n*o*p*q*rstuvwxyz{|}~-----------------------------------.........r....}.}........../////////////////0011%%%%%%%%%%%%%{     222222222222222 2!2"2#2$2%2&2'2(2)2*2+2,2-2.333/30313233343546464747484849494:4;4<4=4=4>4>4?4?4@4@4A4A4B4B4C4C4D4D4E4E4F4F4G4G4H4H4I4I4J4J4K4K4L4L4M4M4N4N4O4O4P4P4Q4QRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~$$$$$$+778888888,,,:::::::::::::::: : : : : : : : ::::::;;;;;;;;;;;;;  =!="=#=$=%=%=&='=(=)=*=+=,=-=.=/=0=1=2=3=4=5=6=7=8=9=:=;=<===>=?=@=A=B=C=D=E=F=G>H>I>J>K>L>L>M>N>O>P>Q>R>S>T>T>U>V>>W>X?Y?Z?[@\@D@]@^@_@`@a@b@c@d@effghijklmnopqrstuvwxyz{|}~CCCCCCCCCDDDDDDDDDEEEEEEEFFFFGGGGGGGGGGGGHHHHHHHHHHHHIIIIIIAJKKKKKKKKKKLLLLLLLLLLLLLLLLLLLLMMMMMMMNNNNNNNNNNNNNNNNNNNNNNNNNNNNNOOOOOOOOOOOOOOOOOOOOOOOO O O O O OOOOOOOOOOOOOOOOOOO O!O"O#O$O%O&O'O(O)O*O+O,O-O.O/O0O1O2O3O4O5O6O7O8O9O:O;O<O=O>O?O@OAOBOCODOEOFOGOHOIOJOKOLOMONOOOPOQOROSOTOUOVOWOXOYOZO[O\O]O^O_O`OaObOcOdOeOfOgOhOiOjOkOlOmOnOoOpPqPrPsPtPuPvPwPxPyPzP{P|P}P~PQW<TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT)))))UUUU'&&&&& &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&VVVVWWWWWWWWWWWWWWWWWWWWWWWWWWWW W W W W W W W W W WWWW11XXX????????????????? !"#$%&H'()*+,-./0123456789:;<=A>A?A?A@AAABACAADAEAFAGAHAIAJAKALAMANAOAPAQARASATAUAVAWAXAYJZJ[J\JJ]J^JJ_J`abcdefghijklmnopqrstuZ&ZZZZZZZDZvZ%ZwZZZxZyZ{ZZxZZZZZZZZZzZ{Z|Z}Z~ZZZZZZZZZZZ[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ [ [ [ [ [[[[[[[[[[[[[[[[[[[ [!["[#[$[%[&['[([)[*[+[,[-[.[/[0[1[2[3[4[5[6[7[8[9[:[;[<[=[>[?[@[A[B[C[D[E[F[G[H[I[J[K[L[M[N[O[P[Q[R[S[T[U[V[W[X[Y[Z[[[\[][^[_[`[a[b[c[d[e[f[g[h[i[j[k[l[m[n[o[p[q[r[s[t[u[v[w[x[y[z[{[|[}[~[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[\\\\\D]^^^^^^^^^^^^^_______`````````````````````aaa!bbbbbbbbbccccddddeeeeeeeSSSSSSSS1S2fgg                         hhKhLK  !"#$%&'(()*+,-./0123456 789:;<=!>?@ABkkKlClDlElFlGlHlIlJlKlLmMmNmOmPmQmRmSmTmUmVmWmXmYmZm[m\m]m^m_m`mab+cnnnncododoeofogohpipjpkplpmpnpopppqprpsptpuqvqwr rxryrzr{r|BBB}s~ssstuuu999vvvvvvxxxxxxxxxxxxxxxxxxxxxxxxxxxxxn{                                  ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~                                                                                                                                                                   !9 "9 #9 $9 %9 &9 '9 (9 ) * + , - . /st 0st 1st 2st 3st 4st 5st 6st 7st 8st 9st :st ;st <st =st >st ?st @st Ast Bst Cst Dst Est Fst Gst Hst Ist Jst Kst Lst Mst Nst Ost Pst Q" R" S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~                                    ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ ; A B C* D* E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~    - - - - - - - - - - - - - - . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . / / / /                           ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v% w x y z { { | | } ~  2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4:4;4<4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4                           $                ! " # $ %8 &88 '8 ( ) * + , - .: /: 0: 1: 2: 3: 4: 5: 6: 7: 8: 9: :: ;: <: =: >: ?; @; A; B; C; D; E; F; G; H; I; J; K; L; L; M; N; O;; P; Q; R; S; T; U; V; W; X;; Y; Z; [; \; ]; ^; _; `; a; b; c; d; e; f; g; h; i; j; k; l; m; n= o= p> q r s t u v w x y z { | | } ~                      C C C C C D D D D D E E E F F F F F F F F F F F F F F F F F FF F G G G G G G G G G G G G G G G H H H H H H H H H H H H H H H K oK MMM M M M MMMMN NNNNNN O O O O PqTTTTTTTTTTTTTTTTTTT T!T"T#T$%&'()*+,-./012U3V4V5V6VW7W8W9W:W;W<W=W>W?W@WAWBWCWDWEWFWGWHWIWJWKWLWMWNWOWPWQWR1S1T1U1VWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~$%XXXXXX XXXXXXX????? `       o+H! !""#$%&\'()*+,-./0123456789:;<=>?@AB=CDE@FGHIJKLMNLKOPPQRRSTUUVWWXYZ[\]^_`abcdefghijklm+nopqrstuvwxyz{|7}~] s+   $451320YY Z[ !"#'()$%& o      !"#A$A%A&A'A(A)A*A+A,A-J.J/J0J1J23456789:;<=>?@ABCDZEZEZZZFZGZHIIJKLMMNOP]LQKiRSTUghVWXXYZ[\]^_`abcdefYgZh[\i]jklmnopqrstuvwxyz{|}~\]_xxyyY`aabbbbcdeS%SSSSSSSf@f@ff                         lllmNmPmRmTmVmXmZmmmmmmmmmmmmm m!m"m#m$m%m&m'm(m)m*m+o,o-p.p/p0p1p2p3p4p5p6p7p8p9p:p;p<p=q>q?q@qAqBrCrDrErFrGrHrIrJrKrLrMrNsOuuPvQvRvSvTvUvVvWvXvYvZv[v\v]v^v_v`vavbvcvdvevfvgvhvivjvkvlvmvnvovpvqvrvsvtvuvvvwvxvyvzv{v|v}v~vvvvbaseControl.Exception.BaseGHC.Exts Data.ListPreludeForeign.StablePtr System.IO Data.Tuple Data.BoolData.EqData.Ord Control.MonadControl.Monad.Fix Control.Arrow GHC.Desugar Data.StringControl.Monad.Zip Data.Data Text.Read Text.ShowData.IxData.Typeable.InternalControl.Applicative Data.FoldableData.Traversable Data.CharData.Int Data.RatioControl.Monad.ST.Safe Data.Word Foreign.Ptr Data.Either Unsafe.Coerce Data.Functor Data.MaybeControl.Monad.ST.Unsafe Data.TypeableNumericSystem.IO.ErrorSystem.IO.UnsafeForeign.Marshal.UnsafeControl.Concurrent.MVar Data.Bits Data.STRef Data.IORefText.ParserCombinators.ReadP Text.Read.LexText.ParserCombinators.ReadPrecGHC.Fingerprint.TypeGHC.Fingerprint GHC.IO.DeviceForeign.StorableForeign.C.TypesForeign.ForeignPtr.SafeForeign.ForeignPtr.UnsafeForeign.Concurrent Data.DynamicSystem.Mem.Weak Data.MonoidData.HashTableForeign GHC.IO.BufferGHC.IO.Encoding.TypesGHC.IO.EncodingGHC.IO.BufferedIO GHC.IO.Handle System.ExitForeign.Marshal.AllocGHC.IO.Encoding.FailureGHC.IO.Encoding.Latin1GHC.IO.Encoding.UTF8GHC.IO.Encoding.UTF16GHC.IO.Encoding.UTF32Foreign.Marshal.ErrorGHC.IO.Handle.FDForeign.Marshal.UtilsForeign.Marshal.Array GHC.ForeignForeign.C.StringForeign.C.ErrorForeign.Marshal.PoolForeign.MarshalGHC.ConcControl.Concurrent GHC.Conc.SyncControl.ExceptionGHC.Conc.SignalSystem.Posix.TypesGHC.IO.Encoding.Iconv GHC.EventControl.OldException GHC.ConstantsControl.CategoryGHC.Environment GHC.Stack Debug.Trace GHC.Stats Data.UniqueControl.Concurrent.ChanControl.Concurrent.QSemControl.Concurrent.QSemNControl.Concurrent.SampleVarSystem.Timeout Data.FunctionControl.Monad.STControl.Monad.ST.Lazy.SafeControl.Monad.ST.Lazy.UnsafeControl.Monad.ST.Lazy Data.Complex Data.FixedData.STRef.Lazy Data.VersionSystem.Console.GetOptSystem.CPUTimeSystem.Environment System.Info System.MemSystem.Mem.StableName Text.PrintfGHC.IO.Encoding.CodePageGHC.BasezipWithMaybeIOtoEnumCharfromEnumGHC.NumEitherGHC.List genericLengthgenericReplicate genericTake genericDropgenericSplitAt genericIndexGHC.ShowRead readsPrecGHC.EnumGHC.STstToIOGHC.Arr GHC.ExceptionGHC.ErrGHC.RealGHC.IO hGetContentsthrowToforkIObracketforkIOWithUnmaskforkIOUnmasked GHC.IOArrayGHC.MVarGHC.Float.RealFracMethodsGHC.Float.ConversionUtils GHC.Float GHC.STRef GHC.IORefGHC.ReadShow showsPrecGHC.WordGHC.Int GHC.IO.IOModeopenFileGHC.PtrStorableInt8Int16Int32Int64Word8Word16Word32Word64 StablePtrfreeHaskellFunPtr GHC.StablePtrnullPtrGHC.PackHandle mkFileHandlemkHandleFromFDSystem.DirectorygetDirectoryContents GHC.Storable GHC.UnicodeisLetterisAlphaGHC.ForeignPtrmallocForeign.ForeignPtrwithForeignPtrGHC.WeakMVarForeign.ForeignPtr.Imp mallocArray mallocArray0GHC.IO.Handle.TypeshFlush hLookAheadGHC.IO.Exception killThread ForeignPtrnewsizeOffree finalizerFreeallocawith Foreign.CForeign.Marshal.SafeforkOSmaskthrowIOunsafePerformIOcatchtryfixIOSystem.Posix.Internals Foreign.SafeGHC.IO.Handle.InternalsGHC.Event.ArrayGHC.Event.ClockGHC.Event.ControlGHC.Event.InternalGHC.Event.EPollGHC.Event.IntMapData.MaplookupfoldrGHC.Event.KQueueGHC.Event.Unique GHC.Event.PSQGHC.Event.ManagerGHC.Event.Thread GHC.Conc.IO GHC.IO.FDGHC.IO.Handle.TextGHC.TopHandlerMainmainexitWith isEOFError isFullErrorisPermissionError exitFailuretakeMVarGHC.Event.PollGHC.PArrGHC.ConsoleHandler GHC.Handle GHC.IOBase performGCControl.Monad.InstanceshGetBufhPutBuf hWaitForInputsortByliftMControl.Monad.ST.ImpControl.Monad.ST.Lazy.ImpfoldMapControl.Monad.ST.StrictData.STRef.StrictgetArgsisDoesNotExistErroraddForeignPtrFinalizeraddMVarFinalizer mkWeakIORefText.Show.Functions absentErroraugment++builderror recSelErrorghc-primGHC.PrimseqirrefutPatErrornoMethodBindingErrornonExhaustiveGuardsError runtimeErrorpatError recConErrorconcatfilterzip newStablePtrprintfstsnd otherwiseassertlazy breakpointbreakpointCond GHC.Magicinlinemap groupWith$ fromInteger- fromRationalenumFrom enumFromThen enumFromToenumFromThenTo GHC.Classes==>=negatefail>>=>>fmapreturnmfixarr>>>firstapp|||loop fromStringtoAnnotationWrapper fromIntegral realToFrac toInteger toRationalguardmzipBoundedEnumEqFloating FractionalIntegralMonadDataFunctorNumOrdReal RealFloatRealFracIxTypeable Typeable1 Typeable2 Typeable3 Typeable4 Typeable5 Typeable6 Typeable7MonadFix MonadPlusIsString ApplicativeFoldable Traversable GHC.TypesBoolDoubleFloatInt integer-gmpGHC.Integer.TypeIntegerOrderingRatioRational RealWorldWordFunPtr ConstraintStringC#D#FalseF#I#TrueLeftRightLTEQGTminmax><not||&&<=compare/= unsafeCoerce isAlphaNum isHexDigit isOctDigitisDigitisLowerisUpperisSpaceisPrint isControlisLatin1isAscii<$chrordidconst.flipuntilasTypeOfshiftL#shiftRL#iShiftL# iShiftRA# iShiftRL#typeOfTyConTypeRep mkTyConAppmkTyCon+*abssignumsubtractcurryuncurryswapJustNothingmaybeisJust isNothingfromJust fromMaybe maybeToList listToMaybe catMaybesmapMaybeheadtaillastinitnulllengthfoldlscanlscanl1foldr1scanrscanr1iteraterepeat replicatecycle takeWhile dropWhiletakedropsplitAtspanbreakreverseandoranyallelemnotElem concatMap!!zip3zipWith3unzipunzip3showshowListShowSshowsshowChar showString showParen showLitChar intToDigitsuccpredminBoundmaxBound showListWithmzeromplus=<<sequence sequence_mapMmapM_filterMforMforM_msum>=><=<forevervoidjoin mapAndUnzipMzipWithM zipWithM_foldMfoldM_ replicateM replicateM_whenunlessliftM2liftM3liftM4liftM5apmfilterSTunsafeInterleaveSTfixSTrunSTrangeindexinRange rangeSizecastArithExceptionDenormal DivideByZeroLossOfPrecision UnderflowOverflow ErrorCall Exception toException fromException SomeExceptionthrow undefinedproperFractiontruncateroundceilingfloor/recipquotremdivmodquotRemdivMod% numerator denominator showSignedevenodd^^^gcdlcmIOError IOException userError MaskingStateMaskedUninterruptibleMaskedInterruptibleUnmaskedFilePath unsafeIOToST unsafeSTToIOunsafeDupablePerformIOunsafeInterleaveIOblockunblockgetMaskingStateblockedmask_uninterruptibleMask_uninterruptibleMaskevaluateunsafeLocalState newEmptyMVarnewMVarputMVar tryTakeMVar tryPutMVar isEmptyMVarBits.&..|.xor complementshiftrotatebitsetBitclearBit complementBittestBitbitSizeisSignedshiftL unsafeShiftLshiftR unsafeShiftRrotateLrotateRpopCount floatRadix floatDigits floatRange decodeFloat encodeFloatexponent significand scaleFloatisNaN isInfiniteisDenormalizedisNegativeZeroisIEEEatan2piexpsqrtlog**logBasesintancosasinatanacossinhtanhcoshasinhatanhacosh showFloat floatToDigitsfromRatSTRefnewSTRef readSTRef writeSTRefIORefnewIORef readIORef writeIORefReadPReadSgetlookpfail+++<++gathersatisfychareofstringmunchmunch1choice skipSpacescountbetweenoptionoptionalmanymany1skipMany skipMany1sepBysepBy1endByendBy1chainrchainlchainr1chainl1manyTill readP_to_S readS_to_PLexeme'NumberSymbol'Punc'Ident'LexemeEOFRatSymbolIdentPuncnumberToIntegernumberToRangedRationallexlex'hsLexlexCharreadIntPreadOctPreadDecPreadHexPPrecReadPrecminPrecliftstepresetprec readPrec_to_P readP_to_Prec readPrec_to_S readS_to_PrecreadListreadPrec readListPrec readParenreadListDefaultreadListPrecDefault lexLitChar readLitChar lexDigitslexPparensW#uncheckedShiftL64#uncheckedShiftRL64#uncheckedIShiftL64#uncheckedIShiftRA64# FingerprintfingerprintStringfingerprintFingerprintsIOMode ReadWriteMode AppendMode WriteModeReadModereadIntreadOctreadDecreadHex readFloat readSignedshowInt showEFloat showFFloat showGFloat showIntAtBaseshowHexshowOctcastPtrplusPtralignPtrminusPtr nullFunPtr castFunPtrcastFunPtrToPtrcastPtrToFunPtr freeStablePtrdeRefStablePtrcastStablePtrToPtrcastPtrToStablePtrSeekMode SeekFromEnd RelativeSeek AbsoluteSeek IODeviceType RawDevice RegularFileStream DirectoryIODevicereadyclose isTerminal isSeekableseektellgetSizesetSizesetEchogetEchosetRawdevTypedupdup2RawIOreadreadNonBlockingwritewriteNonBlocking alignment peekElemOff pokeElemOff peekByteOff pokeByteOffpeekpokeCUIntMaxCIntMaxCUIntPtrCIntPtrCJmpBufCFposCFile CSUSeconds CUSecondsCTimeCClock CSigAtomicCWcharCSizeCPtrdiffCDoubleCFloatCULLongCLLongCULongCLongCUIntCIntCUShortCShortCUCharCSCharCChar isAsciiLower isAsciiUppertoLowertoUppertoTitleGeneralCategory NotAssigned PrivateUse SurrogateFormatControlParagraphSeparator LineSeparatorSpace OtherSymbolModifierSymbolCurrencySymbol MathSymbolOtherPunctuation FinalQuote InitialQuoteClosePunctuationOpenPunctuationDashPunctuationConnectorPunctuation OtherNumber LetterNumber DecimalNumber EnclosingMarkSpacingCombiningMarkNonSpacingMark OtherLetterModifierLetterTitlecaseLetterLowercaseLetterUppercaseLetter digitToIntgeneralCategoryisMarkisNumber isPunctuationisSymbol isSeparator dropWhileEnd stripPrefix elemIndex elemIndicesfind findIndex findIndices isPrefixOf isSuffixOf isInfixOfnubnubBydeletedeleteBy\\unionunionBy intersect intersectBy intersperse intercalate transpose partition mapAccumL mapAccumRinsertinsertBymaximumminimum maximumBy minimumByzip4zip5zip6zip7zipWith4zipWith5zipWith6zipWith7unzip4unzip5unzip6unzip7deleteFirstsBygroupgroupByinitstails subsequences permutationssortunfoldrfoldl'foldl1foldl1'sumproductlinesunlineswordsunwordstypeOf7typeOf6typeOf5typeOf4typeOf3typeOf2typeOf1 tyConHash tyConPackage tyConModule tyConNamemkFunTy splitTyConApp funResultTymkAppTymkTyCon3 typeRepTyCon typeRepArgs tyConString typeOfDefaulttypeOf1DefaulttypeOf2DefaulttypeOf3DefaulttypeOf4DefaulttypeOf5DefaulttypeOf6Default showsTypeReplistTcfunTc TypeRepKey typeRepKeygcastgcast1gcast2eitherleftsrightspartitionEithersreadsFinalizerEnvPtr FinalizerPtrmallocForeignPtrmallocForeignPtrBytesaddForeignPtrFinalizerEnvnewForeignPtr_touchForeignPtrunsafeForeignPtrToPtrcastForeignPtrfinalizeForeignPtr newForeignPtrDynamictoDynfromDyn fromDynamicdynApplydynApp dynTypeRepIntPtrWordPtr ptrToWordPtr wordPtrToPtr ptrToIntPtr intPtrToPtrWeakmkWeak deRefWeakfinalize modifyIORefatomicModifyIORefLastgetLastFirstgetFirstProduct getProductSumgetSumAnygetAnyAllgetAllEndoappEndoDualgetDualMonoidmemptymappendmconcat<> HashTablehashInt hashStringprimenewHintupdatefromListtoList longestChain comparingnewForeignPtrEnvmallocForeignPtrArraymallocForeignPtrArray0 BufferState WriteBuffer ReadBuffer CharBufferBufferbufRawbufStatebufSizebufLbufR RawCharBuffer CharBufElem RawBuffer readWord8Buf writeWord8Buf peekCharBuf readCharBuf writeCharBufreadCharBufPtrwriteCharBufPtrcharSize withBuffer withRawBuffer isEmptyBuffer isFullBufferisFullCharBuffer isWriteBuffer bufferElemsbufferAvailable bufferRemove bufferAdjustL bufferAdd emptyBuffer newByteBuffer newCharBuffer newBuffer slideContents summaryBuffer checkBufferCodingProgressInvalidSequenceOutputUnderflowInputUnderflow TextEncodingtextEncodingName mkTextDecoder mkTextEncoder TextEncoder TextDecoder EncodeBuffer DecodeBuffer BufferCodecencoderecovergetStatesetStategetLocaleEncodinggetForeignEncodinggetFileSystemEncoding BufferedIOfillReadBufferfillReadBuffer0emptyWriteBufferflushWriteBufferflushWriteBuffer0readBufreadBufNonBlockingwriteBufwriteBufNonBlocking NewlineModeinputNLoutputNLNewlineCRLFLF BufferModeBlockBuffering LineBuffering NoBuffering nativeNewlineuniversalNewlineModenativeNewlineModenoNewlineTranslation IOErrorTypeExitCode ExitFailure ExitSuccessArrayExceptionUndefinedElementIndexOutOfBoundsAsyncException UserInterrupt ThreadKilled HeapOverflow StackOverflowAssertionFailedDeadlockBlockedIndefinitelyOnSTMBlockedIndefinitelyOnMVarioError mallocBytes allocaBytesallocaBytesAlignedrealloc reallocBytesCodingFailureModeRoundtripFailureTransliterateCodingFailureIgnoreCodingFailureErrorOnCodingFailurecodingFailureModeSuffix isSurrogate recoverDecode recoverEncodelatin1mkLatin1latin1_checkedmkLatin1_checked latin1_decode latin1_encodelatin1_checked_encodeutf8mkUTF8utf8_bom mkUTF8_bomutf16mkUTF16 utf16_encode utf16_decodeutf16be mkUTF16beutf16le mkUTF16leutf16be_decodeutf16le_decodeutf16be_encodeutf16le_encodeutf32mkUTF32 utf32_encode utf32_decodeutf32be mkUTF32beutf32le mkUTF32leutf32be_decodeutf32le_decodeutf32be_encodeutf32le_encodethrowIfthrowIf_ throwIfNeg throwIfNeg_ throwIfNullstdoutfromBooltoBoolmaybeNew maybeWith maybePeekwithMany copyBytes moveBytes allocaArray allocaArray0 reallocArray reallocArray0 peekArray peekArray0 pokeArray pokeArray0newArray newArray0 withArray withArrayLen withArray0 withArrayLen0 copyArray moveArray lengthArray0 advancePtr peekCStringpeekCStringLen newCString newCStringLen withCStringwithCStringLencharIsRepresentable CWStringLenCWString CStringLenCStringcastCCharToCharcastCharToCCharcastCUCharToCharcastCharToCUCharcastCSCharToCharcastCharToCSChar peekCAStringpeekCAStringLen newCAStringnewCAStringLen withCAStringwithCAStringLen peekCWStringpeekCWStringLen newCWStringnewCWStringLen withCWStringwithCWStringLenErrnoeOKe2BIGeACCES eADDRINUSE eADDRNOTAVAILeADV eAFNOSUPPORTeAGAINeALREADYeBADFeBADMSGeBADRPCeBUSYeCHILDeCOMM eCONNABORTED eCONNREFUSED eCONNRESETeDEADLK eDESTADDRREQeDIRTYeDOMeDQUOTeEXISTeFAULTeFBIGeFTYPE eHOSTDOWN eHOSTUNREACHeIDRMeILSEQ eINPROGRESSeINTReINVALeIOeISCONNeISDIReLOOPeMFILEeMLINKeMSGSIZE eMULTIHOP eNAMETOOLONGeNETDOWN eNETRESET eNETUNREACHeNFILEeNOBUFSeNODATAeNODEVeNOENTeNOEXECeNOLCKeNOLINKeNOMEMeNOMSGeNONET eNOPROTOOPTeNOSPCeNOSReNOSTReNOSYSeNOTBLKeNOTCONNeNOTDIR eNOTEMPTYeNOTSOCKeNOTTYeNXIO eOPNOTSUPPePERM ePFNOSUPPORTePIPEePROCLIM ePROCUNAVAIL ePROGMISMATCH ePROGUNAVAILePROTOePROTONOSUPPORT ePROTOTYPEeRANGEeREMCHGeREMOTEeROFS eRPCMISMATCHeRREMOTE eSHUTDOWNeSOCKTNOSUPPORTeSPIPEeSRCHeSRMNTeSTALEeTIME eTIMEDOUT eTOOMANYREFSeTXTBSYeUSERS eWOULDBLOCKeXDEV isValidErrnogetErrno resetErrno throwErrno throwErrnoIf throwErrnoIf_throwErrnoIfRetrythrowErrnoIfRetryMayBlockthrowErrnoIfRetry_throwErrnoIfRetryMayBlock_throwErrnoIfMinus1throwErrnoIfMinus1_throwErrnoIfMinus1RetrythrowErrnoIfMinus1Retry_throwErrnoIfMinus1RetryMayBlock throwErrnoIfMinus1RetryMayBlock_throwErrnoIfNullthrowErrnoIfNullRetrythrowErrnoIfNullRetryMayBlockthrowErrnoPaththrowErrnoPathIfthrowErrnoPathIf_throwErrnoPathIfNullthrowErrnoPathIfMinus1throwErrnoPathIfMinus1_errnoToIOErrorPoolnewPoolfreePoolwithPool pooledMallocpooledMallocBytes pooledReallocpooledReallocBytespooledMallocArraypooledMallocArray0pooledReallocArraypooledReallocArray0 pooledNewpooledNewArraypooledNewArray0TVarSTM ThreadStatus ThreadDied ThreadBlockedThreadFinished ThreadRunning BlockReasonBlockedOnOtherBlockedOnForeignCall BlockedOnSTMBlockedOnExceptionBlockedOnBlackHole BlockedOnMVarThreadIdforkOnforkOnIOforkOnIOUnmaskedforkOnWithUnmasknumCapabilitiesgetNumCapabilitiessetNumCapabilitiesgetNumProcessors numSparks childHandler myThreadIdyield labelThreadpseqpar runSparks threadStatusthreadCapability unsafeIOToSTM atomicallyretryorElsethrowSTMcatchSTMalwaysSucceedsalwaysnewTVar newTVarIO readTVarIOreadTVar writeTVarwithMVar modifyMVar_ sharedCAFreportStackOverflow reportErrorsetUncaughtExceptionHandlergetUncaughtExceptionHandlerNestedAtomicallyNonTermination NoMethodError RecUpdError RecConError RecSelErrorPatternMatchFail catchJusthandle handleJust mapExceptiontryJust onExceptionfinallybracket_bracketOnErrornonTerminationnestedAtomicallyreadMVarswapMVar modifyMVarHandlercatchesallowInterrupt unsafeFixIO tryIOError mkIOErrorisAlreadyExistsErrorisAlreadyInUseErrorisIllegalOperation isUserErroralreadyExistsErrorTypedoesNotExistErrorTypealreadyInUseErrorType fullErrorType eofErrorTypeillegalOperationErrorTypepermissionErrorType userErrorTypeisAlreadyExistsErrorTypeisDoesNotExistErrorTypeisAlreadyInUseErrorTypeisFullErrorTypeisEOFErrorTypeisIllegalOperationErrorTypeisPermissionErrorTypeisUserErrorTypeioeGetErrorTypeioeGetErrorStringioeGetLocation ioeGetHandleioeGetFileNameioeSetErrorTypeioeSetErrorStringioeSetLocation ioeSetHandleioeSetFileName modifyIOErrorannotateIOError catchIOError HandlerFunSignal setHandler runHandlersLimitProcessGroupID FileOffset ProcessIDFileModeFileIDDeviceID EpochTime ClockTick ByteCountGroupIDUserID LinkCountFdCRLimCTcflagCSpeedCCcCUidCNlinkCGidCSsizeCPidCOffCModeCInoCDev fingerprint0fingerprintDatalocaleEncodingName iconvEncodingmkIconvEncodingsetLocaleEncodingsetFileSystemEncodingsetForeignEncodinginitLocaleEncodingchar8mkTextEncodingmkDuplexHandle hClose_helpEventevtReadevtWrite EventManagerTimeoutCallback TimeoutKey IOCallbackFdKeykeyFdshutdown registerFd_ registerFd unregisterFd_ unregisterFdcloseFdregisterTimeoutunregisterTimeout updateTimeoutgetSystemEventManagerensureIOManagerIsRunningthreadWaitReadthreadWaitWrite closeFdWith threadDelay registerDelayhGetCharhGetLinehPutCharhPutStr hPutStrLnhPutBufNonBlocking hGetBufSomehGetBufNonBlockingHandlePosition HandlePosnhClose hFileSize hSetFileSizehIsEOF hSetBuffering hSetEncoding hGetEncoding hFlushAllhGetPosnhSetPosnhSeekhTellhIsOpen hIsClosed hIsReadable hIsWritable hGetBuffering hIsSeekablehSetEchohGetEchohIsTerminalDevicehSetBinaryModehSetNewlineMode hDuplicate hDuplicateTohShowstdinstderrisEOFopenFileBlockingopenBinaryFile fdToHandle' fdToHandleputCharputStrputStrLngetChargetLine getContentsinteractreadFile writeFile appendFilereadLnreadIOlocaleEncodinghReadyhPrintwithFilewithBinaryFile openTempFileopenBinaryTempFile"openTempFileWithDefaultPermissions(openBinaryTempFileWithDefaultPermissions ExitException DynExceptionBlockedIndefinitelyBlockedOnDeadMVarthrowDyn throwDynTocatchDynioErrorsarithExceptions errorCalls assertions dynExceptionsasyncExceptions userErrors$!FixityInfixPrefixConIndex ConstrRep CharConstr FloatConstr IntConstr AlgConstrDataRepNoRepCharRepFloatRepIntRepAlgRepConstrDataTypegfoldlgunfoldtoConstr dataTypeOf dataCast1 dataCast2gmapTgmapQlgmapQrgmapQgmapQigmapMgmapMpgmapMo fromConstr fromConstrB fromConstrM dataTypeName dataTypeRep constrType constrRep repConstr mkDataTypemkConstrdataTypeConstrs constrFields constrFixity showConstr readConstr isAlgType indexConstr constrIndexmaxConstrIndex mkIntType mkFloatType mkStringType mkCharType mkIntConstrmkIntegralConstr mkFloatConstr mkRealConstrmkStringConstr mkCharConstr mkNorepType mkNoRepType isNorepType tyconUQname tyconModuleMonadZipmzipWithmunzip TargetWord TargetIntmAX_TUPLE_SIZEmAX_CONTEXT_REDUCTION_DEPTHmAX_SPEC_THUNK_SIZEmAX_SPEC_FUN_SIZEmAX_SPEC_CONSTR_SIZEmAX_SPEC_SELECTEE_SIZEmAX_SPEC_AP_SIZEmIN_PAYLOAD_SIZE mIN_INTLIKE mAX_INTLIKE mIN_CHARLIKE mAX_CHARLIKEmUT_ARR_PTRS_CARD_BITSmAX_Vanilla_REG mAX_Float_REGmAX_Double_REG mAX_Long_REGmAX_Real_Vanilla_REGmAX_Real_Float_REGmAX_Real_Double_REGmAX_Real_Long_REG sTD_HDR_SIZE pROF_HDR_SIZE dOUBLE_SIZE wORD64_SIZE iNT64_SIZErESERVED_C_STACK_BYTESrESERVED_STACK_WORDSaP_STACK_SPLIM wORD_SIZEwORD_SIZE_IN_BITStARGET_MIN_INTtARGET_MAX_INTtARGET_MAX_WORDtARGET_MAX_CHARtAG_BITStAG_MASK mAX_PTR_TAG cINT_SIZE bLOCK_SIZE bLOCK_SIZE_WbLOCKS_PER_MBLOCKbITMAP_BITS_SHIFToFFSET_StgRegTable_rR1oFFSET_StgRegTable_rR2oFFSET_StgRegTable_rR3oFFSET_StgRegTable_rR4oFFSET_StgRegTable_rR5oFFSET_StgRegTable_rR6oFFSET_StgRegTable_rR7oFFSET_StgRegTable_rR8oFFSET_StgRegTable_rR9oFFSET_StgRegTable_rR10oFFSET_StgRegTable_rF1oFFSET_StgRegTable_rF2oFFSET_StgRegTable_rF3oFFSET_StgRegTable_rF4oFFSET_StgRegTable_rD1oFFSET_StgRegTable_rD2oFFSET_StgRegTable_rL1oFFSET_StgRegTable_rSpoFFSET_StgRegTable_rSpLimoFFSET_StgRegTable_rHpoFFSET_StgRegTable_rHpLimoFFSET_StgRegTable_rCCCSoFFSET_StgRegTable_rCurrentTSO"oFFSET_StgRegTable_rCurrentNurseryoFFSET_StgRegTable_rHpAllocoFFSET_StgRegTable_rRetoFFSET_StgRegTable_rNurseryoFFSET_stgEagerBlackholeInfooFFSET_stgGCEnter1oFFSET_stgGCFunoFFSET_Capability_roFFSET_Capability_lockoFFSET_Capability_nooFFSET_Capability_mut_lists oFFSET_Capability_context_switchoFFSET_Capability_interruptoFFSET_Capability_sparksoFFSET_bdescr_startoFFSET_bdescr_freeoFFSET_bdescr_blocksoFFSET_bdescr_gen_nooFFSET_bdescr_linksIZEOF_generation#oFFSET_generation_n_new_large_wordssIZEOF_CostCentreStackoFFSET_CostCentreStack_ccsID oFFSET_CostCentreStack_mem_alloc oFFSET_CostCentreStack_scc_count oFFSET_CostCentreStack_prevStackoFFSET_CostCentre_ccIDoFFSET_CostCentre_linkoFFSET_StgHeader_infooFFSET_StgHeader_ccsoFFSET_StgHeader_ldvwsIZEOF_StgSMPThunkHeaderoFFSET_StgClosure_payloadoFFSET_StgEntCounter_allocs oFFSET_StgEntCounter_registeredpoFFSET_StgEntCounter_link oFFSET_StgEntCounter_entry_countsIZEOF_StgUpdateFrame_NoHdrsIZEOF_StgCatchFrame_NoHdrsIZEOF_StgStopFrame_NoHdrsIZEOF_StgMutArrPtrs_NoHdroFFSET_StgMutArrPtrs_ptrsoFFSET_StgMutArrPtrs_sizesIZEOF_StgArrWords_NoHdroFFSET_StgArrWords_bytesoFFSET_StgArrWords_payloadoFFSET_StgTSO__linkoFFSET_StgTSO_global_linkoFFSET_StgTSO_what_nextoFFSET_StgTSO_why_blockedoFFSET_StgTSO_block_info oFFSET_StgTSO_blocked_exceptionsoFFSET_StgTSO_idoFFSET_StgTSO_capoFFSET_StgTSO_saved_errnooFFSET_StgTSO_trecoFFSET_StgTSO_flagsoFFSET_StgTSO_dirtyoFFSET_StgTSO_bqoFFSET_StgTSO_cccsoFFSET_StgTSO_stackobjoFFSET_StgStack_spoFFSET_StgStack_stackoFFSET_StgStack_stack_sizeoFFSET_StgStack_dirtysIZEOF_StgTSOProfInfooFFSET_StgUpdateFrame_updateeoFFSET_StgCatchFrame_handler'oFFSET_StgCatchFrame_exceptions_blockedsIZEOF_StgPAP_NoHdroFFSET_StgPAP_n_argsoFFSET_StgPAP_funoFFSET_StgPAP_arityoFFSET_StgPAP_payloadsIZEOF_StgAP_NoThunkHdrsIZEOF_StgAP_NoHdroFFSET_StgAP_n_argsoFFSET_StgAP_funoFFSET_StgAP_payloadsIZEOF_StgAP_STACK_NoThunkHdrsIZEOF_StgAP_STACK_NoHdroFFSET_StgAP_STACK_sizeoFFSET_StgAP_STACK_funoFFSET_StgAP_STACK_payloadsIZEOF_StgSelector_NoThunkHdrsIZEOF_StgSelector_NoHdroFFSET_StgInd_indirecteesIZEOF_StgMutVar_NoHdroFFSET_StgMutVar_varsIZEOF_StgAtomicallyFrame_NoHdroFFSET_StgAtomicallyFrame_code1oFFSET_StgAtomicallyFrame_next_invariant_to_check oFFSET_StgAtomicallyFrame_result'oFFSET_StgInvariantCheckQueue_invariant*oFFSET_StgInvariantCheckQueue_my_execution.oFFSET_StgInvariantCheckQueue_next_queue_entryoFFSET_StgAtomicInvariant_code#oFFSET_StgTRecHeader_enclosing_trecsIZEOF_StgCatchSTMFrame_NoHdroFFSET_StgCatchSTMFrame_handleroFFSET_StgCatchSTMFrame_codesIZEOF_StgCatchRetryFrame_NoHdr*oFFSET_StgCatchRetryFrame_running_alt_code$oFFSET_StgCatchRetryFrame_first_code"oFFSET_StgCatchRetryFrame_alt_code oFFSET_StgTVarWatchQueue_closure)oFFSET_StgTVarWatchQueue_next_queue_entry)oFFSET_StgTVarWatchQueue_prev_queue_entryoFFSET_StgTVar_current_valuesIZEOF_StgWeak_NoHdroFFSET_StgWeak_linkoFFSET_StgWeak_keyoFFSET_StgWeak_valueoFFSET_StgWeak_finalizeroFFSET_StgWeak_cfinalizersIZEOF_StgDeadWeak_NoHdroFFSET_StgDeadWeak_linksIZEOF_StgMVar_NoHdroFFSET_StgMVar_headoFFSET_StgMVar_tailoFFSET_StgMVar_valuesIZEOF_StgMVarTSOQueue_NoHdroFFSET_StgMVarTSOQueue_linkoFFSET_StgMVarTSOQueue_tsosIZEOF_StgBCO_NoHdroFFSET_StgBCO_instrsoFFSET_StgBCO_literalsoFFSET_StgBCO_ptrsoFFSET_StgBCO_arityoFFSET_StgBCO_sizeoFFSET_StgBCO_bitmapsIZEOF_StgStableName_NoHdroFFSET_StgStableName_snsIZEOF_StgBlockingQueue_NoHdroFFSET_StgBlockingQueue_bhoFFSET_StgBlockingQueue_owneroFFSET_StgBlockingQueue_queueoFFSET_StgBlockingQueue_linksIZEOF_MessageBlackHole_NoHdroFFSET_MessageBlackHole_linkoFFSET_MessageBlackHole_tsooFFSET_MessageBlackHole_bh,oFFSET_RtsFlags_ProfFlags_showCCSOnException oFFSET_RtsFlags_DebugFlags_apply!oFFSET_RtsFlags_DebugFlags_sanityoFFSET_RtsFlags_DebugFlags_weak&oFFSET_RtsFlags_GcFlags_initialStkSize&oFFSET_RtsFlags_MiscFlags_tickIntervalsIZEOF_StgFunInfoExtraFwd$oFFSET_StgFunInfoExtraFwd_slow_apply"oFFSET_StgFunInfoExtraFwd_fun_typeoFFSET_StgFunInfoExtraFwd_arity oFFSET_StgFunInfoExtraFwd_bitmapsIZEOF_StgFunInfoExtraRev+oFFSET_StgFunInfoExtraRev_slow_apply_offset"oFFSET_StgFunInfoExtraRev_fun_typeoFFSET_StgFunInfoExtraRev_arity oFFSET_StgFunInfoExtraRev_bitmapoFFSET_StgLargeBitmap_sizeoFFSET_StgLargeBitmap_bitmapsIZEOF_snEntryoFFSET_snEntry_sn_objoFFSET_snEntry_addrCategory<<< getFullArgs CostCentreCostCentreStack getCurrentCCSgetCCSOfccsCC ccsParentccLabelccModule ccSrcSpancurrentCallStack ccsToStrings whoCreated renderStacktraceIO putTraceMsgtrace traceShow traceEvent traceEventIO traceStackSpecConstrAnnotationForceSpecConstr NoSpecConstrDown maxTupleSizethesortWithGCStatsbytesAllocatednumGcs maxBytesUsednumByteUsageSamplescumulativeBytesUsed bytesCopiedcurrentBytesUsedcurrentBytesSlop maxBytesSloppeakMegabytesAllocatedmutatorCpuSecondsmutatorWallSeconds gcCpuSeconds gcWallSeconds cpuSeconds wallSecondsparAvgBytesCopiedparMaxBytesCopied getGCStatsUnique newUnique hashUnique<$>ChannewChan writeChanreadChandupChan unGetChan isEmptyChangetChanContentswriteList2ChanQSemnewQSemwaitQSem signalQSemQSemNnewQSemN waitQSemN signalQSemN SampleVarnewEmptySampleVar newSampleVaremptySampleVar readSampleVarwriteSampleVarisEmptySampleVarrtsSupportsBoundThreadsmergeIOnmergeIOisCurrentThreadBoundrunInBoundThreadrunInUnboundThreadtimeoutfixon ArrowLoop ArrowMonad ArrowApply ArrowChoiceleftright ArrowPlus<+> ArrowZero zeroArrowKleisli runKleisliArrowsecond***&&&returnA^>>>>^<<^^<<leftAppAnnotationWrapperstrictToLazySTlazyToStrictSTZipList getZipList WrappedArrow WrapArrow unwrapArrow WrappedMonad WrapMonad unwrapMonadConstgetConst Alternativeempty<|>somepure<*>*><*<**>liftAliftA2liftA3foldfoldr'foldrMfoldlM traverse_for_ sequenceA_asumtraverse sequenceAfor fmapDefaultfoldMapDefaultComplex:+realPartimagPart conjugatemkPolarcispolar magnitudephasePicoE12NanoE9MicroE6MilliE3CentiE2DeciE1UniE0 HasResolution resolutionFixeddiv'divMod'mod' showFixedapproxRational modifySTRefVersion versionBranch versionTags showVersion parseVersionArgDescrOptArgReqArgNoArgOptDescrOptionArgOrder ReturnInOrderPermute RequireOrder usageInfogetOptgetOpt' getCPUTimecpuTimePrecision getProgNamegetEnvwithArgs withProgNamegetEnvironment exitSuccesscompilerVersionosarch compilerName StableNamemakeStableNamehashStableName mkWeakPtr addFinalizer mkWeakPairIsChar PrintfArg HPrintfType PrintfTypeprintfhPrintfeqStringbindIOreturnIOthenIOOpaqueOmapFB unsafeChrzeroIntoneInttwoIntminIntmaxIntunIOgetTagdivInt#modInt#plusIntminusInttimesIntquotIntremIntdivIntmodInt negateInt $fMonadIO $fFunctorIO $fMonad[] $fFunctor[] realWorld# GHC.CStringunpackCStringUtf8#unpackFoldrCString#unpackCString# unsafeCoerce# nullAddr#Addr#Array# ByteArray#Char#Double#Float#(->)Int#Int32#Int64#Weak# MutableArray#MutableByteArray#MVar# StablePtr# ArrayArray#MutableArrayArray#State# StableName#~#MutVar#Word#Word32#Word64# ThreadId#BCO#TVar#AnyKOpenKind#(#)ArgKindgtChar#geChar#eqChar#neChar#ltChar#leChar#ord#+#-#*#mulIntMayOflo#quotInt#remInt# negateInt#addIntC#subIntC#>#>=#==#/=#<#<=#chr# int2Word# int2Float# int2Double#uncheckedIShiftL#uncheckedIShiftRA#uncheckedIShiftRL# plusWord# minusWord# timesWord# quotWord#remWord#and#or#xor#not#uncheckedShiftL#uncheckedShiftRL# word2Int#gtWord#geWord#eqWord#neWord#ltWord#leWord#popCnt8# popCnt16# popCnt32# popCnt64#popCnt# narrow8Int# narrow16Int# narrow32Int# narrow8Word# narrow16Word# narrow32Word#>##>=##==##/=##<##<=##+##-##*##/## negateDouble# double2Int# double2Float# expDouble# logDouble# sqrtDouble# sinDouble# cosDouble# tanDouble# asinDouble# acosDouble# atanDouble# sinhDouble# coshDouble# tanhDouble#**##decodeDouble_2Int#gtFloat#geFloat#eqFloat#neFloat#ltFloat#leFloat# plusFloat# minusFloat# timesFloat# divideFloat# negateFloat# float2Int# expFloat# logFloat# sqrtFloat# sinFloat# cosFloat# tanFloat# asinFloat# acosFloat# atanFloat# sinhFloat# coshFloat# tanhFloat# powerFloat# float2Double#decodeFloat_Int# newArray#sameMutableArray# readArray# writeArray# sizeofArray#sizeofMutableArray# indexArray#unsafeFreezeArray#unsafeThawArray# copyArray#copyMutableArray# cloneArray#cloneMutableArray# freezeArray# thawArray# newByteArray#newPinnedByteArray#newAlignedPinnedByteArray#byteArrayContents#sameMutableByteArray#unsafeFreezeByteArray#sizeofByteArray#sizeofMutableByteArray#indexCharArray#indexWideCharArray#indexIntArray#indexWordArray#indexAddrArray#indexFloatArray#indexDoubleArray#indexStablePtrArray#indexInt8Array#indexInt16Array#indexInt32Array#indexInt64Array#indexWord8Array#indexWord16Array#indexWord32Array#indexWord64Array#readCharArray#readWideCharArray# readIntArray#readWordArray#readAddrArray#readFloatArray#readDoubleArray#readStablePtrArray#readInt8Array#readInt16Array#readInt32Array#readInt64Array#readWord8Array#readWord16Array#readWord32Array#readWord64Array#writeCharArray#writeWideCharArray#writeIntArray#writeWordArray#writeAddrArray#writeFloatArray#writeDoubleArray#writeStablePtrArray#writeInt8Array#writeInt16Array#writeInt32Array#writeInt64Array#writeWord8Array#writeWord16Array#writeWord32Array#writeWord64Array#copyByteArray#copyMutableByteArray#newArrayArray#sameMutableArrayArray#unsafeFreezeArrayArray#sizeofArrayArray#sizeofMutableArrayArray#indexByteArrayArray#indexArrayArrayArray#readByteArrayArray#readMutableByteArrayArray#readArrayArrayArray#readMutableArrayArrayArray#writeByteArrayArray#writeMutableByteArrayArray#writeArrayArrayArray#writeMutableArrayArrayArray#copyArrayArray#copyMutableArrayArray# plusAddr# minusAddr#remAddr# addr2Int# int2Addr#gtAddr#geAddr#eqAddr#neAddr#ltAddr#leAddr#indexCharOffAddr#indexWideCharOffAddr#indexIntOffAddr#indexWordOffAddr#indexAddrOffAddr#indexFloatOffAddr#indexDoubleOffAddr#indexStablePtrOffAddr#indexInt8OffAddr#indexInt16OffAddr#indexInt32OffAddr#indexInt64OffAddr#indexWord8OffAddr#indexWord16OffAddr#indexWord32OffAddr#indexWord64OffAddr#readCharOffAddr#readWideCharOffAddr#readIntOffAddr#readWordOffAddr#readAddrOffAddr#readFloatOffAddr#readDoubleOffAddr#readStablePtrOffAddr#readInt8OffAddr#readInt16OffAddr#readInt32OffAddr#readInt64OffAddr#readWord8OffAddr#readWord16OffAddr#readWord32OffAddr#readWord64OffAddr#writeCharOffAddr#writeWideCharOffAddr#writeIntOffAddr#writeWordOffAddr#writeAddrOffAddr#writeFloatOffAddr#writeDoubleOffAddr#writeStablePtrOffAddr#writeInt8OffAddr#writeInt16OffAddr#writeInt32OffAddr#writeInt64OffAddr#writeWord8OffAddr#writeWord16OffAddr#writeWord32OffAddr#writeWord64OffAddr# newMutVar# readMutVar# writeMutVar# sameMutVar#atomicModifyMutVar# casMutVar#catch#raise#raiseIO#maskAsyncExceptions#maskUninterruptible#unmaskAsyncExceptions#getMaskingState# atomically#retry# catchRetry# catchSTM#check#newTVar# readTVar# readTVarIO# writeTVar# sameTVar#newMVar# takeMVar# tryTakeMVar#putMVar# tryPutMVar# sameMVar# isEmptyMVar#delay# waitRead# waitWrite#fork#forkOn# killThread#yield# myThreadId# labelThread#isCurrentThreadBound# noDuplicate# threadStatus#mkWeak#mkWeakForeignEnv# deRefWeak# finalizeWeak#touch#makeStablePtr#deRefStablePtr# eqStablePtr#makeStableName# eqStableName#stableNameToInt#reallyUnsafePtrEquality#par#spark#seq# getSpark# numSparks# parGlobal# parLocal#parAt# parAtAbs# parAtRel# parAtForNow# dataToTag# tagToEnum# addrToAny# mkApUpd0#newBCO#unpackClosure#getApStackVal# getCCSOf#getCurrentCCS# traceEvent# compareInt# compareIntleIntltIntgeIntgtIntneInteqInt unpackNBytes#unpackAppendCString# quotRemInt divModInt $fNumInteger$fNumInt mkInteger smallInteger integerToWord integerToInt plusInteger timesInteger minusInteger negateInteger eqInteger neqInteger absInteger signumInteger leInteger gtInteger ltInteger geIntegercompareIntegerquotRemInteger divModInteger quotInteger remIntegerfloatFromIntegerdoubleFromIntegerencodeFloatIntegerencodeDoubleInteger andInteger orInteger xorIntegercomplementInteger shiftLInteger shiftRIntegerdecodeDoubleInteger wordToInteger hashInteger $fMonadMaybe$fFunctorMaybebadHeadfilterFB iterateFBrepeatFB takeFoldr takeConsttakeFBtakeUInttake_unsafe_UInttakeUInt_appendtake_unsafe_UInt_appendfoldr2 foldr2_left foldr2_rightzipFB zipWithFBerrorEmptyList prel_list_str showLitStringshowMultiLineString showSignedInt showList__appPrecappPrec1 show_tuple showSpaceisDec protectEscasciiTabtenitosintegerToString $fShowInteger$fShow(,,,,,,,,,,,,,,)$fShow(,,,,,,,,,,,,,)$fShow(,,,,,,,,,,,,)$fShow(,,,,,,,,,,,)$fShow(,,,,,,,,,,)$fShow(,,,,,,,,,)$fShow(,,,,,,,,)$fShow(,,,,,,,)$fShow(,,,,,,) $fShow(,,,,,) $fShow(,,,,) $fShow(,,,) $fShow(,,) $fShow(,) $fShowMaybe $fShowInt $fShowChar$fShowOrdering $fShowBool$fShow[]$fShow()boundedEnumFromboundedEnumFromThen toEnumError fromEnumError succError predError eftCharFBeftChar efdCharFBefdChar efdtCharFBefdtChar go_up_char_fb go_dn_char_fbgo_up_char_listgo_dn_char_listeftInteftIntFBefdIntefdtInt efdtIntFB efdtIntUp efdtIntUpFB efdtIntDn efdtIntDnFBenumDeltaIntegerFBenumDeltaIntegerenumDeltaToIntegerFBenumDeltaToIntegerup_fbdn_fbup_listdn_list $fEnumInteger $fEnumInt $fBoundedInt $fEnumChar $fBoundedChar$fEnumOrdering$fBoundedOrdering $fEnumBool $fBoundedBool$fBounded(,,,,,,,,,,,,,,)$fBounded(,,,,,,,,,,,,,)$fBounded(,,,,,,,,,,,,)$fBounded(,,,,,,,,,,,)$fBounded(,,,,,,,,,,)$fBounded(,,,,,,,,,)$fBounded(,,,,,,,,)$fBounded(,,,,,,,)$fBounded(,,,,,,)$fBounded(,,,,,)$fBounded(,,,,)$fBounded(,,,) $fBounded(,,) $fBounded(,)$fEnum() $fBounded()$fMonadPlusMaybe $fMonadPlus[]runSTRepSTretSTRepliftST$fShowST $fMonadST $fFunctorSTSTArrayArray unsafeIndexunsafeRangeSizearraybounds listArray! numElementsindiceselemsassocs accumArray//accumixmap indexErrorhopelessIndexError arrEleBottom unsafeArray unsafeArray'filldone safeRangeSizenegRange safeIndex lessSafeIndex badSafeIndexunsafeAtunsafeAccumArrayunsafeAccumArray'adjust unsafeReplace unsafeAccumamapeqArraycmpArray cmpIntArray newSTArray boundsSTArraynumElementsSTArray readSTArrayunsafeReadSTArray writeSTArrayunsafeWriteSTArray freezeSTArrayunsafeFreezeSTArray thawSTArrayunsafeThawSTArray $fShowArray $fOrdArray $fEqArray$fFunctorArray $fEqSTArray $fIx(,,,,) $fIx(,,,)$fIx(,,)$fIx(,)$fIx() $fIxOrdering$fIxBool $fIxInteger$fIxInt$fIxChar$fShowArithException$fExceptionArithException$fShowErrorCall$fExceptionErrorCall$fExceptionSomeException$fShowSomeException absentErr divZeroError overflowError:% ratioPrec ratioPrec1infinity notANumberreducenumericEnumFromnumericEnumFromThennumericEnumFromTonumericEnumFromThenTo^%^^^%^^gcdIntintegralEnumFromintegralEnumFromThenintegralEnumFromTointegralEnumFromThenTo $fEnumRatio $fShowRatio$fRealFracRatio $fRealRatio$fFractionalRatio $fNumRatio $fOrdRatio$fIntegralInteger $fRealInteger $fIntegralInt $fRealInt noDuplicatefailIOliftIOioToSTunsafeDupableInterleaveIOcatchExceptioncatchAny unsafeUnmaskblockUninterruptibleIOArray newIOArrayunsafeReadIOArrayunsafeWriteIOArray readIOArray writeIOArray boundsIOArray $fEqIOArray$fEqMVar $fBitsInteger $fBitsInt c_rintFloat c_rintDoubleproperFractionFloatInt floorFloatIntceilingFloatInt roundFloatIntproperFractionFloatIntegertruncateFloatIntegerfloorFloatIntegerceilingFloatIntegerroundFloatIntegerproperFractionDoubleIntfloorDoubleIntceilingDoubleIntroundDoubleIntproperFractionDoubleIntegertruncateDoubleIntegerfloorDoubleIntegerceilingDoubleIntegerroundDoubleInteger double2Int int2Double float2Int int2Floatdouble2Integer float2IntegerBAelim64#elimZerosInteger elimZerosInt# zeroCounttoByte# zeroCountArrFFFormat FFGenericFFFixed FFExponentisDoubleFiniteisDoubleNegativeZeroisDoubleDenormalizedisDoubleInfinite isDoubleNaN isFloatFiniteisFloatNegativeZeroisFloatDenormalizedisFloatInfinite isFloatNaNformatRealFloatroundTofromRat'minExptmaxExptexptexpts maxExpt10expts10integerLogBase fromRat'' plusFloat minusFloat timesFloat divideFloat negateFloatgtFloatgeFloateqFloatneFloatltFloatleFloatexpFloatlogFloat sqrtFloatsinFloatcosFloattanFloat asinFloat acosFloat atanFloat sinhFloat coshFloat tanhFloat powerFloat plusDouble minusDouble timesDouble divideDouble negateDoublegtDoublegeDoubleeqDoubleneDoubleltDoubleleDouble double2Float float2Double expDouble logDouble sqrtDouble sinDouble cosDouble tanDouble asinDouble acosDouble atanDouble sinhDouble coshDouble tanhDouble powerDoubleshowSignedFloatclamp $fEnumDouble $fEnumFloat $fShowDouble$fRealFloatDouble$fRealFracDouble$fFloatingDouble$fFractionalDouble $fRealDouble $fNumDouble $fShowFloat$fRealFloatFloat$fFloatingFloat$fRealFracFloat$fFractionalFloat $fRealFloat $fNumFloat $fEqSTRef $fEqIORefRPFinalResultFailLookGetfinalrun$fMonadPlusReadP $fMonadReadP$fFunctorReadP $fMonadPlusP$fMonadPDigitsBase MkDecimalMkNumbernumberToRationallexToken lexToken'lexEOFlexPunc lexSymbol lexSymbol'lexIdlexId'lexCharE lexString lexNumber lexNumber' lexHexOct lexHexOct' lexBaseChar lexDecNumber lexDecNumber'lexFraclexExp lexIntegervalfracExpvalDig valDecDig readIntP'$fMonadPlusReadPrec$fMonadReadPrec$fFunctorReadPreclexP'parenlistchoose readNumber convertInt convertFracwrap_tup read_comma read_tup2 read_tup4 read_tup8readp$fRead(,,,,,,,,,,,,,,)$fRead(,,,,,,,,,,,,,)$fRead(,,,,,,,,,,,,)$fRead(,,,,,,,,,,,)$fRead(,,,,,,,,,,)$fRead(,,,,,,,,,)$fRead(,,,,,,,,)$fRead(,,,,,,,)$fRead(,,,,,,) $fRead(,,,,,) $fRead(,,,,) $fRead(,,,) $fRead(,,) $fRead(,)$fRead() $fReadRatio $fReadDouble $fReadFloat $fReadInteger $fReadInt $fReadLexeme $fReadArray$fRead[] $fReadMaybe$fReadOrdering $fReadBool $fReadCharW64#W32#W16#W8#showWord $fReadWord64 $fIxWord64$fBoundedWord64 $fRealWord64 $fShowWord64 $fBitsWord64$fIntegralWord64 $fEnumWord64 $fNumWord64 $fReadWord32 $fIxWord32$fBoundedWord32 $fRealWord32 $fShowWord32 $fBitsWord32$fIntegralWord32 $fEnumWord32 $fNumWord32 $fBitsWord16 $fReadWord16 $fIxWord16$fBoundedWord16$fIntegralWord16 $fEnumWord16 $fRealWord16 $fNumWord16 $fShowWord16 $fBitsWord8 $fReadWord8 $fIxWord8$fBoundedWord8$fIntegralWord8 $fEnumWord8 $fRealWord8 $fNumWord8 $fShowWord8 $fBitsWord $fReadWord$fIxWord $fBoundedWord$fIntegralWord $fEnumWord $fRealWord $fNumWord $fShowWordI64#I32#I16#I8# $fIxInt64$fBoundedInt64 $fRealInt64 $fBitsInt64 $fReadInt64$fIntegralInt64 $fEnumInt64 $fNumInt64 $fShowInt64 $fIxInt32$fBoundedInt32 $fRealInt32 $fBitsInt32 $fReadInt32$fIntegralInt32 $fEnumInt32 $fNumInt32 $fShowInt32 $fBitsInt16 $fReadInt16 $fIxInt16$fBoundedInt16$fIntegralInt16 $fEnumInt16 $fRealInt16 $fNumInt16 $fShowInt16 $fBitsInt8 $fReadInt8$fIxInt8 $fBoundedInt8$fIntegralInt8 $fEnumInt8 $fRealInt8 $fNumInt8 $fShowInt8 readFloatP $fShowFunPtr $fShowPtr $fEqStablePtrMutableByteArray ByteArray unpackCString packCString# packString packStringST packNBytesST new_ps_arraywrite_ps_arrayfreeze_ps_arrayioe_unsupportedOperationreadWideCharOffPtr readIntOffPtrreadWordOffPtr readPtrOffPtrreadFunPtrOffPtrreadFloatOffPtrreadDoubleOffPtrreadStablePtrOffPtrreadInt8OffPtrreadWord8OffPtrreadInt16OffPtrreadWord16OffPtrreadInt32OffPtrreadWord32OffPtrreadInt64OffPtrreadWord64OffPtrwriteWideCharOffPtrwriteIntOffPtrwriteWordOffPtrwritePtrOffPtrwriteFunPtrOffPtrwriteFloatOffPtrwriteDoubleOffPtrwriteStablePtrOffPtrwriteInt8OffPtrwriteWord8OffPtrwriteInt16OffPtrwriteWord16OffPtrwriteInt32OffPtrwriteWord32OffPtrwriteInt64OffPtrwriteWord64OffPtrpeekFingerprintpokeFingerprint$fStorableFingerprint$fStorableInt64$fStorableInt32$fStorableInt16$fStorableInt8$fStorableWord64$fStorableWord32$fStorableWord16$fStorableWord8$fStorableDouble$fStorableFloat$fStorableStablePtr$fStorableFunPtr $fStorablePtr$fStorableWord $fStorableInt$fStorableChar$fStorableBool$fShowCUIntMax$fReadCUIntMax $fShowCIntMax $fReadCIntMax$fShowCUIntPtr$fReadCUIntPtr $fShowCIntPtr $fReadCIntPtr$fShowCSUSeconds$fReadCSUSeconds$fShowCUSeconds$fReadCUSeconds $fShowCTime $fReadCTime $fShowCClock $fReadCClock$fShowCSigAtomic$fReadCSigAtomic $fShowCWchar $fReadCWchar $fShowCSize $fReadCSize$fShowCPtrdiff$fReadCPtrdiff $fShowCDouble $fReadCDouble $fShowCFloat $fReadCFloat $fShowCULLong $fReadCULLong $fShowCLLong $fReadCLLong $fShowCULong $fReadCULong $fShowCLong $fReadCLong $fShowCUInt $fReadCUInt $fShowCInt $fReadCInt $fShowCUShort $fReadCUShort $fShowCShort $fReadCShort $fShowCUChar $fReadCUChar $fShowCSChar $fReadCSChar $fShowCChar $fReadCCharwgencattowtitletowuppertowloweriswupperiswloweriswprintiswspaceiswcntrliswalnumiswalphanonEmptySubsequenceselem_by prependToAllselect strictMaximum strictMinimumstrictGenericLength $fTypeable6s $fTypeable5s $fTypeable4s $fTypeable3s $fTypeable2s $fTypeable1s $fTypeables isTupleTyConshowArgs showTuple realWorldTc$fTypeableRealWorld$fTypeable2(->) $fShowTyCon $fShowTypeRep $fOrdTyCon $fEqTyCon $fOrdTypeRep $fEqTypeRep readEithernewConcForeignPtrmallocPlainForeignPtrmallocPlainForeignPtrBytesaddForeignPtrConcFinalizerForeignPtrContentsPlainPtr MallocPtrPlainForeignPtr FinalizersHaskellFinalizers CFinalizers NoFinalizersfinalizeForeignaddForeignPtrConcFinalizer_noMixingforeignPtrFinalizertouch$fShowForeignPtr$fOrdForeignPtr$fEqForeignPtrObj$fExceptionDynamic $fShowDynamic $fIsString[] $fShowIntPtr $fReadIntPtr $fShowWordPtr $fReadWordPtrrunFinalizerBatch $fMonoidMaybe $fMonoidLast $fMonoidFirst$fMonoidProduct $fMonoidSum $fMonoidAny $fMonoidAll $fMonoidEndo $fMonoidDual$fMonoidOrdering$fMonoid(,,,,) $fMonoid(,,,) $fMonoid(,,) $fMonoid(,) $fMonoid() $fMonoid(->) $fMonoid[]Inserts Can'tInsert CanInsertHashDataHDtables insertionslookups totBuckets maxEntriesmaxChain maxBucketsHTkcountbmaskbucketscmphash_fntabHTArrayMutArray iNSTRUMENTED newMutArray readHTArray writeMutArrayhashData instrument recordNew recordIns recordResize recordLookupgolden hashInt32mulHi tABLE_MAX tABLE_MINhLOAD hYSTERESISbitTwiddleSameAs powerOvertooBig bucketIndex findBucketupdatingBucketexpandHashTable deleteBucket mapReducememcpycheck$fShowTextEncoding HandleTypeReadWriteHandle AppendHandle WriteHandle ReadHandleSemiClosedHandle ClosedHandle BufferListBufferListCons BufferListNilHandle__haDevicehaType haByteBuffer haBufferMode haLastDecode haCharBuffer haBuffers haEncoder haDecoderhaCodec haInputNL haOutputNL haOtherSide DuplexHandle FileHandleisReadableHandleTypeisWritableHandleTypeisReadWriteHandleTypecheckHandleInvariants showHandle $fShowHandle$fShowHandleType $fEqHandle assertErrorunsupportedOperation InterruptedResourceVanished TimeExpiredUnsupportedOperation HardwareFaultInappropriateTypeInvalidArgument OtherError ProtocolError SystemErrorUnsatisfiedConstraints UserErrorPermissionDeniedIllegalOperationResourceExhausted ResourceBusy NoSuchThing AlreadyExists ioe_handleioe_type ioe_locationioe_description ioe_errno ioe_filenameblockedIndefinitelyOnMVarblockedIndefinitelyOnSTM stackOverflow heapOverflow ioExceptionuntangle$fShowIOException$fShowIOErrorType$fEqIOErrorType$fEqIOException$fExceptionIOException$fExceptionExitCode$fShowArrayException$fShowAsyncException$fExceptionArrayException$fExceptionAsyncException$fShowAssertionFailed$fExceptionAssertionFailed$fShowDeadlock$fExceptionDeadlock$fShowBlockedIndefinitelyOnSTM#$fExceptionBlockedIndefinitelyOnSTM$fShowBlockedIndefinitelyOnMVar$$fExceptionBlockedIndefinitelyOnMVar_free_realloc_malloc failWhenNULLunrepresentableChar#escapeToRoundtripCharacterSurrogate#unescapeRoundtripCharacterSurrogateioe_decodingErrorioe_encodingError latin1_DF latin1_EFlatin1_checked_EFutf8_DFutf8_EF utf8_bom_DF utf8_bom_EFutf8_bom_decodeutf8_bom_encodebom0bom1bom2 utf8_decode utf8_encodeord2ord3ord4chr2chr3chr4 validate3 validate4utf16_DFutf16_EFbomBbomLutf16_native_decodeutf16_native_encode utf16be_DF utf16be_EF utf16le_DF utf16le_EF validate1 validate2utf32_DFutf32_EFbom3utf32_native_decodeutf32_native_encode utf32be_DF utf32be_EF utf32le_DF utf32le_EFvalidatememmove c_DEBUG_DUMP putDebugMsgnUL cCharSizepeekEncodedCStringwithEncodedCStringnewEncodedCStringtryFillBufferAndCall newArrayLenwNULcWcharsToCharscharsToCWcharscastCWcharToCharcastCharToCWcharstrerror set_errno get_errno $fEqErrnocheckInv errorBelchcallStackOverflowHookn_capabilitiesc_getNumberOfProcessorsc_setNumCapabilities cmp_thread getThreadIdid2TSO cmpThread real_handlerunSTMbindSTMthenSTM returnSTMuncaughtExceptionHandler$fEqTVar$fMonadPlusSTM $fMonadSTM $fFunctorSTM $fOrdThreadId $fEqThreadId$fShowThreadId$fExceptionNestedAtomically$fShowNestedAtomically$fExceptionNonTermination$fShowNonTermination$fExceptionNoMethodError$fShowNoMethodError$fExceptionRecUpdError$fShowRecUpdError$fExceptionRecConError$fShowRecConError$fExceptionRecSelError$fShowRecSelError$fExceptionPatternMatchFail$fShowPatternMatchFailcatchesHandler'getOrSetGHCConcSignalSignalHandlerStoremaxSigsignal_handlers$fShowFd$fReadFd $fShowCRLim $fReadCRLim $fShowCTcflag $fReadCTcflag $fShowCSpeed $fReadCSpeed $fShowCCc $fReadCCc $fShowCUid $fReadCUid $fShowCNlink $fReadCNlink $fShowCGid $fReadCGid $fShowCSsize $fReadCSsize $fShowCPid $fReadCPid $fShowCOff $fReadCOff $fShowCMode $fReadCMode $fShowCIno $fReadCIno $fShowCDev $fReadCDev MD5Context c_MD5Final c_MD5Update c_MD5Initputs CFilePathFDCUtsnameCUtimbufCTmsCTmCTermiosCStatCSigset CSigactionCPasswdCLconvCGroupCFLocksEEK_ENDsEEK_SETsEEK_CURdEFAULT_BUFFER_SIZE c_s_issockptr_c_cc poke_c_lflagc_lflagsizeof_sigset_tsizeof_termiosconst_fd_cloexec const_f_setfd const_f_setfl const_f_getflconst_sig_setmaskconst_sig_block const_sigttou const_vtime const_vmin const_icanon const_tcsanow const_echost_inost_devst_modest_sizest_mtime sizeof_stat c_s_isfifo c_s_isdir c_s_isblk c_s_ischr c_s_isrego_BINARY o_NONBLOCKo_NOCTTYo_TRUNCo_EXCLo_CREATo_APPENDo_RDWRo_WRONLYo_RDONLY c_waitpidc_utime c_tcsetattr c_tcgetattr c_sigprocmask c_sigaddset c_sigemptysetc_pipec_mkfifoc_linkc_fork c_fcntl_lock c_fcntl_write c_fcntl_readc_getpidc_unlink c_ftruncate c_safe_writec_writec_umaskc_stat c_safe_readc_read c_safe_openc_openlstatc_lseekc_isattyc_fstatc_dup2c_dupc_creatc_closec_chmodc_accessset_saved_termiosget_saved_termios fdFileSizefileTypefdStatfdType statGetTypeioe_unknownfiletype fdGetMode withFilePath peekFilePathpeekFilePathLen setCooked tcSetAttrsetNonBlockingFDsetCloseOnExecs_isregs_ischrs_isblks_isdirs_isfifos_issockIConvc_localeEncodinghs_iconvhs_iconv_close hs_iconv_open iconv_trace haskellChar char_shiftnewIConv iconvDecode iconvEncode iconvRecodemkGlobalinitFileSystemEncodinginitForeignEncodingmkTextEncoding'unknownEncodingErr flushBufferflushCharBufferHandleFinalizer newFileHandle withHandle withHandle' withHandle_ withHandle_'withAllHandles__ withHandle__' do_operationaugmentIOErrorwantWritableHandlewantWritableHandle'checkWritableHandlewantReadableHandlewantReadableHandle_wantReadableHandle'checkReadableHandlewantSeekableHandlecheckSeekableHandleioe_closedHandleioe_EOFioe_notReadableioe_notWritableioe_notSeekableioe_cannotFlushNotSeekableioe_finalizedHandle ioe_bufsiz streamEncodehandleFinalizerdEFAULT_CHAR_BUFFER_SIZE getCharBuffer mkUnBufferflushByteWriteBufferwriteCharBufferflushCharReadBufferflushByteReadBuffermkHandleioModeToHandleTypeinitBufferStateopenTextEncodingcloseTextCodecstrymaybehClose_handle_ noCharBuffer noByteBuffer hLookAhead_debugIOreadTextDevicereadTextDevice'readTextDeviceNonBlocking decodeByteBufcopycopy' firstPowerOf2AC allocArray duplicatecapacity unsafeRead unsafeWrite unsafeWrite' unsafeLoadensureCapacityensureCapacity'useAsPtrsnocclearremoveAtgetCurrentTimeCTimevalsecusec gettimeofday$fStorableCTimeval newControl closeControlW controlReadFdcontrolWriteFdcontrolEventFdControlMessage CMsgSignalCMsgDie CMsgWakeupc_setIOManagerWakeupFdc_setIOManagerControlFd c_eventfdsizeof_siginfo_t wakeupReadFd setNonBlockio_MANAGER_WAKEUPio_MANAGER_DIEreadControlMessage sendWakeupsendDie sendMessageBackend_bePoll _beModifyFdTimeoutevtClosethrowErrnoIfMinus1NoRetry_beState _beDeleteForever evtNothingeventIs evtCombine evtConcatbackendpollmodifyFd $fMonoidEvent $fShowEvent epollCreate EventType unEventType ControlOp eventTypeseventFdEPollFd fromEPollFdEPollepollFd epollEvents c_epoll_wait c_epoll_ctlc_epoll_create available controlOpAddcontrolOpModifycontrolOpDeleteepollInepollOutepollErrepollHup epollControl epollWait fromEventtoEvent fromTimeout$fStorableEventIntMapNatmember insertWith foldWithKeykeysbinhighestBitMaskKeyMaskBinTipNil natFromInt intFromNatshiftRLlookupN updateWithequalnequalzeronomatchzeroNmaskW branchMask $fShowIntMap $fEqIntMapasInt64 UniqueSourceUS newSource $fShowUniquePrioElemsize singleton toAscList toDescListfindMin deleteMinminViewatMostomegaplay unsafePlaySequTourViewPlaySingleNullLTreeRLoserLLoserStartSizePSQWinnerVoidEkeypriovalue toAscLists toDescLists secondBestatMostssize'maxKeylloserrloserlbalancerbalance lbalanceLeft lbalanceRight rbalanceLeft rbalanceRight lsingleLeft rsingleLeft lsingleRight rsingleRight ldoubleLeft ldoubleRight rdoubleLeft rdoubleRighttourView moduleError emptySequ singleSequ seqToList $fShowSequ TimeoutEdit TimeoutQueue wakeManager onFdEvent emBackendemFds emTimeoutsemStateemUniqueSource emControlStateFinishedDyingRunningCreatedTK keyUniqueFdDatafdKeyfdEvents _fdCallbackhandleControlEventnewDefaultBackendnewWithfinishedcleanupeventsOf pairEventsthreaded-getOrSetSystemEventThreadIOManagerThreadStore*getOrSetSystemEventThreadEventManagerStore threadWait eventManager ioManagermkFDfdFDfdIsNonBlocking unlockFilelockFileunsafe_fdReadyfdReadydEFAULT_FD_BUFFER_SIZEreadBuf' writeBuf' std_flags output_flags read_flags write_flagsrw_flags append_flagsnonblock_flagsstdFDreleasesetNonBlockingModefdReadfdReadNonBlockingfdWritefdWriteNonBlockingreadRawBufferPtrreadRawBufferPtrNoBlockwriteRawBufferPtrwriteRawBufferPtrNoBlock isNonBlockingthrowErrnoIfMinus1RetryOnBlock$fBufferedIOFD $fIODeviceFD $fRawIOFD$fShowFDhGetLineBufferedhGetLineBufferedLoopmaybeFillReadBufferunpack unpack_nllazyReadlazyReadBufferedgetSomeCharacters hPutcBufferedhPutStr' hPutCharsgetSpareBuffer writeBlocks commitBuffer commitBuffer'hPutBuf'bufWrite writeChunkwriteChunkNonBlockingbufReadNonEmpty bufReadEmptyhaFDbufReadNBEmptybufReadNBNonEmptycopyToRawBuffercopyFromRawBufferillegalBufferSizehClose_maybethrowhClose_rethrowhClose' dupHandle dupHandle_ioe_dupHandlesNotCompatible dupHandleTo showHandle'$fShowHandlePosn$fEqHandlePosnstdHandleFinalizer setBinaryModeaddFilePathToIOError openFile'dEFAULT_OPEN_IN_BINARY_MODE runMainIOrunIO runIOFastExitrunNonIOstg_exitshutdownHaskellAndExitshutdownHaskellAndSignalstg_sig_installinstall_interrupt_handlermkWeakThreadId topHandlertopHandlerFastExitflushStdHandlessafeExitexitInterruptedfastExit openTempFile' pathSeparatorCaster $fEqException$fShowException$fExceptionExceptionPollFdpfdFd pfdEvents pfdReventsPoll pollChangespollFdc_pollreworkFdpollInpollOutpollErrpollHup$fStorablePollFd[::]PArrMpQrQiCONSTID mkPrimType $fEqConstrconrep constring confields confixitydatatypetycondatarepunMpunQrunCONSTunID mkPrimCon falseConstr trueConstr boolDataTypecharType floatType doubleTypeintType integerTypeint8Type int16Type int32Type int64TypewordType word8Type word16Type word32Type word64Type ratioConstr ratioDataType nilConstr consConstr listDataType nothingConstr justConstr maybeDataTypeltConstreqConstrgtConstrorderingDataType leftConstr rightConstreitherDataType tuple0Constrtuple0DataType tuple2Constrtuple2DataType tuple3Constrtuple3DataType tuple4Constrtuple4DataType tuple5Constrtuple5DataType tuple6Constrtuple6DataType tuple7Constrtuple7DataType $fDataArray$fDataForeignPtr $fDataPtr$fData(,,,,,,) $fData(,,,,,) $fData(,,,,) $fData(,,,) $fData(,,) $fData(,)$fData() $fDataEither$fDataOrdering $fDataMaybe$fData[] $fDataRatio $fDataWord64 $fDataWord32 $fDataWord16 $fDataWord8 $fDataWord $fDataInt64 $fDataInt32 $fDataInt16 $fDataInt8 $fDataInteger $fDataInt $fDataDouble $fDataFloat $fDataChar $fDataBool $fShowConstr $fMonadZip[]$fCategory(->)getFullProgArgv debugBelch groupByFB $fOrdDownblockedOnDeadMVarblockedIndefinitely$fShowBlockedIndefinitely$fExceptionBlockedIndefinitely$fShowBlockedOnDeadMVar$fExceptionBlockedOnDeadMVar getGCStats_ uniqSource $fMonadEither$fFunctorEither $fFunctor(,) $fMonad(->) $fFunctor(->)ChItemforkOS_createThreadforkOS_entry_reimported max_buff_sizesuckIO forkOS_entryfailNonThreaded unsafeResult$fExceptionTimeout $fShowTimeout $fMonadFixST$fMonadFixEither$fMonadFix(->) $fMonadFixIO $fMonadFix[]$fMonadFixMaybe$fArrowLoopKleisli$fArrowLoop(->)$fMonadArrowMonad$fArrowApplyKleisli$fArrowApply(->)$fArrowChoiceKleisli$fArrowChoice(->)$fArrowPlusKleisli$fArrowZeroKleisli$fArrowKleisli$fCategoryKleisli $fArrow(->)S#$fApplicativeZipList$fFunctorZipList$fAlternativeWrappedArrow$fApplicativeWrappedArrow$fFunctorWrappedArrow$fAlternativeWrappedMonad$fApplicativeWrappedMonad$fFunctorWrappedMonad$fApplicativeConst$fFunctorConst$fApplicativeEither$fApplicative(,)$fApplicative(->)$fAlternativeSTM$fApplicativeSTM$fApplicativeST$fApplicativeST0$fApplicativeIO$fAlternative[]$fApplicative[]$fAlternativeMaybe$fApplicativeMaybe$fFoldableArray $fFoldable[]$fFoldableMaybeIdgetIdStateR runStateRStateL runStateL$fApplicativeId $fFunctorId$fApplicativeStateR$fFunctorStateR$fApplicativeStateL$fFunctorStateL$fTraversableArray$fTraversable[]$fTraversableMaybe$fFloatingComplex$fFractionalComplex $fNumComplexMkFixedtyFixed conMkFixedwithTypewithResolution chopZerosshowIntegerZeroswithDot readsFixed$fHasResolutionE12$fHasResolutionE9$fHasResolutionE6$fHasResolutionE3$fHasResolutionE2$fHasResolutionE1$fHasResolutionE0 $fReadFixed $fShowFixed$fRealFracFixed$fFractionalFixed $fRealFixed $fNumFixed $fEnumFixed $fDataFixed $fOrdVersion $fEqVersionOptKindOptErr EndOfOptsNonOptUnreqOptOptfmtOptfmtShortfmtLonggetNextlongOptshortOpterrAmbigerrReqerrUnrecerrNoArgCRUsagesysconf getrusage realToInteger clockTicks getEnvBlock c_setProgArgvc_getenv getProgArgvunpackProgNamebasenameioe_missingEnvVarwithArgv withProgArgv freeProgArgv setProgArgvdivvycompilerVersionRaw$fEqStableNameUPrintfUDoubleUFloatUIntegerUStringUChartoCharfromChar toUPrintfhsprspruIntegeruprintffmtfmtifmtu integral_prectointtostritosbstoigetSpecsgetStardfmt'dfmtperrorfmterrargerrbaderr $fIsCharChar$fPrintfArgDouble$fPrintfArgFloat$fPrintfArgInteger$fPrintfArgWord64$fPrintfArgWord32$fPrintfArgWord16$fPrintfArgWord8$fPrintfArgWord$fPrintfArgInt64$fPrintfArgInt32$fPrintfArgInt16$fPrintfArgInt8$fPrintfArgInt $fPrintfArg[]$fPrintfArgChar$fHPrintfType(->)$fPrintfType(->)$fHPrintfTypeIO$fPrintfTypeIO$fPrintfType[] $fShow(->)