@@ -13,32 +13,14 @@
1313-----------------------------------------------------------------------------
1414-- |
1515-- Module : Data.Generic.Product.HasFieldAt
16−-- Copyright : (C) 2017 Toby Shaw
16+-- Copyright : (C) 2017 Csongor Kiss
1717-- License : BSD3
18−-- Maintainer : Toby Shaw <toby.shaw.96@gmail.com>
18+-- Maintainer : Csongor Kiss <kiss.csongor.kiss@gmail.com>
1919-- Stability : experimental
2020-- Portability : non-portable
2121--
2222-- Derive product items lenses generically.
2323--
24−-----------------------------------------------------------------------------
25−
26−module Data.Generic.Product.HasFieldAt
27− ( -- * Lens
28− -- $example
29− HasFieldAt (..)
30− -- * Getter and setter functions
31− , getFieldAt
32− , setFieldAt
33− ) where
34−
35−import Data.Generic.Internal.Lens
36−
37−import GHC.TypeLits
38−import Data.Kind (Type)
39−import GHC.Generics
40−
41−-- $example
4224-- @
4325--
4426-- module Example where
@@ -53,6 +35,21 @@ import GHC.Generics
5335-- human = Human \"Tunyasz\" 50 \"London\"
5436--
5537-- @
38+--
39+-----------------------------------------------------------------------------
40+
41+module Data.Generic.Product.HasFieldAt
42+ ( HasFieldAt (..)
43+ -- * Getter and setter functions
44+ , getFieldAt
45+ , setFieldAt
46+ ) where
47+
48+import Data.Generic.Internal.Lens
49+
50+import GHC.TypeLits
51+import Data.Kind (Type)
52+import GHC.Generics
5653
5754-- | Get positional field
5855--
@@ -73,11 +70,6 @@ class HasFieldAt (index :: Nat) a s | s index -> a where
7370 -- ^ Lens focusing on a field at a given index.
7471 -- Compatible with the lens package.
7572 --
76− -- @
77− -- type Lens' s a
78− -- = forall f. Functor f => (a -> f a) -> s -> f s
79− -- @
80− --
8173 -- >>> human & itemAt @1 .~ "Tamas"
8274 -- Human "Tamas" 50 "London"
8375 itemAt :: Lens' s a