Skip to content

Instantly share code, notes, and snippets.

{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE ScopedTypeVariables #-}
--{-# LANGUAGE RankNTypes #-}
--{-# LANGUAGE UndecidableInstances #-}
--{-# LANGUAGE AllowAmbiguousTypes #-}
--{-# LANGUAGE GADTs #-}
import Data.Aeson
@NicolasT
NicolasT / either.ml
Created August 25, 2014 14:51
An `Either` module for OCaml
(** Either *)
module Either : sig
type ('a, 'b) t = Left of 'a | Right of 'b
val left : 'a -> ('a, 'b) t
val right : 'b -> ('a, 'b) t
val either : ('a -> 'c) -> ('b -> 'c) -> ('a, 'b) t -> 'c