{-# LANGUAGE TemplateHaskell #-}
module Horizon.Spec.Types.PackageSetFile (PackageSetFile(MkPackageSetFile), fromPackageSetFile, mkPackageSetFile) where

import           Data.Kind                (Type)
import           Dhall                    (FromDhall, ToDhall)
import           Language.Haskell.TH      (Exp, Q)
import           Language.Haskell.TH.Lift (deriveLift, lift)
import           Path                     (File, Path, Rel, parseRelFile)
import           Path.Dhall               ()

type PackageSetFile :: Type
newtype PackageSetFile = MkPackageSetFile { PackageSetFile -> Path Rel File
fromPackageSetFile :: Path Rel File }
  deriving stock (PackageSetFile -> PackageSetFile -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PackageSetFile -> PackageSetFile -> Bool
$c/= :: PackageSetFile -> PackageSetFile -> Bool
== :: PackageSetFile -> PackageSetFile -> Bool
$c== :: PackageSetFile -> PackageSetFile -> Bool
Eq, Int -> PackageSetFile -> ShowS
[PackageSetFile] -> ShowS
PackageSetFile -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PackageSetFile] -> ShowS
$cshowList :: [PackageSetFile] -> ShowS
show :: PackageSetFile -> String
$cshow :: PackageSetFile -> String
showsPrec :: Int -> PackageSetFile -> ShowS
$cshowsPrec :: Int -> PackageSetFile -> ShowS
Show)
  deriving newtype (InputNormalizer -> Decoder PackageSetFile
forall a. (InputNormalizer -> Decoder a) -> FromDhall a
autoWith :: InputNormalizer -> Decoder PackageSetFile
$cautoWith :: InputNormalizer -> Decoder PackageSetFile
FromDhall, InputNormalizer -> Encoder PackageSetFile
forall a. (InputNormalizer -> Encoder a) -> ToDhall a
injectWith :: InputNormalizer -> Encoder PackageSetFile
$cinjectWith :: InputNormalizer -> Encoder PackageSetFile
ToDhall)

$(deriveLift 'MkPackageSetFile)

mkPackageSetFile :: FilePath -> Q Exp
mkPackageSetFile :: String -> Q Exp
mkPackageSetFile = 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 File -> PackageSetFile
MkPackageSetFile) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *). MonadThrow m => String -> m (Path Rel File)
parseRelFile