<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Nov 30, 2021 at 2:20 PM Brandon Allbery <<a href="mailto:allbery.b@gmail.com">allbery.b@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Because the primary purpose of fail is to provide for failed pattern<br>
matches, which invoke it with a String representing the pattern match<br>
error.<br></blockquote><div><br></div><div>I see the purpose, but fail with just literal string is not very informative. <br></div><div>It is easier for debugging supplying an error message with Showable parameters. <br></div><div>Custom Prelude has show :: a - >Text so fail looks like:</div><div><br></div><div> oops -> fail $ "functionX is not implemented for " <> show oops</div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
On Tue, Nov 30, 2021 at 2:16 PM Daneel Yaitskov <<a href="mailto:dyaitskov@gmail.com" target="_blank">dyaitskov@gmail.com</a>> wrote:<br>
><br>
> Dear Cafe,<br>
><br>
> MonadFail.fail takes String.<br>
> I wasn't able to find MonadFail for custom error type.<br>
> Is there any proposals to base?<br>
><br>
> Let's say Data.Text, which gains popularity with OverloadedStrings extensions.<br>
><br>
> class MonadFail m where<br>
> fail :: String -> m a<br>
><br>
> Why not ?<br>
> class MonadFail m where<br>
> fail :: (forall s. IsString s => s) -> m a<br>
><br>
> class MonadFailWith m s where<br>
> fail :: s -> m a<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
> --<br>
><br>
> Best regards,<br>
> Daniil Iaitskov<br>
><br>
><br>
><br>
> _______________________________________________<br>
> Haskell-Cafe mailing list<br>
> To (un)subscribe, modify options or view archives go to:<br>
> <a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
> Only members subscribed via the mailman list are allowed to post.<br>
<br>
<br>
<br>
-- <br>
brandon s allbery kf8nh<br>
<a href="mailto:allbery.b@gmail.com" target="_blank">allbery.b@gmail.com</a><br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature"><br>Best regards,<br>Daniil Iaitskov<br> <br><br><br></div></div>