DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Yufan Lou
Yufan Lou

Posted on

Lens in 2007

Making Haskell nicer for game programming | Luke Palmer

Luke described in this 2007 blog post an Accessor type:

data Accessor a
    = Accessor { readVal :: Game a
               , writeVal :: a -> Game ()
               }

And used C macro to generate this for each field, and defined some familiar operators for it.

Nowadays the lens library is the most popular implementation of this pattern, and Template Haskell is used for generating the field lenses. The first version of the lens library was uploaded to Hackage in 2012. There might be even older examples of this pattern.

How long does it take for a spark of ingenuity like this to develop into a field of research? How long then does it take for the research to become mature applied library? How much is it worth to do so?

Top comments (0)

🌚 Browsing with dark mode makes you a better developer by a factor of exactly 40.

It's a scientific fact.