@@ -13,32 +13,14 @@
13-----------------------------------------------------------------------------
13-----------------------------------------------------------------------------
15-- Module : Data.Generic.Product.HasFieldAt
15-- Module : Data.Generic.Product.HasFieldAt
16−-- Copyright : (C) 2017 Toby Shaw
16+-- Copyright : (C) 2017 Csongor Kiss
17-- License : BSD3
17-- License : BSD3
18−-- Maintainer : Toby Shaw <toby.shaw.96@gmail.com>
18+-- Maintainer : Csongor Kiss <kiss.csongor.kiss@gmail.com>
19-- Stability : experimental
19-- Stability : experimental
20-- Portability : non-portable
20-- Portability : non-portable
22-- Derive product items lenses generically.
22-- Derive product items lenses generically.
24−-----------------------------------------------------------------------------
26−module Data.Generic.Product.HasFieldAt
30− -- * Getter and setter functions
35−import Data.Generic.Internal.Lens
38−import Data.Kind (Type)
44-- module Example where
26-- module Example where
@@ -53,6 +35,21 @@ import GHC.Generics
53-- human = Human \"Tunyasz\" 50 \"London\"
35-- human = Human \"Tunyasz\" 50 \"London\"
39+-----------------------------------------------------------------------------
41+module Data.Generic.Product.HasFieldAt
43+ -- * Getter and setter functions
48+import Data.Generic.Internal.Lens
51+import Data.Kind (Type)
57-- | Get positional field
54-- | Get positional field
@@ -73,11 +70,6 @@ class HasFieldAt (index :: Nat) a s | s index -> a where
73 -- ^ Lens focusing on a field at a given index.
70 -- ^ Lens focusing on a field at a given index.
74 -- Compatible with the lens package.
71 -- Compatible with the lens package.
78− -- = forall f. Functor f => (a -> f a) -> s -> f s
81 -- >>> human & itemAt @1 .~ "Tamas"
73 -- >>> human & itemAt @1 .~ "Tamas"
82 -- Human "Tamas" 50 "London"
74 -- Human "Tamas" 50 "London"
83 itemAt :: Lens' s a
75 itemAt :: Lens' s a