1{-# LANGUAGE AllowAmbiguousTypes #-}
2{-# LANGUAGE FlexibleInstances #-}
3{-# LANGUAGE FunctionalDependencies #-}
4{-# LANGUAGE MonoLocalBinds #-}
5{-# LANGUAGE MultiParamTypeClasses #-}
6{-# LANGUAGE PolyKinds #-}
7{-# LANGUAGE ScopedTypeVariables #-}
8{-# LANGUAGE TypeApplications #-}
9{-# LANGUAGE UndecidableInstances #-}
11-----------------------------------------------------------------------------
13-- Module : Data.Generics.Product.Any
14-- Copyright : (C) 2017 Csongor Kiss
16-- Maintainer : Csongor Kiss <kiss.csongor.kiss@gmail.com>
17-- Stability : experimental
18-- Portability : non-portable
20-- Derive a variety of lenses generically.
22-----------------------------------------------------------------------------
24module Data.Generics.Product.Any
31import Data.Generics.Internal.Lens
32import Data.Generics.Product.Fields
33import Data.Generics.Product.Positions
34import Data.Generics.Product.Typed
38-- module Example where
40-- import Data.Generics.Product
48-- deriving (Generic, Show)
51-- human = Human \"Tunyasz\" 50 \"London\"
54-- |Records that have generic lenses.
55class HasAny (sel :: k) a s | s sel k -> a where
56 -- |A lens that focuses on a part of a product as identified by some
57 -- selector. Currently supported selectors are field names, positions and
58 -- unique types. Compatible with the lens package's 'Control.Lens.Lens'
61 -- >>> human ^. the @Int
63 -- >>> human ^. the @"name"
65 -- >>> human ^. the @3
69instance HasPosition i a s => HasAny i a s where
72instance HasField field a s => HasAny field a s where
75instance HasType a s => HasAny a a s where
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list