From a700237426af8ed91823ea7efca7b058122b6e6a Mon Sep 17 00:00:00 2001 From: Taylor Fausak Date: Sat, 1 May 2021 19:11:56 +0000 Subject: [PATCH] Improve `tryVia` example --- src/lib/Witch/Utility.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib/Witch/Utility.hs b/src/lib/Witch/Utility.hs index db9481a..e65c4ce 100644 --- a/src/lib/Witch/Utility.hs +++ b/src/lib/Witch/Utility.hs @@ -130,7 +130,11 @@ tryInto = TryCast.tryCast -- the types in the 'TryCastException.TryCastException' can be tedious. -- -- > -- Avoid this: --- > fmap (tryFrom @u) . tryInto @u +-- > case tryInto @u x of +-- > Left _ -> Left ... +-- > Right y -> case tryFrom @u y of +-- > Left _ -> Left ... +-- > Right z -> ... -- > -- > -- Prefer this: -- > tryVia @u