!ix#pNone*"#&'+-0134567;<=>?ADFHKNPQSTV]^ejfuturesStrict version of  modifyTVar. futuresA more efficient version of  L, which does not install a default exception handler on the forked thread.  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~       !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ None*"#&'+-0134567;<=>?ADFHKNPQSTV]^e#TfuturesAbstraction over a pattern where you delegate an IO action to be executed on another thread, but are still interested in processing its result some time later on. In the meantime you can execute other actions. IOW, it is an implementation of asynchronous programming pattern.DAnother way to look at future is as on an evaluate-once computation.futuresaFork a thread to execute the computation on and produce a future, which will provide its results.RThe IO action must not throw exceptions! If you want to transfer them, wrap it in b.futures3Block waiting until the future result is available.              !" #$ %&!' ( )* +, -. -/ 01 23 4 56 57 58 59 5: 5; 5< 5= 5> 5? 5@ 5ABCBDBE FG FH FI FJ FK FL FM FN FO FP FQ FR FS FT FU FV FW FX FY FZ F[ F\ F] -^ -_ -` -a -b -c -d -e -f -g -h -i j k l m no np nq nr ns nt nu nv nw nx ny nz n{ n| n} ~    BBBBBBBB  - - F F F F F F F F F F F F F F F - - - - - -                             - -               # # # # # # # # #! #" ## $% $& $' $( $) $* $+ $, $- $. /0 /1 /2 /3 /4 /5 /6 /7 /8 /9 /: /; /< /= /> /? /@ /A /B /C /D /E )F nG nH nI nJ nK nL nM nN nO nP nQ nR nS nT nU nV nW nX nY nZ n[ n\ n] n^ n_ n` na nb nc nd ne nf ng nh ni nj nk nl nm nn no np nq nr ns nt uv wx wy wz w{ w| w} w~ w w w w                                               0 0 0 0 0 0 0 0 0 0 0 0 0 0        % % % % % % % % % % % %                                                                    ! "# "$ "% "& "' "( ") "* "+ ", "- ". "/ "0 "1 "2 "3 "4 "5 "6 "7 "8 "9 ": "; "< => =? =@ =A BC BD BE BF BG BH BI BJ BK BL BM BN OP OQ OR OS OT UV UW UX UY Z[ Z\ Z] Z^ Z_ Z` Za Zb Zc de df dg dh di dj dk dl dm dn do pq rs rt ru ru vw vx vy vz v{ v| v} v~ v v v v v v v v v v v v v v v v v v v v v v v v v v v v v v v                                                                                          2 2 2 2 2 2 2 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # " =  ! " # $ % & ' ( ) * + , , - . /0 /1 /2 /3 45 46 47 48 49 4: ;< => =? =@ =A =B CD CE CF CG CH CI CJ CK CL CM CN CO PQ PR PS PT UV UW UX UY UZ U[ U\ U] U^ U_ U` Ua Ub Uc Ud #e #f #g #h #i #j #k #l #m #g no np nq nr ns nt nt nu nv nw nx ny nz n{ n| }~ } } } } } } } } } } } } } } } } } } } } } }                                                                                                                                              !  "  #  $  %  &  &  '  ' () (* (+ (, (- ./ .0 .1 .2 .3 .4 .5 6 7 8 9 : ; < = > ? @ A B CD CE CF CG CH CI CJ CK CL CM CN CO CP CQ CR CS T U V W X YZ Y[ Y\ Y] Y^ _` _a _b _c Fd Fe Ff  g  h  i jk jl jm jn jo jp jq jr js jt ju jv jw jx jy jz j{ j| j} j~ j j j j j j j j j j j j j j j j j j j j j j j j j j j j j j j                                               - - - - - - - - - -                                                                  ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 :; :< := n> n>B?B@BABBC"futures-0.1-1xQ3WODMfDzGVbQ7P0HlnmFuturesFutures.PreludeFutureforkblock$fFunctorFuture$fApplicativeFuture $fMonadFuture$fMonadIOFuture$fMonadFailFuture modifyTVar'forkIOWithoutHandlerbase GHC.Conc.SyncforkIOGHC.Base++ghc-primGHC.PrimseqGHC.Listfilterzip GHC.Stable newStablePtr System.IOprint Data.Tuplefstsnd otherwiseassert GHC.MagiclazyGHC.IO.Exception assertError Debug.TracetraceinlinemapGHC.Exts groupWith$coerceGHC.Real fromIntegral realToFrac Control.Monadguard Data.DynamictoDynjoinGHC.EnumBoundedminBoundmaxBoundEnumfromEnumtoEnumenumFrom enumFromThen enumFromToenumFromThenTosuccpred GHC.ClassesEq==/= GHC.FloatFloatingpiexplogsqrt**logBasesincostanasinacosatansinhcoshtanhasinhacoshatanhlog1pexpm1log1pexplog1mexp Fractional fromRational/recipIntegral toIntegerquotremdivmodquotRemdivModMonad>>=>>return Data.DataDatagfoldlgunfoldtoConstr dataTypeOf dataCast1 dataCast2gmapTgmapQlgmapQrgmapQgmapQigmapMgmapMpgmapMoFunctorfmap<$GHC.NumNum fromInteger-negate*+abssignumOrd>=minmax><<=compareGHC.ReadRead readsPrecreadListreadPrec readListPrecReal toRational RealFloat floatRadix floatDigits floatRange decodeFloat encodeFloatexponent significand scaleFloatisNaN isInfiniteisDenormalizedisNegativeZeroisIEEEatan2RealFracproperFractiontruncateroundceilingfloorGHC.ShowShow showsPrecshowshowListGHC.ArrIxrangeindexinRange rangeSizeData.Typeable.InternalTypeableControl.Monad.FixMonadFixmfixControl.Monad.Fail MonadFailfail Data.StringIsString fromString Applicative<*>pure*>liftA2<* Data.FoldableFoldablefoldMapfoldrtoListnulllengthfoldlfoldl'foldl1sumproductfoldr1maximumminimumelemfoldfoldr'Data.Traversable TraversabletraversemapM sequenceAsequence GHC.GenericsGeneric Semigroup<>Monoidmemptymappendmconcat GHC.TypesBoolFalseTrueCharDoubleFloatIntI#GHC.IntInt8Int16Int32Int64 integer-gmpGHC.Integer.TypeIntegerMaybeJustNothingOrderingLTEQGTRatioRational RealWorld StablePtrIOWordGHC.WordWord8Word16Word32Word64GHC.PtrPtrFunPtr Data.EitherEitherRightLeft CoercibleTyConfork#forkOn#untangle ioException heapOverflow stackOverflowcannotCompactMutablecannotCompactPinnedcannotCompactFunctionallocationLimitExceededblockedIndefinitelyOnSTMblockedIndefinitelyOnMVarunsupportedOperation Data.Complexphase magnitudepolarcismkPolar conjugateimagPartrealPartComplex:+ Data.Fixed showFixedmod'divMod'div'FixedMkFixed HasResolution resolutionE0UniE1DeciE2CentiE3MilliE6MicroE9NanoE12PicosortWith tyconModule tyconUQname isNorepType mkNoRepType mkCharConstr mkRealConstrmkIntegralConstr mkCharType mkFloatType mkIntTypemaxConstrIndex constrIndex indexConstr isAlgType readConstr showConstr constrFixity constrFieldsdataTypeConstrsmkConstr mkDataType repConstr constrRep constrType dataTypeRep dataTypeName fromConstrM fromConstrB fromConstrDataTypeConstrDataRepIntRepFloatRepAlgRepCharRepNoRep ConstrRep AlgConstr IntConstr FloatConstr CharConstrConIndexFixityPrefixInfixSystem.TimeouttimeoutControl.ConcurrentthreadWaitWriteSTMthreadWaitReadSTMthreadWaitWritethreadWaitReadrunInUnboundThreadrunInBoundThreadisCurrentThreadBoundforkOSWithUnmaskforkOS forkFinallyrtsSupportsBoundThreadsControl.Concurrent.ChanwriteList2ChangetChanContentsdupChanreadChan writeChannewChanChanControl.Concurrent.QSem signalQSemwaitQSemnewQSemQSemControl.Concurrent.QSemN signalQSemN waitQSemNnewQSemNQSemNControl.Monad.IO.ClassMonadIOliftIO Data.RatioapproxRational Data.STRef modifySTRef' modifySTRef Data.Unique hashUnique newUniqueUniqueSystem.EnvironmentgetEnvironment withProgNamewithArgsunsetEnvsetEnv lookupEnvgetEnv getProgNamegetArgs!System.Environment.ExecutablePathgetExecutablePath System.Exitdie exitSuccess exitFailureexitWith System.Mem performGCperformMajorGCperformMinorGCSystem.Mem.StableName eqStableNamehashStableNamemakeStableName StableName Text.PrintfhPrintfprintfmfilter<$!>unless replicateM_ replicateMfoldM_foldM zipWithM_zipWithM mapAndUnzipMforever<=<>=>filterM Data.Version makeVersion parseVersion showVersionVersion versionBranch versionTags traceMarkerIO traceMarker traceEventIO traceEvent traceStack traceShowMtraceM traceShowId traceShowtraceId putTraceMsgtraceIOfoldMapDefault fmapDefault mapAccumR mapAccumLforMforControl.Applicativeoptional WrappedMonad WrapMonad unwrapMonad WrappedArrow WrapArrow unwrapArrowZipList getZipList Control.ArrowleftApp^<<<<^>>^^>>returnAArrowarrfirstsecond***&&&Kleisli runKleisli ArrowZero zeroArrow ArrowPlus<+> ArrowChoice|||+++leftright ArrowApplyapp ArrowMonad ArrowLooploop(openBinaryTempFileWithDefaultPermissions"openTempFileWithDefaultPermissionsopenBinaryTempFile openTempFilefixIOwithBinaryFilewithFilehPrinthReadylocaleEncodingreadIOreadLn appendFile writeFilereadFileinteract getContentsgetLinegetCharputStrLnputStrputChar GHC.IO.HandlehShowhSetNewlineModehSetBinaryModehIsTerminalDevicehGetEchohSetEcho hIsSeekable hGetBuffering hIsWritable hIsReadable hIsClosedhIsOpenhTellhSeekhSetPosnhGetPosn hGetEncoding hSetEncoding hSetBuffering hLookAheadisEOFhIsEOF hSetFileSize hFileSizehClose HandlePosnGHC.IO.Handle.FDopenBinaryFileopenFilestderrstdinGHC.IO.Handle.TexthGetBufNonBlocking hGetBufSomehGetBufhPutBufNonBlockinghPutBuf hPutStrLnhPutStrhPutChar hGetContentshGetLinehGetChar hWaitForInput GHC.Conc.IO registerDelay threadDelay closeFdWithioManagerCapabilitiesChangedensureIOManagerIsRunningGHC.Conc.Signal runHandlers setHandlerSignal HandlerFunControl.Concurrent.MVar mkWeakMVaraddMVarFinalizermodifyMVarMaskedmodifyMVarMasked_ modifyMVar modifyMVar_withMVarMaskedwithMVarswapMVarGHC.IO.EncodingmkTextEncodingchar8utf32beutf32leutf32utf16beutf16leutf16utf8_bomutf8latin1System.IO.Unsafe unsafeFixIOControl.ExceptionallowInterruptcatchesHandlerSystem.IO.Error catchIOErrorannotateIOError modifyIOErrorioeSetFileName ioeSetHandleioeSetLocationioeSetErrorStringioeSetErrorTypeioeGetFileName ioeGetHandleioeGetLocationioeGetErrorStringioeGetErrorTypeisUserErrorTypeisPermissionErrorTypeisIllegalOperationErrorTypeisEOFErrorTypeisFullErrorTypeisAlreadyInUseErrorTypeisDoesNotExistErrorTypeisAlreadyExistsErrorType userErrorTypepermissionErrorTypeillegalOperationErrorType eofErrorType fullErrorTypealreadyInUseErrorTypedoesNotExistErrorTypealreadyExistsErrorType isUserErrorisPermissionErrorisIllegalOperation isEOFError isFullErrorisAlreadyInUseErrorisDoesNotExistErrorisAlreadyExistsError mkIOError tryIOErrorControl.Exception.BasebracketOnErrorbracket_finallybracket onExceptiontryJusttry mapException handleJusthandle catchJustPatternMatchFail RecSelError RecConError RecUpdError NoMethodError TypeErrorNonTerminationNestedAtomicallygetUncaughtExceptionHandlersetUncaughtExceptionHandler reportErrorreportStackOverflow writeTVarreadTVar readTVarIO newTVarIOnewTVaralwaysalwaysSucceedscatchSTMthrowSTMorElseretry atomically unsafeIOToSTMnewStablePtrPrimMVarmkWeakThreadIdthreadCapability threadStatus runSparksparpseq labelThreadyield myThreadIdthrowTo killThread childHandler numSparksgetNumProcessorssetNumCapabilitiesgetNumCapabilitiesnumCapabilitiesforkOnWithUnmaskforkOnforkIOWithUnmaskdisableAllocationLimitenableAllocationLimitgetAllocationCountersetAllocationCounterreportHeapOverflowThreadId BlockReason BlockedOnMVarBlockedOnBlackHoleBlockedOnException BlockedOnSTMBlockedOnForeignCallBlockedOnOther ThreadStatus ThreadRunningThreadFinished ThreadBlocked ThreadDiedPrimMVarSTMTVar dynTypeRepdynAppdynApply fromDynamicfromDynDynamicioErrorasyncExceptionFromExceptionasyncExceptionToExceptionBlockedIndefinitelyOnMVarBlockedIndefinitelyOnSTMDeadlockAllocationLimitExceededCompactionFailedAssertionFailedSomeAsyncExceptionAsyncException StackOverflow HeapOverflow ThreadKilled UserInterruptArrayExceptionIndexOutOfBoundsUndefinedElementFixIOExceptionExitCode ExitSuccess ExitFailure IOErrorTypeEOF AlreadyExists NoSuchThing ResourceBusyResourceExhaustedIllegalOperationPermissionDenied UserErrorUnsatisfiedConstraints SystemError ProtocolError OtherErrorInvalidArgumentInappropriateType HardwareFaultUnsupportedOperation TimeExpiredResourceVanished InterruptedhFlushstdoutGHC.IO.Handle.TypesnoNewlineTranslationnativeNewlineModeuniversalNewlineMode nativeNewlineHandle BufferMode NoBuffering LineBufferingBlockBufferingNewlineLFCRLF NewlineModeinputNLoutputNL GHC.IO.DeviceSeekMode AbsoluteSeek RelativeSeek SeekFromEnd Data.IORefatomicWriteIORefatomicModifyIORef'atomicModifyIORef modifyIORef' modifyIORef mkWeakIORefGHC.IO.Encoding.Types TextEncodingForeign.ForeignPtr.ImpmallocForeignPtrArray0mallocForeignPtrArraynewForeignPtrEnvwithForeignPtr newForeignPtrGHC.ForeignPtrfinalizeForeignPtrplusForeignPtrcastForeignPtrtouchForeignPtrnewForeignPtr_addForeignPtrFinalizerEnvaddForeignPtrFinalizermallocForeignPtrBytesmallocForeignPtr ForeignPtr FinalizerPtrFinalizerEnvPtr GHC.IORef writeIORef readIORefnewIORefIORefGHC.IOevaluateuninterruptibleMaskuninterruptibleMask_maskmask_getMaskingState interruptiblethrowIOcatchstToIOFilePath MaskingStateUnmaskedMaskedInterruptibleMaskedUninterruptible userError IOExceptionIOError ioe_handleioe_type ioe_locationioe_description ioe_errno ioe_filename GHC.Exceptionthrow Exception toException fromExceptiondisplayException ErrorCallErrorCallWithLocationArithExceptionOverflow UnderflowLossOfPrecision DivideByZeroDenormalRatioZeroDenominator Data.TypeabletypeOf7typeOf6typeOf5typeOf4typeOf3typeOf2typeOf1 rnfTypeReptypeRepFingerprint typeRepTyCon typeRepArgs splitTyConAppmkFunTy funResultTygcast2gcast1gcasteqTcast showsTypeReptypeReptypeOfTypeReprnfTyContyConFingerprint tyConName tyConModule tyConPackageData.Functor.ConstConstgetConstfindnotElem minimumBy maximumByallanyorand concatMapconcatmsumasum sequence_ sequenceA_forM_mapM_for_ traverse_foldlMfoldrMData.Semigroup.InternalDualgetDualEndoappEndoAllgetAllAnygetAnySumgetSumProduct getProductAltgetAlt Unsafe.Coerce unsafeCoerce Data.OldListunwordswordsunlineslinesunfoldrsortBysort permutations subsequencestailsinitsgroupBygroupdeleteFirstsByunzip7unzip6unzip5unzip4zipWith7zipWith6zipWith5zipWith4zip7zip6zip5zip4genericReplicate genericIndexgenericSplitAt genericDrop genericTake genericLengthinsertByinsert partition transpose intercalate intersperse intersectBy intersectunionByunion\\deleteBydeletenubBynub isInfixOf isSuffixOf isPrefixOf findIndices findIndex elemIndices elemIndex stripPrefix dropWhileEnd Data.Char isSeparatorisNumberisMarkisLetter digitToInt Text.Readread readMaybe readEitherreads fromRightfromLeftisRightisLeftpartitionEithersrightsleftseitherData.Ord comparingDown Data.Proxy asProxyTypeOfProxyKProxyControl.Category>>><<<Categoryid.Data.Type.Equality:~:Refl:~~:HRefl Foreign.Ptr intPtrToPtr ptrToIntPtr wordPtrToPtr ptrToWordPtrfreeHaskellFunPtrWordPtrIntPtr GHC.IO.IOModeIOModeReadMode WriteMode AppendMode ReadWriteModeForeign.StorableStorable peekElemOff pokeElemOff peekByteOff pokeByteOffpeekpokecastPtrToStablePtrcastStablePtrToPtrdeRefStablePtr freeStablePtrcastPtrToFunPtrcastFunPtrToPtr castFunPtr nullFunPtrminusPtralignPtrplusPtrcastPtrnullPtrNumericshowOctshowHex showIntAtBase showHFloat showGFloatAlt showFFloatAlt showGFloat showFFloat showEFloatshowInt readSigned readFloatreadHexreadDecreadOctreadInt lexDigits readLitChar lexLitCharlex readParenText.ParserCombinators.ReadPrec readS_to_Prec readPrec_to_S readP_to_Prec readPrec_to_PReadPrecText.ParserCombinators.ReadP readS_to_P readP_to_SReadSReadPfromRat floatToDigits showFloat byteSwap64 byteSwap32 byteSwap16 GHC.UnicodetoTitletoUppertoLowerisLowerisUpperisPrint isControl isAlphaNumisAlphaisSymbol isPunctuation isHexDigit isOctDigitisDigitisSpace isAsciiUpper isAsciiLowerisLatin1isAsciigeneralCategoryGeneralCategoryControlUppercaseLetterLowercaseLetterTitlecaseLetterModifierLetter OtherLetterNonSpacingMarkSpacingCombiningMark EnclosingMark DecimalNumber LetterNumber OtherNumberConnectorPunctuationDashPunctuationOpenPunctuationClosePunctuation InitialQuote FinalQuoteOtherPunctuation MathSymbolCurrencySymbolModifierSymbol OtherSymbolSpace LineSeparatorParagraphSeparatorFormat Surrogate PrivateUse NotAssigned GHC.STRef writeSTRef readSTRefnewSTRefSTRefGHC.STrunSTfixSTST Data.BitstoIntegralSizedpopCountDefaulttestBitDefault bitDefaultBits.&..|.xor complementshiftrotatezeroBitsbitsetBitclearBit complementBittestBit bitSizeMaybebitSizeisSignedshiftL unsafeShiftLshiftR unsafeShiftRrotateLrotateRpopCount FiniteBits finiteBitSizecountLeadingZeroscountTrailingZeros Data.Boolbool Data.Function&onfix Data.Functorvoid$><&><$>lcmgcd^^^oddeven showSigned denominator numerator%GHC.Charchr intToDigit showLitChar showParen showStringshowCharshowsShowSunzip3unzipzipWith3zipWithzip3!!lookupreversebreakspansplitAtdroptake dropWhile takeWhilecycle replicaterepeatiterate'iteratescanr1scanrscanl'scanl1scanlfoldl1'initlasttailhead Data.MaybemapMaybe catMaybes listToMaybe maybeToList fromMaybefromJust isNothingisJustmaybeswapuncurrycurry GHC.IO.UnsafeunsafeInterleaveIOunsafeDupablePerformIOunsafePerformIOGHC.MVar isEmptyMVar tryReadMVar tryPutMVar tryTakeMVarputMVarreadMVartakeMVarnewMVar newEmptyMVarMVarsubtractasTypeOfuntil$!flipconstordapliftM5liftM4liftM3liftM2liftMwhen=<<liftA3liftA<**> Alternativeempty<|>somemany MonadPlusmzeromplusStringGHC.Err undefinederrorWithoutStackTraceerror SomeException&&||notProduct2