úÎ!8‘5é     SafeÝ !"#$%&(c) Evgeny PoberezkinMITevgeny@poberezkin.com experimental non-portableSafe /=?@ACXk5uinteract. typeclass with polymorphic stateful function H to interactively evaluate input lines and print responses (see below).interactFunction passed to ! will be called with values from '} and previous state (depending on type, via State monad or as the first argument) and should return value to be printed to (; and the new state (either via State monad or as a tuple).BSpecific behaviour depends on function type (see instances above).Examples:Prints sums of entered numbers: Madder :: Int -> State Int Int adder x = modify (+ x) >> get replState adder 0or with plain state function Zadder :: Int -> Int -> (Int, Int) adder x s = let s' = s + x in (s', s') replState adder 0Above can be done with   (see below): replFold (+) 0Ibut replState is more flexible - state and output can be different types.interact* with prompt defined by the first argumentinteract/ typeclass with polymorphic stateless function H to interactively evaluate input lines and print responses (see below).interactFunction passed to ! will be called with values from ' ()s or *„ instances, one value at a time or as a lazy list depending on the type of the function) and should return value to be printed to ( () or + instance, possibly wrapped in , or -*, one value at a time or as a lazy list) .BSpecific behaviour depends on function type (see instances above).Examples:*Print square roots of the entered numbers: repl (sqrt :: Double -> Double)Reverse entered strings: "repl (reverse :: String -> String)%Prints both squares and square roots: gsqrSqrt :: [Double] -> [Double] sqrSqrt [] = [] sqrSqrt (x:xs) = x^2 : sqrt x : sqrSqrt xs repl sqrSqrtinteract is  with promptExample: $pRepl ">" (sqrt :: Double -> Double)interactSame as  with (a -> b)? function but the first argument is the value that will cause  to exit.interactSame as  with (a -> State s b)? function but the first argument is the value that will cause  to exit. interact with prompt interact q combines the entered values with the accumulated value using provided function and prints the resulting values. interact  with prompt interactSame as  6 but the first argument is the value that will cause   to exit. interact  with promptinteractreturn . to exit, string in . is printedinteractreturn / to exitinteract) s do not use  'read'/'show'interactCtrl-D to exitinteract'stdin'/'stdout' values as lazy listsinteract'stdin'/'stdout' )s as lazy listsinteractreturn . to exit, string in . is printedinteractreturn / to exitinteract) s do not use  'read'/'show'interactCtrl-D to exitinteract'stdin'/'stdout' )s as lazy listsinteract5plain state function with argument and result of any  'Read'/'Show' typesinteractplain state function with )s as argument and resultinteract.state function (type defined by the instances)interact initial stateinteractpromptinteract value to stopinteractfunction to transform the input interactpromptinteract value to stopinteractstate functioninteract initial state interactpromptinteract value to stopinteractfolding functioninteract initial value  0      !"#$%&'()*+,*+-*./*01*23*45*67*68*49:'interact-0.2.0.0-3TRSdwQ3GJGCkzR5ZwlpDnSystem.IO.InteractPaths_interact ReplState replState pReplStateReplreplpReplrepl'pRepl' replState' pReplState'replFold pReplFold replFold' pReplFold' $fReplaEither $fReplaMaybe$fRepl[]Either $fRepl[]Maybe $fRepl[][]$fReplab $fRepl[][]0 $fRepl[][]1$fReplStateaStateTs$fReplStateaStateTs0$fReplState[]StateTs$fReplState[]StateTs0$fReplState[]StateTs1$fReplStateaStateTs1$fReplState[]StateTs2$fReplStatea->s$fReplState[]->sversion getBinDir getLibDir getDynLibDir getDataDir getLibexecDir getSysconfDirgetDataFileNamebaseGHC.IO.Handle.FDstdinstdoutGHC.BaseStringGHC.ReadReadGHC.ShowShow GHC.MaybeMaybe Data.EitherEitherLeftNothing