[Haskell-cafe] Instance deriving for Void types.

Lyndon Maydwell maydwell at gmail.com
Tue Oct 29 09:10:08 UTC 2013


Hey that's a great idea!


On Tue, Oct 29, 2013 at 7:18 PM, Tom Ellis <
tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk> wrote:

> On Tue, Oct 29, 2013 at 04:31:49AM +0000, AntC wrote:
> > > Lyndon Maydwell <maydwell <at> gmail.com> writes:
> > >
> > > I was wondering if it's possible to have automatic deriving
> > > for some classes for the Void type. ...
> >
> > Hi Lyndon, I'm struggling to see any use case for that.
> >
> > You'd 'achieve' `show (undefined :: Nada)` crashing your program at run-
> > time; rather than failing to compile (if you didn't have the instance).
> >
> > Just bite the bullet and give your Void type a constructor.
>
> It was considered a worthwhile enough idea to add a Show instance to the
> "void" package
>
>     http://hackage.haskell.org/package/void-0.6.1/docs/Data-Void.html
>
> (where the instance was written by hand, of course, not derived).
>
> Lyndon: perhaps
>
>     import Data.Void
>
>     newtype Nada = Nada Void deriving (Show)
>
> will suit you use case.
>
> Tom
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20131029/96d4da19/attachment.html>


More information about the Haskell-Cafe mailing list