hmt-base-0.20: Haskell Music Theory Base
Safe HaskellSafe-Inferred
LanguageHaskell2010

Music.Theory.Either

Description

Either

Synopsis

Documentation

from_left :: Either a b -> Maybe a Source #

Maybe Left of Either.

from_right :: Either x t -> Maybe t Source #

Maybe Right of Either.

either_swap :: Either a b -> Either b a Source #

Flip from right to left, ie. either Right Left

all_right :: [Either a b] -> Either a [b] Source #

Variant of rights that preserves first Left.

all_right (map Right [1..3]) == Right [1..3]
all_right [Right 1,Left 'a',Left 'b'] == Left 'a'

either_to_maybe :: Either a b -> Maybe b Source #

Lower Either to Maybe by discarding Left.

is_left :: Either a b -> Bool Source #

Data.Either.isLeft, which however hugs doesn't know of.

is_right :: Either a b -> Bool Source #

Data.Either.isRight, which however hugs doesn't know of.

partition_eithers :: [Either a b] -> ([a], [b]) Source #

Data.Either.partitionEithers, which however hugs doesn't know of.