Module

Data.Either.Nested

Package
purescript-either
Repository
purescript/purescript-either

Utilities for n-eithers: sums types with more than two terms built from nested eithers.

Nested eithers arise naturally in sum combinators. You shouldn't represent sum data using nested eithers, but if combinators you're working with create them, utilities in this module will allow to to more easily work with them, including translating to and from more traditional sum types.

data Color = Red Number | Green Number | Blue Number

fromEither3 :: Either3 Number Number Number -> Color
fromEither3 = either3 Red Green Blue

toEither3 :: Color -> Either3 Number Number Number
toEither3 (Red   v) = in1 v
toEither3 (Green v) = in2 v
toEither3 (Blue  v) = in3 v

#type (\/) Source

Operator alias for Data.Either.Either (right-associative / precedence 6)

#in1 Source

in1 :: forall z a. a -> a \/ z

#in2 Source

in2 :: forall z b a. b -> a \/ b \/ z

#in3 Source

in3 :: forall z c b a. c -> a \/ b \/ c \/ z

#in4 Source

in4 :: forall z d c b a. d -> a \/ b \/ c \/ d \/ z

#in5 Source

in5 :: forall z e d c b a. e -> a \/ b \/ c \/ d \/ e \/ z

#in6 Source

in6 :: forall z f e d c b a. f -> a \/ b \/ c \/ d \/ e \/ f \/ z

#in7 Source

in7 :: forall z g f e d c b a. g -> a \/ b \/ c \/ d \/ e \/ f \/ g \/ z

#in8 Source

in8 :: forall z h g f e d c b a. h -> a \/ b \/ c \/ d \/ e \/ f \/ g \/ h \/ z

#in9 Source

in9 :: forall z i h g f e d c b a. i -> a \/ b \/ c \/ d \/ e \/ f \/ g \/ h \/ i \/ z

#in10 Source

in10 :: forall z j i h g f e d c b a. j -> a \/ b \/ c \/ d \/ e \/ f \/ g \/ h \/ i \/ j \/ z

#at1 Source

at1 :: forall z a r. r -> (a -> r) -> a \/ z -> r

#at2 Source

at2 :: forall z b a r. r -> (b -> r) -> a \/ b \/ z -> r

#at3 Source

at3 :: forall z c b a r. r -> (c -> r) -> a \/ b \/ c \/ z -> r

#at4 Source

at4 :: forall z d c b a r. r -> (d -> r) -> a \/ b \/ c \/ d \/ z -> r

#at5 Source

at5 :: forall z e d c b a r. r -> (e -> r) -> a \/ b \/ c \/ d \/ e \/ z -> r

#at6 Source

at6 :: forall z f e d c b a r. r -> (f -> r) -> a \/ b \/ c \/ d \/ e \/ f \/ z -> r

#at7 Source

at7 :: forall z g f e d c b a r. r -> (g -> r) -> a \/ b \/ c \/ d \/ e \/ f \/ g \/ z -> r

#at8 Source

at8 :: forall z h g f e d c b a r. r -> (h -> r) -> a \/ b \/ c \/ d \/ e \/ f \/ g \/ h \/ z -> r

#at9 Source

at9 :: forall z i h g f e d c b a r. r -> (i -> r) -> a \/ b \/ c \/ d \/ e \/ f \/ g \/ h \/ i \/ z -> r

#at10 Source

at10 :: forall z j i h g f e d c b a r. r -> (j -> r) -> a \/ b \/ c \/ d \/ e \/ f \/ g \/ h \/ i \/ j \/ z -> r

#Either1 Source

type Either1 a = a \/ Void

#Either2 Source

type Either2 a b = a \/ b \/ Void

#Either3 Source

type Either3 a b c = a \/ b \/ c \/ Void

#Either4 Source

type Either4 a b c d = a \/ b \/ c \/ d \/ Void

#Either5 Source

type Either5 a b c d e = a \/ b \/ c \/ d \/ e \/ Void

#Either6 Source

type Either6 a b c d e f = a \/ b \/ c \/ d \/ e \/ f \/ Void

#Either7 Source

type Either7 a b c d e f g = a \/ b \/ c \/ d \/ e \/ f \/ g \/ Void

#Either8 Source

type Either8 a b c d e f g h = a \/ b \/ c \/ d \/ e \/ f \/ g \/ h \/ Void

#Either9 Source

type Either9 a b c d e f g h i = a \/ b \/ c \/ d \/ e \/ f \/ g \/ h \/ i \/ Void

#Either10 Source

type Either10 a b c d e f g h i j = a \/ b \/ c \/ d \/ e \/ f \/ g \/ h \/ i \/ j \/ Void

#either1 Source

either1 :: forall a. Either1 a -> a

#either2 Source

either2 :: forall b a r. (a -> r) -> (b -> r) -> Either2 a b -> r

#either3 Source

either3 :: forall c b a r. (a -> r) -> (b -> r) -> (c -> r) -> Either3 a b c -> r

#either4 Source

either4 :: forall d c b a r. (a -> r) -> (b -> r) -> (c -> r) -> (d -> r) -> Either4 a b c d -> r

#either5 Source

either5 :: forall e d c b a r. (a -> r) -> (b -> r) -> (c -> r) -> (d -> r) -> (e -> r) -> Either5 a b c d e -> r

#either6 Source

either6 :: forall f e d c b a r. (a -> r) -> (b -> r) -> (c -> r) -> (d -> r) -> (e -> r) -> (f -> r) -> Either6 a b c d e f -> r

#either7 Source

either7 :: forall g f e d c b a r. (a -> r) -> (b -> r) -> (c -> r) -> (d -> r) -> (e -> r) -> (f -> r) -> (g -> r) -> Either7 a b c d e f g -> r

#either8 Source

either8 :: forall h g f e d c b a r. (a -> r) -> (b -> r) -> (c -> r) -> (d -> r) -> (e -> r) -> (f -> r) -> (g -> r) -> (h -> r) -> Either8 a b c d e f g h -> r

#either9 Source

either9 :: forall i h g f e d c b a r. (a -> r) -> (b -> r) -> (c -> r) -> (d -> r) -> (e -> r) -> (f -> r) -> (g -> r) -> (h -> r) -> (i -> r) -> Either9 a b c d e f g h i -> r

#either10 Source

either10 :: forall j i h g f e d c b a r. (a -> r) -> (b -> r) -> (c -> r) -> (d -> r) -> (e -> r) -> (f -> r) -> (g -> r) -> (h -> r) -> (i -> r) -> (j -> r) -> Either10 a b c d e f g h i j -> r