smash-optics-0.1.0.2: Optics for the `smash` library using `optics-core`
Copyright(c) 2020-2022 Emily Pillmore
LicenseBSD-style
MaintainerEmily Pillmore <emilypi@cohomolo.gy>
StabilityExperimental
PortabilityFlexibleInstances, MPTC, Type Families, UndecideableInstances
Safe HaskellNone
LanguageHaskell2010

Data.Smash.Optics

Description

Prisms and Traversals for the Smash datatype.

Synopsis

Isos

_SmashIso :: Iso (Smash a b) (Smash c d) (Maybe (a, b)) (Maybe (c, d)) Source #

A Iso between a smash product and pointed tuple.

Prisms

_Nada :: Prism' (Smash a b) () Source #

A Prism' selecting the Nada constructor.

Note: cannot change type.

_Smash :: Prism' (Smash a b) (a, b) Source #

A Prism' selecting the Smash constructor.

Note: cannot change type.

Traversals

smashed :: AffineTraversal (Smash a b) (Smash c d) (a, b) (c, d) Source #

An AffineTraversal of the smashed pair.

>>> over smashed (fmap pred) (Smash 1 2)
Smash 1 1
>>> over smashed id Nada
Nada

smashing :: IxTraversal Bool (Smash a a) (Smash b b) a b Source #

An IxTraversal of the smashed pair. Yes this is equivalent to each. It's here because it's smashing.

>>> over smashing show (Smash 1 2)
Smash "1" "2"
>>> over smashing show Nada
Nada

Orphan instances

Swapped Smash Source # 
Instance details

Methods

swapped :: Iso (Smash a b) (Smash c d) (Smash b a) (Smash d c) #

(a ~ a', b ~ b') => Each Bool (Smash a a') (Smash b b') a b Source # 
Instance details

Methods

each :: IxTraversal Bool (Smash a a') (Smash b b') a b #