improve benchmark error handling, bugfixes

This commit is contained in:
Anton-4 2023-04-18 15:19:58 +02:00
parent 65ebeab303
commit 8861c9394a
No known key found for this signature in database
GPG key ID: 0971D718C0A9B937
7 changed files with 86 additions and 45 deletions

View file

@ -5,9 +5,10 @@ app "quicksortapp"
main : Task.Task {} []
main =
Task.after
Task.getInt
\n ->
inputResult <- Task.attempt Task.getInt
when inputResult is
Ok n ->
unsortedList =
if n == 0 then
# small unsorted list of 20 elements (0-9)
@ -20,6 +21,10 @@ main =
|> Quicksort.show
|> Task.putLine
Err GetIntError ->
Task.putLine "Error: Failed to get Integer from stdin."
sort : List I64 -> List I64
sort = \list ->
Quicksort.sortWith list (\x, y -> Num.compare x y)