felixvisee / Pistachio

Generic model framework
MIT License
164 stars 9 forks source link

Eliminate a few Lens type annotations #4

Closed jspahrsummers closed 9 years ago

jspahrsummers commented 9 years ago

One of my initial reactions to Pistachio (besides, “fuck yeah lenses”) was a bit of disappointment at the number of type annotations required, since I hate to duplicate anything for the compiler.

However, I didn't realize that the level of annotation given in the README is actually overkill, and that less will still compile perfectly fine.

So, in short, this is an opinionated change intended to counteract the sort of reaction that I had, by reducing code/type duplication in the README and some of Pistacho's tests. Feel free to accept or reject it! :smile:

felixvisee commented 9 years ago

My intention was to provide some additional documentation in the README by explicitly specifying more types than necessary. However, I do see your point and will happily accept your contributions, especially because I consider the resulting code to be of better quality. What do you think about the other type annotations?

felixvisee commented 9 years ago

btw, kind of related, you may like the part about improving maintainability of lenses for immutable models by defining a copy function, similar to Scala's copy method on case classes, in this short post.

jspahrsummers commented 9 years ago

What do you think about the other type annotations?

Some of the others couldn't be inferred reliably. :confused:

I didn't run through everything in the README, but I avoided anything that I didn't know could be inferred by the compiler.

felixvisee commented 9 years ago

Ok, thanks!