shithub: MicroHs

ref: 23c4e98fd9dea207b1c62e46e2af56f58dca3861
dir: /lib/Data/Either.hs/

View raw version
-- Copyright 2023 Lennart Augustsson
-- See LICENSE file for full license.
module Data.Either(module Data.Either) where

data Either a b = Left a | Right b

either :: forall a b r . (a -> r) -> (b -> r) -> Either a b -> r
either fa fb arg =
  case arg of
    Left  a -> fa a
    Right b -> fb b