CurryInfo: currypath-3.0.0 / System.CurryPath.setCurryPath

definition:
 
setCurryPath :: Bool -> String -> IO ()
setCurryPath quiet cpmexec = do
  cp <- getEnv "CURRYPATH"
  if null cp
    then
      (if null cpmexec then getFileInPath "cypm" else return (Just cpmexec)) >>=
      maybe
        (return ())
        (\cpm -> do
          putStrLnNQ $
            "Computing CURRYPATH with '" ++ cpm ++ "'..."
          (rc,out,err) <- evalCmd cpm ["deps","--path"] ""
          if rc==0
            then do let cpath = strip out
                    putStrLnNQ $ "CURRYPATH=" ++ cpath
                    setEnv "CURRYPATH" cpath
            else putStrLn $ "ERROR during computing CURRYPATH with 'cypm':\n"
                                ++ out ++ err )
    else putStrLnNQ $ "CURRYPATH=" ++ cp
 where
  putStrLnNQ s = unless quiet $ putStrLn s

  -- Remove leading and trailing whitespace
  strip = reverse . dropWhile isSpace . reverse . dropWhile isSpace
demand:
 no demanded arguments
deterministic:
 deterministic operation
documentation:
 
If the environment variable `CURRYPATH` is not already set
(i.e., not null), set it to the value computed by `cypm deps --path`
in order to allow invoking tools without `cypm exec ...`.
If the first argument is `False`, the computed path value is printed.
If the second argument is not null, its value is taken as the executable
for CPM, otherwise the executable `cypm` is searched in the current path
(environment variable `PATH`).
failfree:
 <FAILING>
indeterministic:
 referentially transparent operation
infix:
 no fixity defined
iotype:
 {(_,_) |-> _}
name:
 setCurryPath
precedence:
 no precedence defined
result-values:
 _
signature:
 Prelude.Bool -> String -> Prelude.IO ()
solution-complete:
 operation might suspend on free variables
terminating:
 possibly non-terminating
totally-defined:
 possibly non-reducible on same data term