4      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`a b c d e f g h i j klmnopqrstuvwxyz{|}~                          !"#$%&'()*+,-./0123456789:;<= >?@ABCDEFGHIJKLMNOPQRST UV W XYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                   !"#$%&'()*+,-./0123  TrustworthyL8Strict (call-by-value) application, defined in terms of .The 3 function establishes a handler that receives any # raised in the action protected by . An  is caught by the most recent handler established by one of the exception handling functions. These handlers are not selective: all s are caught. Exception propagation must be explicitly provided in a handler by re-raising any unwanted exceptions. For example, in Df = catch g (\e -> if IO.isEOFError e then return [] else ioError e) the function f returns []% when an end-of-file exception (cf.  ) occurs in gD; otherwise, the exception is propagated to the next outer handler.aWhen an exception propagates outside the main program, the Haskell system prints the associated  value and exits the program.QNon-I/O exceptions are not caught by this variant; to catch all exceptions, use  from Control.Exception. x y6 is the greatest (positive) integer that divides both x and y; for example  (-3) 6 = 3,  (-3) (-6) = 3,  0 4 = 4.  0 0 raises a runtime error. n xs( returns a tuple where first element is xs prefix of length n1 and second element is the remainder of the list: 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). $ is an instance of the more general  , in which n may be of any integral type.  $%&'()*+,-./01256789:;=>?@ABCDEFGmnopqrstuvwx !"#$%&'()*+,-./0123456789:;<ABCDEFGHIJKLMNOPQRSUXYZ[\]^_mnopqtuvwxyz{|}~5AB ?CD;EFG6@ &-%SRQP$ON9:87=,/ )FEDCBA(HG')('&%$#"! 1MLKJI076543210/.-,+*<;8:9*+nmpoq   y~z}|{xwvut\2_^][ZYXU.>xwvutsrqpomn SafeL     ==     Safe  Safe 456789:;<Safe=>?@ABCDEFGHIJKLMNOPQRSTUVWX TrustworthySafeYZ[\]^_`abcdefghijklmnopqrstu Safe abcdefghij jihgfedcba Trustworthy YZ[\] ]\[ZY Safeh tuvwxyz{|}~h y~}|{zxwvutSafe^__^ Trustworthy   Trustworthy5     5     Safevwxyz{|}~Safevwxyz{|}~YZ[\]^_`abcdefghijklmnopqrstu      !"#$%&'()*Safe5      !"#$%&'()*Safe +,-./0123Safe456789:;<=>?@ABCDEFG SafeHIJKLM Safe NOPQRSTUVW Trustworthy 3With a source of random number supply in hand, the  L class allows the programmer to extract random values of a variety of types.Minimal complete definition: ! and ".!Takes a range (lo,hi) and a random number generator gK, and returns a random value uniformly distributed in the closed interval [lo,hi]D, together with a new generator. It is unspecified what happens if lo>hi@. For continuous types there is no requirement that the values lo and hiW are ever produced, but they may be, depending on the implementation and the interval." The same as !3, but using a default range determined by the type: For bounded types (instances of $ , such as 6+), the range is normally the whole type.FFor fractional types, the range is normally the semi-closed interval [0,1).For :*, the range is (arbitrarily) the range of 9.#Plural variant of !T, producing an infinite list of random values instead of returning a new generator.$Plural variant of "T, producing an infinite list of random values instead of returning a new generator.% A variant of !H that uses the global random number generator (see "Random#globalrng").& A variant of "H that uses the global random number generator (see "Random#globalrng").'The ' instance of ( has a + of at least 30 bits.The result of repeatedly using )3 should be at least as statistically robust as the (Minimal Standard Random Number Generator\ described by ["Random#Park", "Random#Carta"]. Until more is known about implementations of *, all we require is that *d deliver generators that are (a) not identical and (b) independently robust in the sense just given.The 2 and . instances of '] provide a primitive way to save the state of a random number generator. It is required that  (^ g) == g. In addition, I may be used to map an arbitrary string (not necessarily one produced by ^) onto a value of type '. In general, the . instance of ' has the following properties:'It guarantees to succeed on any string.=It guarantees to consume only a finite portion of the string.EDifferent argument strings are likely to result in different results.( The class (: provides a common interface to random number generators.Minimal complete definition: ) and *.)The ) operation returns an 99 that is uniformly distributed in the range returned by +3 (including both end points), and a new generator.*The * operation allows one to obtain two distinct random number generators. This is very useful in functional programs (for example, when passing a random number generator down to recursive calls), but very little work has been done on statistically robust implementations of *L (["Random#Burton", "Random#Hellekalek"] are the only examples we know of).+The +A operation yields the range of values returned by the generator.It is required that:If (a,b) = + g, then a < b.+" always returns a pair of defined 9s."The second condition ensures that +i cannot examine its argument, and hence the value it returns can be determined only by the instance of (C. That in turn allows an implementation to make a single call to +a to establish a generator's range, without being concerned that the generator returned by (say) ): might have a different range to the generator passed to )./The default definition spans the full range of 9., The function ,N provides an alternative way of producing an initial generator, by mapping an 9] into a generator. Again, distinct arguments should be likely to produce distinct generators.-(Sets the global random number generator..(Gets the global random number generator./Applies *d to the current global random generator, updates it with one of the results, and returns the other.0Uses the supplied function to get a value from the current global random generator, and updates the global generator with the new generator returned by the function. For example, rollDice' gets a random integer between 1 and 6: < rollDice :: IO Int rollDice = getStdRandom (randomR (1,6))( !"#$%&'X()*+YZ,[\]^_`abcd-.e/0fghijklmn !"#$%&'()*+,-./0()*+',0.-/ !"#$%& !"#$%&'X()*+YZ,[\]^_`abcd-.e/0fghijklmn Safeopqrstuvwxyz{|}~!SafeSafe!"#*+4`abcdefghijklmnopqrs4sr#!fe`kljihg"dcba*+nmpoqSafe<=`>?@<=@?>`"Safe# TrustworthySafe1The 1 function captures a common allocate, compute, deallocate idiom in which the deallocation step must occur even in the case of an error during computation. This is similar to try-catch-finally in Java.OThis version handles only IO errors, as defined by Haskell 98. The version of bracket in Control.Exception5 handles all exceptions, and should be used instead.2 A variant of 1+ where the middle computation doesn't want x.OThis version handles only IO errors, as defined by Haskell 98. The version of bracket_ in Control.Exception5 handles all exceptions, and should be used instead.3The construct 3 compV exposes IO errors which occur within a computation, and which are not fully handled.QNon-I/O exceptions are not caught by this variant; to catch all exceptions, use $ from Control.Exception.123M>Hklmnopqrstuvwxyz{|}~123MH|{yz~lk}312>rxwvutsqpomn123 Safe6@TVWVTW6@%Safe9Safe3IJKL3IJKLL Trustworthy3IJKLMNOPQRSTUVWX MNPQORSTUVWX&'(&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&'E&'F&'G&'H&'I&'J&'K&'L&'M&'N&'O&'P&'Q&'R&'R&'S&'T&'U&'V&'W&'X&'Y&'Z&'Z[\]^_`aabcdefghijklmnopqrstuvwxy$&z{&z|&z}&z~&z&z&z&z&z&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& & & & & &&&&&&&&&&&&&&&&&&& &!&"&#&$&%&&&'&(&)&*&+&,&-&.&/&0&1&2&3&4&5&6&7&8&9&:&;&;&<=&<=&<>&<>&<?&<?&<@&<@&<A&<A&<B&<B&<C&<C&<D&<D&<E&<E&<F&<F&<G&<G&<H&<H&<I&<I&<J&<J&<K&<K&<L&<L&<M&<M&<N&<N&<O&<O&<P&<P&<Q&<Q&<R&<S&<T&<U&<U&<V&<V&<W&<W&<X&<X&YZ&Y[&Y\&Y]&Y^&Y_&Y`&Ya&Yb&cd&ce&cf&cg&ch&ci&cj&ck&cl&cm&cn&co&cp&cq&cr&cs&ct&cu&cv&cw&xy&xz&x{&x|&x}&x~&&&&&&&&&&n& &&&&&&&&&&&&&&&&&&&!&&&&,j"&&&&&&&&#&&&&&&&&&&&&&&&&&&&haskell98-2.0.0.3PreludeMonadIxRatioIOArraySystemCPUTimeComplex MarshalErrorListCharNumericMaybe DirectoryLocaleTimeRandomSystem.IO.Error isEOFErrorControl.ExceptioncatchStorableBitsCStringCErrorCForeignCTypes MarshalAlloc MarshalArray MarshalUtilsPtr StablePtrWord ForeignPtrtryIntbaseGHC.Base++GHC.Errerrorfoldrghc-primGHC.PrimseqGHC.Listconcatfilterzip System.IOprint Data.Tuplefstsnd otherwisemap$ undefinedGHC.Num fromInteger-GHC.Real fromRationalGHC.EnumenumFrom enumFromThen enumFromToenumFromThenTo GHC.Classes==>=negatefail>>=>>fmapreturn fromIntegral realToFrac toInteger toRational Control.MonadguardliftMjoinBoundedEnumEq GHC.FloatFloating FractionalIntegralFunctorNumOrdGHC.ReadReadReal RealFloatRealFracGHC.ShowShowGHC.Arr MonadPlus GHC.TypesBoolDoubleFloat integer-gmpGHC.Integer.TypeIntegerOrderingRational Data.EitherEitherStringFalseTrueLeftRightLTEQGTGHC.IO.Handle.TypesHandlerangeindexinRange rangeSizearraybounds listArray!indiceselemsassocs accumArray//accumixmap System.Exit exitFailureexitWithSystem.EnvironmentgetEnv getProgNamegetArgsSystem.CPUTimecpuTimePrecision getCPUTime Data.RatioapproxRational Data.Complexphase magnitudepolarcismkPolar conjugateimagPartrealPart:+hPrinthReadyreadIOreadLn appendFile writeFilereadFileinteract getContentsgetLinegetCharputStrLnputStrputCharGHC.IO.Handle.FDopenFileisEOFstderrstdin GHC.IO.Handle hIsSeekable hGetBuffering hIsWritable hIsReadable hIsClosedhIsOpenhSeekhSetPosnhGetPosn hSetBuffering hLookAheadhIsEOF hFileSizehClose HandlePosnGHC.IO.Handle.Text hPutStrLnhPutStrhPutChar hGetContentshGetLinehGetChar hWaitForInputannotateIOErrorioeGetFileName ioeGetHandleioeGetErrorString userErrorTypepermissionErrorTypeillegalOperationErrorType eofErrorType fullErrorTypealreadyInUseErrorTypedoesNotExistErrorTypealreadyExistsErrorType isUserErrorisPermissionErrorisIllegalOperation isFullErrorisAlreadyInUseErrorisDoesNotExistErrorisAlreadyExistsError mkIOError GHC.IO.IOModeReadMode WriteMode AppendMode ReadWriteModeIOModestdouthFlushGHC.IO.ExceptionioError ExitSuccess ExitFailureExitCode IOErrorType NoBuffering LineBufferingBlockBuffering BufferMode GHC.IO.Device AbsoluteSeek RelativeSeek SeekFromEndSeekMode Data.Listunwordswordsunlineslinesproductsumfoldl1unfoldrsortBysorttailsinitsgroupBygroupdeleteFirstsByunzip7unzip6unzip5unzip4zipWith7zipWith6zipWith5zipWith4zip7zip6zip5zip4genericReplicate genericIndexgenericSplitAt genericDrop genericTake genericLength minimumBy maximumByminimummaximuminsertByinsert mapAccumR mapAccumL partition transpose intersperse intersectBy intersectunionByunion\\deleteBydeletenubBynub isSuffixOf isPrefixOf findIndices findIndexfind elemIndices elemIndex Data.Char digitToInt GHC.UnicodetoUppertoLowerGHC.IOFilePath userErrorIOError Text.ReadreadreadseithershowOctshowHex showIntAtBase showGFloat showFFloat showEFloatshowInt readSigned readFloatreadHexreadDecreadOctreadInt lexDigits readLitChar lexLitCharlex readParenreadList readsPrecfromRat floatToDigits showFloatacoshatanhasinhcoshtanhsinhacosatanasincostansinlogBase**logsqrtexppiatan2isIEEEisNegativeZeroisDenormalized isInfiniteisNaN scaleFloat significandexponent encodeFloat decodeFloat floatRange floatDigits floatRadixlcm^^^oddeven showSigned denominator numerator%divModquotRemmoddivremquotrecip/floorceilingroundtruncateproperFractionmaxBoundminBoundfromEnumtoEnumpredsuccGHC.CharchrText.ParserCombinators.ReadPReadS intToDigit showLitChar showParen showStringshowCharshowsShowSshowListshow showsPrecapliftM5liftM4liftM3liftM2unlesswhenfoldM zipWithM_zipWithM mapAndUnzipMmsumfilterMmapM_mapM sequence_sequence=<<mplusmzerounzip3unzipzipWith3zipWithzip3!! concatMaplookupnotElemelemallanyorandreversebreakspandroptake dropWhile takeWhilecycle replicaterepeatiteratescanr1scanrfoldr1scanl1scanlfoldllengthnullinitlasttailhead Data.MaybemapMaybe catMaybes listToMaybe maybeToList fromMaybefromJust isNothingisJustmaybeNothingJustuncurrycurrysubtractsignumabs*+asTypeOfuntilflip.constidordisAsciiisLatin1 isControlisPrintisSpaceisUpperisLowerisAlphaisDigit isOctDigit isHexDigit isAlphaNum/=compare<=&&||not<>maxmindirectory-1.2.1.0System.DirectorygetModificationTime doesFileExistdoesDirectoryExistsetCurrentDirectorygetCurrentDirectorygetDirectoryContents renameFilerenameDirectory removeFileremoveDirectorycreateDirectoryold-locale-1.0.0.6 System.LocaledefaultTimeLocale time12FmttimeFmtdateFmt dateTimeFmtamPmmonthswDays TimeLocaleold-time-1.1.0.2 System.TimeformatCalendarTimecalendarTimeToString toClockTime toUTCTimetoCalendarTimediffClockTimesaddToClockTime getClockTimeJanuaryFebruaryMarchAprilMayJuneJulyAugust SeptemberOctoberNovemberDecemberMonthSundayMondayTuesday WednesdayThursdayFridaySaturdayDay ClockTimectIsDSTctTZctTZNamectYDayctWDay ctPicosecctSecctMinctHourctDayctMonthctYear CalendarTime tdPicosectdSectdMintdHourtdDaytdMonthtdYearTimeDiffprocess-1.2.0.0System.Processsystem$!gcdsplitAt Permissionsreadablewritable executable searchablegetPermissionssetPermissionsrandomRrandomrandomRsrandoms randomRIOrandomIOStdGen RandomGennextsplitgenRangemkStdGen setStdGen getStdGen newStdGen getStdRandombracketbracket_Foreign.Storablepokepeek pokeByteOff peekByteOff pokeElemOff peekElemOff alignmentsizeOf Data.BitspopCountDefaulttestBitDefault bitDefaultpopCountrotateRrotateL unsafeShiftRshiftR unsafeShiftLshiftLisSignedbitSize bitSizeMaybetestBit complementBitclearBitsetBitbitzeroBitsrotateshift complementxor.|..&. finiteBitSize FiniteBitsForeign.C.StringwithCWStringLen withCWStringnewCWStringLen newCWStringpeekCWStringLen peekCWStringwithCAStringLen withCAStringnewCAStringLen newCAStringpeekCAStringLen peekCAStringcastCharToCSCharcastCSCharToCharcastCharToCUCharcastCUCharToCharcastCharToCCharcastCCharToCharcharIsRepresentablewithCStringLen withCString newCStringLen newCStringpeekCStringLen peekCString CStringLenCWString CWStringLenForeign.C.ErrorerrnoToIOErrorthrowErrnoPathIfMinus1_throwErrnoPathIfMinus1throwErrnoPathIfNullthrowErrnoPathIf_throwErrnoPathIfthrowErrnoPaththrowErrnoIfNullRetryMayBlockthrowErrnoIfNullRetrythrowErrnoIfNull throwErrnoIfMinus1RetryMayBlock_throwErrnoIfMinus1RetryMayBlockthrowErrnoIfMinus1Retry_throwErrnoIfMinus1RetrythrowErrnoIfMinus1_throwErrnoIfMinus1throwErrnoIfRetryMayBlock_throwErrnoIfRetry_throwErrnoIfRetryMayBlockthrowErrnoIfRetry throwErrnoIf_ throwErrnoIf throwErrno resetErrnogetErrno isValidErrnoeXDEV eWOULDBLOCKeUSERSeTXTBSY eTOOMANYREFS eTIMEDOUTeTIMEeSTALEeSRMNTeSRCHeSPIPEeSOCKTNOSUPPORT eSHUTDOWNeRREMOTE eRPCMISMATCHeROFSeREMOTEeREMCHGeRANGE ePROTOTYPEePROTONOSUPPORTePROTO ePROGUNAVAIL ePROGMISMATCH ePROCUNAVAILePROCLIMePIPE ePFNOSUPPORTePERM eOPNOTSUPPeNXIOeNOTTYeNOTSUPeNOTSOCK eNOTEMPTYeNOTDIReNOTCONNeNOTBLKeNOSYSeNOSTReNOSReNOSPC eNOPROTOOPTeNONETeNOMSGeNOMEMeNOLINKeNOLCKeNOEXECeNOENTeNODEVeNODATAeNOBUFSeNFILE eNETUNREACH eNETRESETeNETDOWN eNAMETOOLONG eMULTIHOPeMSGSIZEeMLINKeMFILEeLOOPeISDIReISCONNeIOeINVALeINTR eINPROGRESSeILSEQeIDRM eHOSTUNREACH eHOSTDOWNeFTYPEeFBIGeFAULTeEXISTeDQUOTeDOMeDIRTY eDESTADDRREQeDEADLK eCONNRESET eCONNREFUSED eCONNABORTEDeCOMMeCHILDeBUSYeBADRPCeBADMSGeBADFeALREADYeAGAIN eAFNOSUPPORTeADV eADDRNOTAVAIL eADDRINUSEeACCESe2BIGeOKErrnoForeign.C.TypesCCharCSCharCUCharCShortCUShortCIntCUIntCLongCULongCLLongCULLongCFloatCDoubleCPtrdiffCSizeCWchar CSigAtomicCClockCTime CUSeconds CSUSecondsCFileCFposCJmpBufCIntPtrCUIntPtrCIntMaxCUIntMaxForeign.Marshal.Allocfree reallocBytesreallocallocaBytesAligned allocaBytesalloca mallocBytesmalloc finalizerFreeForeign.Marshal.Array advancePtr lengthArray0 moveArray copyArray withArrayLen0 withArray0 withArrayLen withArray newArray0newArray pokeArray0 pokeArray peekArray0 peekArray reallocArray0 reallocArray allocaArray0 allocaArray mallocArray0 mallocArrayForeign.Marshal.Errorvoid throwIfNull throwIfNeg_ throwIfNegthrowIf_throwIfForeign.Marshal.Utils moveBytes copyByteswithMany maybePeek maybeWithmaybeNewtoBoolfromBoolwithnewgetTime stdFromString mkStdGen32 createStdGenmkStdRNGrandomIvalIntegerrandomIvalDouble int32CountiLogBasestdRangestdNextstdSplit theStdGen $fRandomFloat$fRandomDouble$fRandomInteger $fRandomBool $fRandomChar $fRandomInt $fReadStdGen $fShowStdGen$fRandomGenStdGenGHC.PtrFunPtr Foreign.Ptr intPtrToPtr ptrToIntPtr wordPtrToPtr ptrToWordPtrfreeHaskellFunPtrWordPtrIntPtrcastPtrToFunPtrcastFunPtrToPtr castFunPtr nullFunPtrminusPtralignPtrplusPtrcastPtrnullPtr GHC.Stable newStablePtrcastPtrToStablePtrcastStablePtrToPtrdeRefStablePtr freeStablePtrGHC.WordWord8Word16Word32Word64 byteSwap64 byteSwap32 byteSwap16GHC.ForeignPtrForeign.ForeignPtr.ImpmallocForeignPtrArray0mallocForeignPtrArraynewForeignPtrEnvwithForeignPtr newForeignPtrfinalizeForeignPtrcastForeignPtrtouchForeignPtrnewForeignPtr_addForeignPtrFinalizerEnvaddForeignPtrFinalizermallocForeignPtrBytesmallocForeignPtr FinalizerPtrFinalizerEnvPtrGHC.IntInt8Int16Int32Int64