
Another possibility is to write something like: main = do [addr, port] <- pure args ... This is desugared in terms of `fail` rather than `error`, so it will also do the right thing in the `Maybe` monad. Though of course this only works in do-notation. -- Teo On Thu, 26 Jan 2023, 09:35 Henning Thielemann, < lemming@henning-thielemann.de> wrote:
On Thu, 26 Jan 2023, Kazu Yamamoto (山本和彦) via Haskell-Cafe wrote:
Even if this example is not appearing to you, there are a lot of situations of this kind in practical code.
I know. Each of this is an occasion to think about more appropriate types, such that only valid values can be represented._______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.