CurryInfo: curry-repl-1.2.0 / REPL.Main.showCurrentOptions

definition:
showCurrentOptions :: ReplState -> String
showCurrentOptions rst = intercalate "\n" $ filter notNull
  [ "\nCurrent settings:" ] ++
  formatVarVals ": "
    [ ("import paths      ", intercalate [searchPathSeparator] (loadPaths rst))
    , ("parser options    ", parseOpts rst)
    , ("timeout           ", show (timeOut rst))
    , ("run-time arguments", rtsArgs rst)
    , ("verbosity         ", show (verbose rst))
    , ("prompt            ", show (prompt rst))
    , ("let bindings      ", unlines (letBinds rst))
    , ("...............and"
      , unwordsOpts $ sortBy (\f1 f2 -> setFlag f1 <= setFlag f2) $
          [ showOnOff (showBindings rst) ++ "bindings"
          , showOnOff (withEcho     rst) ++ "echo"
          , showOnOff (withShow     rst) ++ "show"
          , showOnOff (showTime     rst) ++ "time"
          ] ++ map showCompilerOption (cmpOpts rst)) ] ++
  (if verbose rst > 2
     then [ "\nProperties from rc file:" ] ++
          formatVarVals " = " (rcVars rst) ++
          [ "\nREPL configuration:" ] ++
          formatVarVals ": "
            [ ("prelude name"       , preludeName rst)
            , ("main exp module"    , mainExpMod  rst)
            , ("parser executable"  , ccFrontend ccdesc)
            , ("parser option"      , ccParseOpt ccdesc "OPTS")
            , ("compiler home dir"  , ccHome     ccdesc)
            , ("compiler executable", ccExec     ccdesc)
            , ("verbosity option"   , ccVerbOpt  ccdesc "VERB")
            , ("compile option"     , ccCmplOpt  ccdesc "MOD")
            , ("executable option"  , ccExecOpt  ccdesc "MOD")
            , ("clean command"      , ccCleanCmd ccdesc "MOD") ]
     else [])
 where
  ccdesc = compiler rst

  unwordsOpts xs = let s = unwords xs
                   in if length s >= 60 then unlines (unwordsN 5 xs)
                                        else s

  unwordsN n xs = let (ns,ms) = splitAt n xs
                  in unwords ns : if null ms then [] else unwordsN n ms

  setFlag []     = []
  setFlag (c:cs) = if c `elem` "+-" then '~':cs else c:cs

  showOnOff b = if b then "+" else "-"
demand:
no demanded arguments
deterministic:
deterministic operation
failfree:
<FAILING>
indeterministic:
referentially transparent operation
infix:
no fixity defined
iotype:
{(_) |-> _}
name:
showCurrentOptions
precedence:
no precedence defined
result-values:
_
signature:
REPL.State.ReplState -> String
solution-complete:
operation might suspend on free variables
terminating:
possibly non-terminating
totally-defined:
possibly non-reducible on same data term