<html><head></head><body>Yes, except you have been constructing a Void value in Haskell (it's just always bottom); that's why you got a compiler warning.<div style='white-space: pre-wrap'><br>Sent from my phone with K-9 Mail.</div><br><br><div class="gmail_quote">On 1 November 2021 17:31:10 UTC, "Markus Läll" <markus.l2ll@gmail.com> wrote:<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div dir="ltr"><div dir="ltr">Got it! I think I've found another way to think about this:</div><div>- Void is a type-level empty: you can't even construct it</div><div>- () is a value-level empty: you can construct it but the information content of the value is empty<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Nov 1, 2021 at 7:04 PM Tom Ellis <<a href="mailto:tom-lists-haskell-cafe-2017@jaguarpaw.co.uk">tom-lists-haskell-cafe-2017@jaguarpaw.co.uk</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">Ah, I think you really do want () there then, not Void.  Void you<br>
*can* use.  In fact you can use it to make anything!<br>
<br>
    absurd :: Void -> a<br>
<br>
() you can't really use because you can't use it to make anything that<br>
wasn't there in the first place.<br>
<br>
Tom<br>
<br>
On Mon, Nov 01, 2021 at 06:58:16PM +0200, Markus Läll wrote:<br>
> My use of Void is similar to your example: it's a polymorphic field that I<br>
> don't want to be able to use sometimes, and with Void I thought I wouldn't<br>
> (at the value level, that is), but as you say I shouldn't be able to<br>
> construct it either (which I do want to do). In short, what I wanted to<br>
> remind myself was that this field is empty, and it seemed a better<br>
> candidate than the unit as the unit I could handle at runtime. But perhaps<br>
> the correct solution is to refactor the type into separate data types<br>
> instead.<br>
> <br>
> On Mon, Nov 1, 2021 at 4:23 PM Tom Ellis <<br>
> <a href="mailto:tom-lists-haskell-cafe-2017@jaguarpaw.co.uk" target="_blank">tom-lists-haskell-cafe-2017@jaguarpaw.co.uk</a>> wrote:<br>
> <br>
> > On Mon, Nov 01, 2021 at 04:07:02PM +0200, Markus Läll wrote:<br>
> > > Would it make sense to suppress the "fields of ... not initialized" when<br>
> > > the type of the field is Void, or any other type with no data<br>
> > constructors?<br>
> > > As the only way to construct void would be `undefined :: Void`, and the<br>
> > > field already is undefined.<br>
> ><br>
> > It makes the opposite of sense to me.  The warning is there to tell<br>
> > you when you've failed to initialize a field.  Whether you *can't*<br>
> > initialise a field because its type has no values makes no difference.<br>
> > You're still not initialising it!<br>
> ><br>
> > I sometimes use a polymorphic field to indicate whether a constructor<br>
> > can be present or not.  For example<br>
> ><br>
> > data Expr a = Zero | One | Sum Expr Expr | Product a Expr Expr<br>
> ><br>
> > Now `type ProductExpr = Expr ()` is an `Expr` which might contain<br>
> > `Product`s. `type NoProductExpr = Expr Void` is an `Expr` which<br>
> > cannot because I "can't" write a `Product` constructor for it (at<br>
> > least not without getting a warning).<br>
> ><br>
> > I'm curious: how come you're in the situation where you need to fill<br>
> > in product types with `Void` entries?<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.</blockquote></div><br clear="all"></div></blockquote></div></body></html>