module Ema.Route.Class (
IsRoute (RouteModel, routePrism, routeUniverse),
) where
import Ema.Route.Prism (Prism_, toPrism_)
import Optics.Core (only)
import Prelude hiding (All, Generic)
class IsRoute r where
type RouteModel r :: Type
routePrism :: RouteModel r -> Prism_ FilePath r
routeUniverse :: RouteModel r -> [r]
instance IsRoute () where
type RouteModel () = ()
routePrism :: RouteModel () -> Prism_ FilePath ()
routePrism () = Prism' FilePath () -> Prism_ FilePath ()
forall s a. Prism' s a -> Prism_ s a
toPrism_ (Prism' FilePath () -> Prism_ FilePath ())
-> Prism' FilePath () -> Prism_ FilePath ()
forall a b. (a -> b) -> a -> b
$ FilePath -> Prism' FilePath ()
forall a. Eq a => a -> Prism' a ()
only FilePath
"index.html"
routeUniverse :: RouteModel () -> [()]
routeUniverse () = OneItem [()] -> [()]
forall x. One x => OneItem x -> x
one ()