optics-core-0.4.1.1: Optics as an abstract interface: core definitions

Safe Haskell | None
Language | Haskell2010

Optics.Operators.Unsafe

Description

Synopsis

- (^?!) :: forall k s (is :: IxList) a. (HasCallStack, Is k An_AffineFold) => s -> Optic' k is s a -> a

# Documentation

(^?!) :: forall k s (is :: IxList) a. (HasCallStack, Is k An_AffineFold) => s -> Optic' k is s a -> a infixl 8 Source #

Perform an *UNSAFE* `head` of an affine fold assuming that it is there.

    >>> Left 4 ^?! _Left
    4

    >>> "world" ^?! ix 3
    'l'

    >>> [] ^?! _head
    *** Exception: (^?!): empty affine fold
    ...

Since: 0.3