[Haskell-cafe] Instance deriving for Void types.
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
> (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.
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe