<div dir="ltr"><div>Have you tried Multiplate?</div><div><br></div><div>If Multiplate is not powerful enough and you're willing to make your types more complex, have a look at deep-transformations.<br></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, May 24, 2021 at 4:52 PM Richard Yu <<a href="mailto:richardyu042@gmail.com">richardyu042@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">I have a question about generic traversal/transformation of nested data structures. From what I understand the main options available are SYB, Uniplate, GHC.Generics and Data.Lens (although I am under the impression this requires record types). The data structure I am attempting to traverse is similar to this simplified version:<br><br>data SExpr = Expr | Const<br>data Const = B bool | I int<br>data Expr  = Lambda String SExpr | If Expr ...<br><br>I have attempted to use Uniplate and GHC.Generics to traverse the built AST and modify for example, the string of a Lambda type, but have not been able to figure out how to get any of the libraries to typecheck. The examples or docs I found were not quite enough. Does anyone know of examples that might help or explain how I should be using the generic libraries? <br>In addition if I moved to writing the AST with GADTs, do some generic traversal strategies/libraries stop working? <br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Many thanks,<br>Richard<br><br><br><br></div><br><br></div>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
To (un)subscribe, modify options or view archives go to:<br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
Only members subscribed via the mailman list are allowed to post.</blockquote></div>