gsdlab / clafer

Clafer is a lightweight modeling language
http://clafer.org
MIT License
45 stars 13 forks source link

Lens #46

Closed mantkiew closed 10 years ago

mantkiew commented 10 years ago

Added support for lenses and generics using the lens package. Added parsing of scopes (using lenses). Fixed building on MacOS. Attributed feature models check and duplicate names check properly fails in negative test suite.

mantkiew commented 10 years ago

Jimmy, there are many changes, but most important for you to see is the Intclafer.hs.

JLiangWaterloo commented 10 years ago

I looked over the changes. Changes to IntClafer.hs make sense to me to preserve as much backwards compatibility as possible. Most of the other changes are mechanical.

The only part that doesn't make sense to me is this line of code:

allClafers = universeOn biplate iModule

How does it know to find IClafer's? There isn't much documentation online about Plated. Is there some doc you can point me to?

mantkiew commented 10 years ago

So, when we say

allClafers :: [ IClafer ]
allClafers = universeOn biplate iModule

it finds IClafers based on the type of allClafers. That's why we are now deriving Data and Typeable - support for generics.

JLiangWaterloo commented 10 years ago

I think it's okay to merge? The changes look very safe and conservative.

Where did you learn about the Plated stuff? I would like to read some (beginners) material on it because right now it feels like magic.

mantkiew commented 10 years ago

Generics in lens is based on Neil Mitchell's Uniplate so all tutorials/examples are relevant. Also, I got some help on IRC :-) But, unfortunately, I cannot point to a great tutorial. I have already asked Gabriel Gonzalez to add a piece about Plated to his great tutorial.