[Haskell-cafe] [ANN] anonymous-sums
Roman Cheplyaka
roma at ro-che.info
Fri Feb 14 07:01:24 UTC 2014
* adam vogt <vogt.adam at gmail.com> [2014-02-13 19:51:34-0500]
> On Thu, Feb 13, 2014 at 4:36 PM, Omari Norman <omari at smileystation.com>
> wrote:
> >
> > If there is already something like this out there (or some elegant way
> > to do this that doesn't involve hairy extensions), please let me know
> > and I will be all too happy to deprecate this.
> >
> > Omari
>
> Hi Omari,
>
> You could use:
>
> type S3 a b c = (Maybe a, Maybe b, Maybe c)
>
> And then prove to yourself that only one entry is Just. This lets you use
> of classes that work with tuples such as Field1 through Field9 from lens or
> things from http://hackage.haskell.org/package/tuple.
>
> At least that's the strategy in <
> http://hackage.haskell.org/package/HList-0.3.2.0/docs/Data-HList-Variant.html
> >.
Yes, this solution is highly recommended... by @EvilHaskellTips :-)
https://twitter.com/EvilHaskellTips/status/433403451054096384
Roman
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140214/3669360d/attachment-0001.sig>
More information about the Haskell-Cafe
mailing list