Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/CustomInspect/OpaqueTypes.roc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ main! = |_| {
### start snippet secret
CreditCard :: Str.{
create = |nb| CreditCard.(nb)
to_inspect : CreditCard -> Str
to_inspect = |CreditCard.(nb)| {
last_four_digits = nb.to_utf8().take_last(4) |> Str.from_utf8 ?? "****" # Note: do not use this default in production. If your credit card string cannot be converted to utf8 you should fail loudly.
"**** **** **** ${last_four_digits}"
Expand Down
1 change: 1 addition & 0 deletions examples/EncodeDecode/main.roc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ ItemKind := [
].{
is_eq : _ # enable the default is_eq implementation

to_inspect : ItemKind -> Str
to_inspect = |ItemKind.(item_kind)| "ItemKind.(${Str.inspect(item_kind)})"

encoder_for : encoding -> (ItemKind, state -> Try(state, []))
Expand Down
Loading