Idris2/tests/chez/chez020/Popen.idr
Mathew Polzin fa06e9936b
Warn about unreachable default clauses (#1942)
* so much experimentation

* tests that show preliminary evidence the new stuff is working.

* small amount of cleanup

* more cleanup of various troubleshooting code.

* new test case added.

* only log unreachable indices if there are any.

* when traversing deeper simply skip over defaults since they have already been reviewed.

* Remove fallback clause that the changes in this PR correctly identified as unreachable.

* tidying up more.

* move some common functions to a new Core.Case.Util module.

* refer to case builder and case tree under new parent module.

* update imports to look for CaseTree in new submodule.

* update api ipkg

* remove unneeded application operators.

* remove or comment out unreachable default clauses caught by the changes in this PR.

* a bit of code documentation and renaming for clarity.

* bump previous version in CI.

* fix API usage of Util module.

* Add issue 1079 test cases.

* forgot to add new test cases file.

* remove commented-out lines by request of RefC author.

* Use a SortedSet instead of nubbing a list.

* update new case tree import.

* Update src/Core/Case/Util.idr

Co-authored-by: G. Allais <guillaume.allais@ens-lyon.org>

* remove function with nothing to offer above and beyond a differently named copy of the same code.

* replace a large tuple with a record; discover not all of the tuple's fields were needed.

* fix shadowing warning.

Co-authored-by: G. Allais <guillaume.allais@ens-lyon.org>
2021-10-02 12:55:21 +01:00

30 lines
823 B
Idris

import System
import System.File
import System.Info
import Data.List1
import Data.String
windowsPath : String -> String
windowsPath path =
let replaceSlashes : List Char -> List Char
replaceSlashes [] = []
replaceSlashes ('/' :: cs) = '\\' :: replaceSlashes cs
replaceSlashes (c :: cs) = c :: replaceSlashes cs
in
pack $ replaceSlashes (unpack path)
main : IO ()
main = do
Just cmd <- getEnv "POPEN_CMD"
| Nothing => putStrLn "POPEN_CMD env var not set"
let cmd = if isWindows then windowsPath cmd else cmd
Right fh <- popen cmd Read
| Left err => printLn err
putStrLn "opened"
Right output <- fGetLine fh
| Left err => printLn err
pclose fh
putStrLn "closed"
let (idris2 ::: _) = split ((==) ',') output
putStrLn idris2