Stream: beginners

Topic: Result type


view this post on Zulip Prajwal S N (Oct 12 2022 at 18:02):

What is the difference between a Result Str {} and Result Str *?

view this post on Zulip Ayaz Hafiz (Oct 12 2022 at 18:05):

The first means if it returns an Err, the error payload is an empty record. The latter means if the error payload is an unbound value (which in practice means it should not return an error)

view this post on Zulip Brendan Hansknecht (Oct 12 2022 at 18:32):

Really? I thought that Result Str * could mean Result Str []*. That would mean can return any error payload at all. I guess that is not the case?

view this post on Zulip Brian Carroll (Oct 12 2022 at 18:45):

Depends if it's an argument or a return value. If it's a return value that's compatible with any type, then it must never happen!

view this post on Zulip Brian Carroll (Oct 12 2022 at 18:46):

Because there is no real value that is compatible with all possible types

view this post on Zulip Brian Carroll (Oct 12 2022 at 18:46):

So if a function signature has this return type then it never returns the Err case

view this post on Zulip Brendan Hansknecht (Oct 12 2022 at 18:50):

Ok. makes sense.


Last updated: Jul 05 2025 at 12:14 UTC