[Haskell-cafe] ANNOUNCE: Multiplate 0.0.1

Balázs Endrész balazs.endresz at gmail.com
Fri Mar 25 12:33:54 CET 2011


Hi all, I made a little extension that makes it a bit easier to work with
Multiplate, there's a detailed explanation here:
http://hackage.haskell.org/package/multiplate-simplified

However, there's still some biolerplate that could be eliminated but I can't
seem to do it nicely. When writing a Multiplate instance one has define a
method called mkPlate:

mkPlate build = Plate (build pProg) (build pDecl) (build pExpr) (build pVar)

by using my package all arguments for Plate can be the same:

mkPlate build = Plate
 (build $ getProjector undefined undefined)
 (build $ getProjector undefined undefined)
 (build $ getProjector undefined undefined)
 (build $ getProjector undefined undefined)

but the following doesn't work:

withProj build = build $ getProjector undefined undefined

mkPlate build = Plate
 (withProj build)
 (withProj build)
 (withProj build)
 (withProj build)

neither does this one, though it gives a less scary error message:

mkPlate build = Plate withProj withProj withProj withProj
 where
  withProj = build $ getProjector undefined undefined


All the code necessary to test this is included at the end of the source of
the modules's hackage page.


Also, there's a probably similar issue if I define functions from Multiplate
like this:

makeG funcFor = \ f a -> funcFor (getProjector f a) f a
gtraverseFor  = makeG traverseFor

but this one works:

gtraverseFor :: (IsProjector p a) => p Identity -> a -> a
gtraverseFor f a = traverseFor (getProjector f a) f a


On Sat, Nov 20, 2010 at 04:45, <roconnor at theorem.ca> wrote:

> Multiplate is a lightweight generic library for mutually recursive data
> types that won't make Conor lose his lunch.
>
> Multiplate is an alternative extension of the Uniplate/Compos core design
> to support mutually recursive datatypes in a way that is as powerful as
> Compos, almost as easy to use as Uniplate, and more portable than both of
> them.
>
> Multiplate does not require you to rewrite your data type, does not require
> run-time reflection, does not require GADTs, and does not even require
> multi-parameter type classes. It only requires rank 3 polymorphism.
>
> <http://hackage.haskell.org/package/multiplate-0.0.1>
>
> A more detailed paper is forthcoming, but the library is available to try
> right now.
>
> --
> Russell O'Connor                                      <http://r6.ca/>
> ``All talk about `theft,''' the general counsel of the American Graphophone
> Company wrote, ``is the merest claptrap, for there exists no property in
> ideas musical, literary or artistic, except as defined by statute.''
> _______________________________________________
> 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/20110325/ac1a20de/attachment.htm>


More information about the Haskell-Cafe mailing list