chr-data-0.1.0.1: Datatypes required for chr library

Safe HaskellNone
LanguageHaskell2010

CHR.Data.Lens.MicroLens

Contents

Description

Minimal redefine + re-export of a lens package, fclabels

Synopsis

Documentation

type (:->) a b = Lens' a b Source #

type Lens a b = Lens' a b Source #

Access

(^*) :: (a :-> b) -> (b :-> c) -> a :-> c infixl 9 Source #

composition alias

(^.) :: s -> Getting a s a -> a infixl 8 #

(^.) applies a getter to a value; in other words, it gets a value out of a structure using a getter (which can be a lens, traversal, fold, etc.).

Getting 1st field of a tuple:

(^. _1) :: (a, b) -> a
(^. _1) = fst

When (^.) is used with a traversal, it combines all results using the Monoid instance for the resulting type. For instance, for lists it would be simple concatenation:

>>> ("str","ing") ^. each
"string"

The reason for this is that traversals use Applicative, and the Applicative instance for Const uses monoid concatenation to combine “effects” of Const.

A non-operator version of (^.) is called view, and it's a bit more general than (^.) (it works in MonadReader). If you need the general version, you can get it from microlens-mtl; otherwise there's view available in Lens.Micro.Extras.

getL :: (f :-> a) -> f -> a Source #

Alias for get to avoid conflict with state get; not happy choice because of getl

(^=) :: (a :-> b) -> b -> a -> a infixr 4 Source #

functional setter, which acts like a field assigner

(^$=) :: (a :-> b) -> (b -> b) -> a -> a infixr 4 Source #

functional modify

(=:) :: MonadState f m => (f :-> o) -> o -> m () infixr 4 Source #

monadic set

(=$:) :: MonadState f m => (f :-> o) -> (o -> o) -> m () infixr 4 Source #

monadic modify & set

modifyAndGet :: MonadState f m => (f :-> o) -> (o -> (a, o)) -> m a Source #

monadic modify & set & get

(=$^:) :: MonadState f m => (f :-> o) -> (o -> (a, o)) -> m a infixr 4 Source #

monadic modify & set & get

modL :: MonadState f m => (f :-> o) -> (o -> (a, o)) -> m a Source #

monadic modify & set & get

getl :: MonadState f m => (f :-> o) -> m o Source #

monadic get

Misc

Tuple accessors

fstl :: Lens (a, b) a Source #

sndl :: Lens (a, b) b Source #

fst3l :: Lens (a, b, c) a Source #

snd3l :: Lens (a, b, c) b Source #

trd3l :: Lens (a, b, c) c Source #

Wrappers

isoMb :: String -> (f :-> Maybe o) -> f :-> o Source #

Wrapper around a Maybe with an embedded panic in case of Nothing, with a panic message

isoMbWithDefault :: o -> (f :-> Maybe o) -> f :-> o Source #

Wrapper around a Maybe with a default in case of Nothing