-
-
Notifications
You must be signed in to change notification settings - Fork 320
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7466 from roc-lang/pi-test-updates
update benchmark platform to PI
- Loading branch information
Showing
21 changed files
with
660 additions
and
698 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,38 @@ | ||
module [fromBytes, fromStr, toBytes, toStr] | ||
module [from_bytes, from_str, to_bytes, to_str] | ||
|
||
import Base64.Decode | ||
import Base64.Encode | ||
|
||
# base 64 encoding from a sequence of bytes | ||
fromBytes : List U8 -> Result Str [InvalidInput] | ||
fromBytes = \bytes -> | ||
when Base64.Decode.fromBytes bytes is | ||
Ok v -> | ||
Ok v | ||
from_bytes : List U8 -> Result Str [InvalidInput] | ||
from_bytes = \bytes -> | ||
when Base64.Decode.from_bytes(bytes) is | ||
Ok(v) -> | ||
Ok(v) | ||
|
||
Err _ -> | ||
Err InvalidInput | ||
Err(_) -> | ||
Err(InvalidInput) | ||
|
||
# base 64 encoding from a string | ||
fromStr : Str -> Result Str [InvalidInput] | ||
fromStr = \str -> | ||
fromBytes (Str.toUtf8 str) | ||
from_str : Str -> Result Str [InvalidInput] | ||
from_str = \str -> | ||
from_bytes(Str.toUtf8(str)) | ||
|
||
# base64-encode bytes to the original | ||
toBytes : Str -> Result (List U8) [InvalidInput] | ||
toBytes = \str -> | ||
Ok (Base64.Encode.toBytes str) | ||
|
||
toStr : Str -> Result Str [InvalidInput] | ||
toStr = \str -> | ||
when toBytes str is | ||
Ok bytes -> | ||
when Str.fromUtf8 bytes is | ||
Ok v -> | ||
Ok v | ||
|
||
Err _ -> | ||
Err InvalidInput | ||
|
||
Err _ -> | ||
Err InvalidInput | ||
to_bytes : Str -> Result (List U8) [InvalidInput] | ||
to_bytes = \str -> | ||
Ok(Base64.Encode.to_bytes(str)) | ||
|
||
to_str : Str -> Result Str [InvalidInput] | ||
to_str = \str -> | ||
when to_bytes(str) is | ||
Ok(bytes) -> | ||
when Str.fromUtf8(bytes) is | ||
Ok(v) -> | ||
Ok(v) | ||
|
||
Err(_) -> | ||
Err(InvalidInput) | ||
|
||
Err(_) -> | ||
Err(InvalidInput) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.