{-# LANGUAGE TemplateHaskell #-} module Horizon.Spec.Types.Subdir (Subdir(MkSubdir), fromSubdir, mkSubdir) where import Data.Kind (Type) import Dhall (FromDhall, ToDhall) import Language.Haskell.TH (Exp, Q) import Language.Haskell.TH.Lift (deriveLift, lift) import Path (Dir, Path, Rel, parseRelDir) import Path.Dhall () type Subdir :: Type newtype Subdir = MkSubdir { Subdir -> Path Rel Dir fromSubdir :: Path Rel Dir } deriving stock (Subdir -> Subdir -> Bool forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a /= :: Subdir -> Subdir -> Bool $c/= :: Subdir -> Subdir -> Bool == :: Subdir -> Subdir -> Bool $c== :: Subdir -> Subdir -> Bool Eq, Int -> Subdir -> ShowS [Subdir] -> ShowS Subdir -> String forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a showList :: [Subdir] -> ShowS $cshowList :: [Subdir] -> ShowS show :: Subdir -> String $cshow :: Subdir -> String showsPrec :: Int -> Subdir -> ShowS $cshowsPrec :: Int -> Subdir -> ShowS Show) deriving newtype (InputNormalizer -> Decoder Subdir forall a. (InputNormalizer -> Decoder a) -> FromDhall a autoWith :: InputNormalizer -> Decoder Subdir $cautoWith :: InputNormalizer -> Decoder Subdir FromDhall, InputNormalizer -> Encoder Subdir forall a. (InputNormalizer -> Encoder a) -> ToDhall a injectWith :: InputNormalizer -> Encoder Subdir $cinjectWith :: InputNormalizer -> Encoder Subdir ToDhall) $(deriveLift 'MkSubdir) mkSubdir :: FilePath -> Q Exp mkSubdir :: String -> Q Exp mkSubdir = forall a c b. (a -> c) -> (b -> c) -> Either a b -> c either (forall a. HasCallStack => String -> a error forall b c a. (b -> c) -> (a -> b) -> a -> c . forall a. Show a => a -> String show) (forall t (m :: * -> *). (Lift t, Quote m) => t -> m Exp lift forall b c a. (b -> c) -> (a -> b) -> a -> c . Path Rel Dir -> Subdir MkSubdir) forall b c a. (b -> c) -> (a -> b) -> a -> c . forall (m :: * -> *). MonadThrow m => String -> m (Path Rel Dir) parseRelDir