data Config select = Config
{ dataFile :: select Last (Maybe FilePath)
}
deriving stock (Generic)
newtype Build f a = Build { fromBuild :: f a }
deriving stock (Show, Eq, Ord, Functor, Traversable, Foldable, Generic)
deriving newtype (Semigroup, Monoid)
deriving anyclass (GSemigroup, GMonoid)
newtype Run f a = Run { fromRun :: a }
deriving stock (Show, Eq, Ord, Functor, Traversable, Foldable)
instance Semigroup (Config Build) where
(<>) = gsappenddefault
instance Monoid (Config Build) where
mempty = memptydefault
(!<-) :: (f a -> b) -> Build f a -> Run f b
(!<-) f = Run . f . fromBuild
infix 1 !<-
configBuild :: Config Build -> Config Run
configBuild Config {..} = Config
{ dataFile = fromMaybe mempty . getLast !<- dataFile
}