[Haskell-cafe] Instance deriving for Void types.

Lyndon Maydwell maydwell at gmail.com
Tue Oct 29 04:40:29 UTC 2013


The use case I'm interested in is for exploratory programming, I define a
type-driven compositional data-flow, and use void types until I'm ready to
start filling in the gaps. Some data-dependencies may require class
instances, and for this I currently use a stand-alone instance with
undefined definitions.

Maybe there's a better way to go about this though?


On Tue, Oct 29, 2013 at 3:31 PM, AntC <anthony_clayden at clear.net.nz> 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.
>
> AntC
>
> >
> > I guess the obvious one would be Show.
> >
> > data Nada deriving Show
> >
> > {*
> > instance Show Nada where
> >   show _ = undefined
> > *}
> >
>
> _______________________________________________
> 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/6864f471/attachment.html>


More information about the Haskell-Cafe mailing list