ekmett/lens — pull request #378 by maxpow4h (2014-01-11 09:09:43+00:00)
Title: Added inferableLenses

If a lens' fields have all unique types, then we shouldn't need to specify which lens to use, as there is only one possible lens. We can now use `makeInferableLenses` instead of `makeLenses` if the data type satisfies this property.

Now we can infer the lens to use by using the new `(???)` value.

For example:

```hs
{-# LANGUAGE TemplateHaskell, FlexibleInstances, MultiParamTypeClasses, UndecidableInstances #-}
module SingLens where

import Control.Lens

data Foo = Foo { _bar :: String, _baz :: Int } deriving Show
makeInferableLenses ''Foo

-- | f
-- >>> f
-- Foo {_bar = "four", _baz = 3}
f :: Foo
f = Foo "four" 3

-- | g
-- >>> g
-- "four"
g :: String
g = view (???) f

-- | h
-- >>> h
-- 3
h :: Int
h = view (???) f

-- | i
-- >>> i
-- Foo {_bar = "bar", _baz = 3}
i :: Foo
i = set (???) "bar" f
```