Module
Untagged.Union
- Package
- purescript-untagged-union
- Repository
- jvliwanag/purescript-untagged-union
#OneOf Source
data OneOf :: Type -> Type -> Type
Instances
(Eq a, Eq b, HasRuntimeType a) => Eq (OneOf a b)
(HasRuntimeType a, HasRuntimeType a') => HasRuntimeType (OneOf a a')
(InOneOf a h' t') => InOneOf a h (OneOf h' t')
(InOneOf a h t) => Castable a (OneOf h t)
(Reducible tf b o, HasRuntimeType a) => Reducible (Tuple (a -> o) tf) (OneOf a b) o
#UndefinedOr Source
type UndefinedOr a = OneOf Undefined a
#fromOneOf Source
fromOneOf :: forall h t a. InOneOf a h t => HasRuntimeType a => OneOf h t -> Maybe a
#toEither1 Source
toEither1 :: forall a b. HasRuntimeType a => OneOf a b -> Either a b
Unwraps a single layer of OneOf
to an Either
Note that for some x :: a |+| b
. If the value x
has a runtime
value that can be read as either types a
and b
, then
toEither1 x
will return Left
.
Example: toEither1 (asOneOf 3.0 :: Int |+| Number) == Left 3
#defined Source
defined :: forall a. a -> UndefinedOr a
#uorToMaybe Source
uorToMaybe :: forall a. UndefinedOr a -> Maybe a
#maybeToUor Source
maybeToUor :: forall a. Maybe a -> UndefinedOr a
#withUor Source
withUor :: forall a b. (a -> b) -> UndefinedOr a -> UndefinedOr b
#fromUndefinedOr Source
fromUndefinedOr :: forall a. a -> UndefinedOr a -> a