Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Fresnel.Optional
Synopsis
- type Optional s t a b = forall p. IsOptional p => Optic p s t a b
- type Optional' s a = Optional s s a a
- class (IsLens p, IsPrism p) => IsOptional p
- optional :: (s -> Either t a) -> (s -> b -> t) -> Optional s t a b
- optional' :: (s -> Maybe a) -> (s -> b -> s) -> Optional s s a b
- matching :: Optional s t a b -> s -> Either t a
- matching' :: Optional s t a b -> s -> Maybe a
- withOptional :: Optional s t a b -> ((s -> Either t a) -> (s -> b -> t) -> r) -> r
- traverseOf :: Functor f => Optional s t a b -> (forall r. r -> f r) -> (a -> f b) -> s -> f t
- is :: Optional s t a b -> s -> Bool
- isn't :: Optional s t a b -> s -> Bool
- newtype UnpackedOptional a b s t = UnpackedOptional {
- withUnpackedOptional :: forall r. ((s -> Either t a) -> (s -> b -> t) -> r) -> r
- unpackedOptional :: (s -> Either t a) -> (s -> b -> t) -> UnpackedOptional a b s t
Optionals
type Optional s t a b = forall p. IsOptional p => Optic p s t a b Source #
class (IsLens p, IsPrism p) => IsOptional p Source #
Instances
Monad m => IsOptional (Kleisli m) Source # | |
Defined in Fresnel.Optional.Internal | |
Functor f => IsOptional (OptionalStar f) Source # | |
Defined in Fresnel.Optional.Internal | |
IsOptional (UnpackedOptional a b) Source # | |
Defined in Fresnel.Optional | |
Monoid r => IsOptional (Forget r :: Type -> Type -> TYPE LiftedRep) Source # | |
Defined in Fresnel.Optional.Internal | |
Applicative f => IsOptional (Star f) Source # | |
Defined in Fresnel.Optional.Internal | |
IsOptional (->) Source # | |
Defined in Fresnel.Optional.Internal |
Construction
Elimination
withOptional :: Optional s t a b -> ((s -> Either t a) -> (s -> b -> t) -> r) -> r Source #
traverseOf :: Functor f => Optional s t a b -> (forall r. r -> f r) -> (a -> f b) -> s -> f t Source #
Unpacked
newtype UnpackedOptional a b s t Source #
Constructors
UnpackedOptional | |
Fields
|
Instances
IsIso (UnpackedOptional a b) Source # | |
Defined in Fresnel.Optional | |
IsLens (UnpackedOptional a b) Source # | |
Defined in Fresnel.Optional | |
IsOptional (UnpackedOptional a b) Source # | |
Defined in Fresnel.Optional | |
IsPrism (UnpackedOptional a b) Source # | |
Defined in Fresnel.Optional | |
Choice (UnpackedOptional a b) Source # | |
Defined in Fresnel.Optional Methods left' :: UnpackedOptional a b a0 b0 -> UnpackedOptional a b (Either a0 c) (Either b0 c) right' :: UnpackedOptional a b a0 b0 -> UnpackedOptional a b (Either c a0) (Either c b0) | |
Strong (UnpackedOptional a b) Source # | |
Defined in Fresnel.Optional Methods first' :: UnpackedOptional a b a0 b0 -> UnpackedOptional a b (a0, c) (b0, c) second' :: UnpackedOptional a b a0 b0 -> UnpackedOptional a b (c, a0) (c, b0) | |
Profunctor (UnpackedOptional a b) Source # | |
Defined in Fresnel.Optional Methods dimap :: (a0 -> b0) -> (c -> d) -> UnpackedOptional a b b0 c -> UnpackedOptional a b a0 d lmap :: (a0 -> b0) -> UnpackedOptional a b b0 c -> UnpackedOptional a b a0 c rmap :: (b0 -> c) -> UnpackedOptional a b a0 b0 -> UnpackedOptional a b a0 c (#.) :: forall a0 b0 c q. Coercible c b0 => q b0 c -> UnpackedOptional a b a0 b0 -> UnpackedOptional a b a0 c (.#) :: forall a0 b0 c q. Coercible b0 a0 => UnpackedOptional a b b0 c -> q a0 b0 -> UnpackedOptional a b a0 c |
unpackedOptional :: (s -> Either t a) -> (s -> b -> t) -> UnpackedOptional a b s t Source #