module Language.PureScript.Bridge.CodeGenSwitches
( Settings (..)
, defaultSettings
, Switch
, getSettings
, defaultSwitch
, noLenses, genLenses
) where
import Data.Monoid (Endo(..))
newtype Settings = Settings
{ generateLenses :: Bool
}
deriving (Eq, Show)
defaultSettings :: Settings
defaultSettings = Settings True
type Switch = Endo Settings
getSettings :: Switch -> Settings
getSettings switch = appEndo switch defaultSettings
defaultSwitch :: Switch
defaultSwitch = mempty
noLenses :: Switch
noLenses = Endo $ \settings -> settings { generateLenses = False }
genLenses :: Switch
genLenses = Endo $ \settings -> settings { generateLenses = True }