lens-typelevel-0.1.1.0: Type-level lenses using singletons

Copyright(c) Justin Le 2018
LicenseBSD3
Maintainerjustin@jle.im
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Data.Type.Lens.Example

Contents

Description

See source for examples of using type-level lenses from Data.Type.Lens.

Synopsis

Prefix functions

type SetExample = Set L1_ True '("hello", 6) Source #

>>> :kind! SetExample
'( 'True, 6 )

type ViewExample = View L2_ '("hello", 6) Source #

>>> :kind! ViewExample
6

type ToExample = View (To_ SndSym0) '("hello", 6) Source #

>>> :kind! ToExample
6

type OverExample = Over L2_ NotSym0 '("hello", True) Source #

>>> :kind! TraversalExample
'( "hello", 'False )

type TraversalExample = Over Traverse_ NotSym0 '[True, False, False] Source #

>>> :kind! TraversalExample
'[ 'False, 'True, 'True ]

type NestedExample = View (L2_ .@ L1_) '("hello", '(6, False)) Source #

>>> :kind! NestedExample
6

type FoldExample = ToListOf (Traverse_ .@ L1_) '['("hello", True), '("world", False), '("curry", False)] Source #

>>> :kind! FoldExample
'["hello", "world", "curry"]

type UnsafeExample = UnsafePreview Traverse_ '[] Source #

>>> :kind! UnsafeExample
Error "Failed indexing into empty traversal"

type IxExample = Set (IxList_ (S Z)) "haskell" '["hello", "world", "curry"] Source #

>>> :kind! IxExample
'["hello", "haskell", "curry"]

type CloneExample l = View (CloneLens_ l) (Over (CloneLens_ l) NotSym0 '(True, False)) Source #

>>> :kind! CloneExample L1_
'False
>>> :kind! CloneExample L2_
'True

Operators

type SetExample' = '("hello", 6) & (L1_ .~ True) Source #

type ViewExample' = '("hello", 6) ^. L2_ Source #

type ToExample' = '("hello", 6) ^. To_ SndSym0 Source #

type OverExample' = '("hello", True) & (L2_ %~ NotSym0) Source #

type NestedExample' = '("hello", '(6, False)) ^. (L2_ .@ L1_) Source #

type FoldExample' = '['("hello", True), '("world", False), '("curry", False)] ^.. (Traverse_ .@ L1_) Source #

type IxExample' = '["hello", "world", "curry"] & (IxList_ (S Z) .~ "haskell") Source #