diff --git a/examples/CustomInspect/OpaqueTypes.roc b/examples/CustomInspect/OpaqueTypes.roc index 624f4d1..2566845 100644 --- a/examples/CustomInspect/OpaqueTypes.roc +++ b/examples/CustomInspect/OpaqueTypes.roc @@ -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}" diff --git a/examples/EncodeDecode/main.roc b/examples/EncodeDecode/main.roc index 0b4eca2..8915415 100644 --- a/examples/EncodeDecode/main.roc +++ b/examples/EncodeDecode/main.roc @@ -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, []))