{-# OPTIONS_HADDOCK hide #-}
module Language.Haskell.Exts.ExtScheme where
import Language.Haskell.Exts.Extension
data ExtScheme = Any [KnownExtension] | All [KnownExtension]
deriving (Eq,Show)
type MExtScheme = Maybe ExtScheme
class Enabled a where
isEnabled :: a -> [KnownExtension] -> Bool
instance Enabled KnownExtension where
isEnabled = elem
instance Enabled ExtScheme where
isEnabled (Any exts) enabled = any (`elem` enabled) exts
isEnabled (All exts) enabled = all (`elem` enabled) exts
instance Enabled a => Enabled (Maybe a) where
isEnabled Nothing = const True
isEnabled (Just a) = isEnabled a