[Haskell-cafe] Re: Implicit newtype unwrapping
Joachim Breitner
mail at joachim-breitner.de
Thu Dec 3 16:39:24 EST 2009
Hi,
Am Donnerstag, den 03.12.2009, 10:22 -0800 schrieb yairchu at gmail.com:
> > I guess TH could probably do this.
>
> I think this does what you wish for:
> http://hackage.haskell.org/packages/archive/peakachu/0.2/doc/html/Data-Newtype.html
>
> Example:
> > $(mkWithNewtypeFuncs [2] ''ZipList)
> > withZipList2 (<*>) [(+3), (*3)] [6, 7]
> [9, 21]
> > $(mkInNewtypeFuncs [2] ''ZipList)
> > getZipList $ inZipList2 (++) (ZipList "hello ") (ZipList "world")
> > "hello world"
>
> in some future this won't be in this unrelated "peakachu" package, and
> be incorporated into Neil M's derive.
> but for now this is where you can find it.
Nice, and close. It seems it does not handle the datatype in arbitrary
positions in the type (as in Foo -> ( a -> Either Foo ())) -> (Foo,
())). But thanks for the pointer. Maybe I should give it a shot.
Greetings,
Joachim
--
Joachim Breitner
e-Mail: mail at joachim-breitner.de
Homepage: http://www.joachim-breitner.de
ICQ#: 74513189
Jabber-ID: nomeata at joachim-breitner.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20091203/37b93693/attachment.bin
More information about the Haskell-Cafe
mailing list