Copyright | (c) Justin Le 2018 |
---|---|
License | BSD3 |
Maintainer | justin@jle.im |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
See source for examples of using type-level lenses from Data.Type.Lens.
Synopsis
- type SetExample = Set L1_ True '("hello", 6)
- type ViewExample = View L2_ '("hello", 6)
- type ToExample = View (To_ SndSym0) '("hello", 6)
- type OverExample = Over L2_ NotSym0 '("hello", True)
- type TraversalExample = Over Traverse_ NotSym0 '[True, False, False]
- type NestedExample = View (L2_ .@ L1_) '("hello", '(6, False))
- type FoldExample = ToListOf (Traverse_ .@ L1_) '['("hello", True), '("world", False), '("curry", False)]
- type UnsafeExample = UnsafePreview Traverse_ '[]
- type IxExample = Set (IxList_ (S Z)) "haskell" '["hello", "world", "curry"]
- type CloneExample l = View (CloneLens_ l) (Over (CloneLens_ l) NotSym0 '(True, False))
- type SetExample' = '("hello", 6) & (L1_ .~ True)
- type ViewExample' = '("hello", 6) ^. L2_
- type ToExample' = '("hello", 6) ^. To_ SndSym0
- type OverExample' = '("hello", True) & (L2_ %~ NotSym0)
- type TraversalExample' = '[True, False, False] & (Traverse_ %~ NotSym0)
- type NestedExample' = '("hello", '(6, False)) ^. (L2_ .@ L1_)
- type FoldExample' = '['("hello", True), '("world", False), '("curry", False)] ^.. (Traverse_ .@ L1_)
- type IxExample' = '["hello", "world", "curry"] & (IxList_ (S Z) .~ "haskell")
- type UnsafeExample' = '[] ^?! Traverse_
- type CloneExample' l = ('(True, False) & (CloneLens_ l %~ NotSym0)) ^. CloneLens_ l
Prefix functions
type ViewExample = View L2_ '("hello", 6) Source #
>>>
:kind! ViewExample
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 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 ViewExample' = '("hello", 6) ^. L2_ Source #
type FoldExample' = '['("hello", True), '("world", False), '("curry", False)] ^.. (Traverse_ .@ L1_) Source #
type UnsafeExample' = '[] ^?! Traverse_ Source #
type CloneExample' l = ('(True, False) & (CloneLens_ l %~ NotSym0)) ^. CloneLens_ l Source #