-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | instantly create REPL from any function -- -- This module provides functions to create interactive REPLs: -- --
-- repl (sqrt :: Double -> Double) ---- -- Reverse entered strings: -- --
-- repl (reverse :: String -> String) ---- -- Prints both squares and square roots: -- --
-- sqrSqrt :: [Double] -> [Double] -- sqrSqrt [] = [] -- sqrSqrt (x:xs) = x^2 : sqrt x : sqrSqrt xs -- repl sqrSqrt --repl :: Repl a b => (a -> b) -> IO () -- | Same as repl with (a -> b) function but the first -- argument is the value that will cause repl' to exit. repl' :: (Eq a, Read a, Show b) => a -> (a -> b) -> IO () -- | ReplState typeclass with polymorphic stateful function -- replState to interactively evaluate input lines and print -- responses (see below). class ReplState a b s | b -> s -- | Function passed to replState will be called with values from -- stdin and previous state (depending on type, via State monad -- or as the first argument) and should return value to be printed to -- stdout and the new state (either via State monad or as a -- tuple). -- -- Specific behaviour depends on function type (see instances above). -- -- Examples: -- -- Prints sums of entered numbers: -- --
-- adder :: Int -> State Int Int -- adder x = modify (+ x) >> get -- replState adder 0 ---- -- or with plain state function -- --
-- adder :: Int -> Int -> (Int, Int) -- adder x s = let s' = s + x in (s', s') -- replState adder 0 ---- -- Above can be done with replFold (see below): -- --
-- replFold (+) 0 ---- -- but replState is more flexible - state and output can be different -- types. replState :: ReplState a b s => (a -> b) -> s -> IO () -- | Same as replState with (a -> State s b) function -- but the first argument is the value that will cause replState' -- to exit. replState' :: forall a b s. (Eq a, Read a, Show b) => a -> (a -> State s b) -> s -> IO () -- | replFold combines the entered values with the accumulated value -- using provided function and prints the resulting values. replFold :: forall a b. (Read a, Show b) => (b -> a -> b) -> b -> IO () -- | Same as replFold but the first argument is the value that will -- cause replFold' to exit. replFold' :: forall a b. (Eq a, Read a, Show b) => a -> (b -> a -> b) -> b -> IO () instance System.IO.Interact.ReplState GHC.Base.String (s -> (GHC.Base.String, s)) s instance (GHC.Read.Read a, GHC.Show.Show b) => System.IO.Interact.ReplState a (s -> (b, s)) s instance System.IO.Interact.ReplState [GHC.Base.String] (Control.Monad.Trans.State.Lazy.State s [GHC.Base.String]) s instance (GHC.Read.Read a, GHC.Show.Show b) => System.IO.Interact.ReplState a (Control.Monad.Trans.State.Lazy.State s b) s instance System.IO.Interact.ReplState GHC.Base.String (Control.Monad.Trans.State.Lazy.State s GHC.Base.String) s instance System.IO.Interact.ReplState GHC.Base.String (Control.Monad.Trans.State.Lazy.State s (GHC.Maybe.Maybe GHC.Base.String)) s instance System.IO.Interact.ReplState GHC.Base.String (Control.Monad.Trans.State.Lazy.State s (Data.Either.Either GHC.Base.String GHC.Base.String)) s instance (GHC.Read.Read a, GHC.Show.Show b) => System.IO.Interact.ReplState a (Control.Monad.Trans.State.Lazy.State s (GHC.Maybe.Maybe b)) s instance (GHC.Read.Read a, GHC.Show.Show b) => System.IO.Interact.ReplState a (Control.Monad.Trans.State.Lazy.State s (Data.Either.Either GHC.Base.String b)) s instance System.IO.Interact.Repl [GHC.Base.String] [GHC.Base.String] instance (GHC.Read.Read a, GHC.Show.Show b) => System.IO.Interact.Repl [a] [b] instance (GHC.Read.Read a, GHC.Show.Show b) => System.IO.Interact.Repl a b instance System.IO.Interact.Repl GHC.Base.String GHC.Base.String instance System.IO.Interact.Repl GHC.Base.String (GHC.Maybe.Maybe GHC.Base.String) instance System.IO.Interact.Repl GHC.Base.String (Data.Either.Either GHC.Base.String GHC.Base.String) instance (GHC.Read.Read a, GHC.Show.Show b) => System.IO.Interact.Repl a (GHC.Maybe.Maybe b) instance (GHC.Read.Read a, GHC.Show.Show b) => System.IO.Interact.Repl a (Data.Either.Either GHC.Base.String b)