lenses/optics/base.py
def preview(self, state):
        # type: (S) -> Just[B]
        '''Previews a potentially non-existant focus within
        `state`. Returns `Just(focus)` if it exists, Nothing otherwise.

        Requires kind Fold.
        '''
        if not self._is_kind(Fold):
            raise TypeError('Must be an instance of Fold to .preview()')

        pure = lambda a: Const(Nothing())
        func = lambda a: Const(Just(a))
        return self.apply(func, pure, state).unwrap()
def preview(self, state):
        # type: (S) -> Just[B]
        '''Previews a potentially non-existant focus within
        `state`. Returns `Just(focus)` if it exists, Nothing otherwise.

        Requires kind Fold.
        '''
        if not self._is_kind(Fold):
            raise TypeError('Must be an instance of Fold to .preview()')

        pure = lambda a: Const(Nothing())
        func = lambda a: Const(Just(a))
        return self.apply(func, pure, state).unwrap()
def preview ( self , state ) : # type: (S) -> Just[B] if not self . _is_kind ( Fold ) : raise TypeError ( 'Must be an instance of Fold to .preview()' ) pure = lambda a : Const ( Nothing ( ) ) func = lambda a : Const ( Just ( a ) ) return self . apply ( func , pure , state ) . unwrap ( )
Previews a potentially non-existant focus within
        `state`. Returns `Just(focus)` if it exists, Nothing otherwise.

        Requires kind Fold.
Previews a potentially non - existant focus within state . Returns Just ( focus ) if it exists Nothing otherwise .