{-# LANGUAGE AllowAmbiguousTypes #-}
module Pandora.Paradigm.Controlflow.Effect.Conditional where

import Pandora.Paradigm.Primary.Object.Boolean (Boolean (True, False))
import Pandora.Paradigm.Primary.Functor.Maybe (Maybe (Just, Nothing))

infixr 1 ?

class Conditional clause where
	(?) :: clause -> a -> a -> a

instance Conditional Boolean where
	? :: Boolean -> a -> a -> a
(?) Boolean
True a
x a
_ = a
x
	(?) Boolean
False a
_ a
y = a
y

instance Conditional (Maybe a) where
	? :: Maybe a -> a -> a -> a
(?) (Just a
_) a
x a
_ = a
x
	(?) Maybe a
Nothing a
_ a
y = a
y