Closed recursion-ninja closed 5 years ago
Document what each custom exit code means in the PCG help menu.
Unfortunately, this was more involved than anticipated and there has been some scope-creep when attempting to make the changes consistent and well-typed.
pcg-error-phase
:
pcg-validationT
:
pcg-file-source
:
Data.FileSource
into separate file-source libraryInputStreamError
hereOutputStreamError
Data.FileSource.IO
readFile :: FileSource -> ValidationT InputStreamError IO Text
serializeBinary :: FileSource -> ValidationT InputStreamError IO a
serializeCompact :: FileSource -> ValidationT InputStreamError IO a
deserializeBinary :: FileSource -> a -> ValidationT OutputStreamError IO ()
derializeCompact :: FileSource -> a -> ValidationT OutputStreamError IO ()
appendFile :: FileSource -> Text -> ValidationT OutputStreamError IO ()
writeFile :: FileSource -> Text -> ValidationT OutputStreamError IO ()
writeFileWithMove :: FileSource -> Text -> ValidationT OutputStreamError IO ()
pcg
:
PCG.Load
to use Data.FileSource.IO.deserializeBinary/deserializeCompact
PCG.Save
to use Data.FileSource.IO.serializeBinary/serializeCompact
PCG.Report
to use Data.FileSource.IO.appendFile/writeFile/writeFileWithMove
PCG.Report
to collect OutputStreamErrors
when writing to multiple streamsPCG.Read
to collect InputStreamErrors
when reading to multiple streamsMain
to use Data.FileSource.IO.readFile
for reading input scripts--exitcodes
flag to print exit code documentationCHANGELOG.md
:
1024
small files at once.Text
from disk.TextShow
instances to render error messages without escaped strings in the output.I decided not to add an integration test of opening 1024
small files at once. The files all open successfully, but there appears to be efficiency issues associated with that many character blocks.
Profiling and remedying this efficiency issue is beyond the scope of this issue.
This has been completed, see 4db324b.
We can use different
ExitCode
values to indicate the different types of failure that can occur during our computation.There are very refined failure types in the following modules:
PCG.Command.Read.Unification.UnificationError
PCG.Command.Read.ReadError
Each one of these error conditions could receive a special ExitCode value to be checked after the program completes. The benifit of this is that we can check the
ExitCode
value in our integration test suite to ensure that certain expected failure occur, and not just that "any" failure has occurred.This change will require a little bit of tinkering with the
EvalUnit
type. TheError
constructor should contain anInt8
for theExitCode
value. Thefail
function should supply a defaultExitCode
value. We will export a new functionfailWith :: Int8 -> String
to allow for failing with a specific exit code in theEvaluationT
monadic context.