horizon-spec 0.6.1 → 0.6.3
raw patch · 3 files changed
+32/−12 lines, 3 filesdep +template-haskelldep +th-lift
Dependencies added: template-haskell, th-lift
Files
- ChangeLog.md +8/−0
- horizon-spec.cabal +3/−1
- src/Horizon/Spec.hs +21/−11
ChangeLog.md view
@@ -1,5 +1,13 @@ # Changelog for horizon-spec +## v0.6.3++* Add `mkSubdir` splice function.++## v0.6.2++* Add `IsString` instances to Text types.+ ## v0.6.1 * Re-export MkModifiers constructor.
horizon-spec.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: horizon-spec-version: 0.6.1+version: 0.6.3 synopsis: Horizon Stable Package Set Type Definitions description: This package contains the type definitions for the Horizon stable package set (https://horizon-haskell.net). This is a schema used to define package sets sourcing from hackage and git.@@ -52,7 +52,9 @@ , dhall , path , path-dhall-instance+ , template-haskell , text+ , th-lift default-language: Haskell2010
src/Horizon/Spec.hs view
@@ -1,5 +1,6 @@ {-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE DuplicateRecordFields #-}+{-# LANGUAGE TemplateHaskell #-} module Horizon.Spec ( CabalFlag(MkCabalFlag) , Compiler(MkCompiler, fromCompiler)@@ -23,44 +24,53 @@ , Repo(MkRepo, fromRepo) , Revision(MkRevision, fromRevision) , Subdir(MkSubdir, fromSubdir)+ , mkSubdir , TarballSource(MkTarballSource, fromTarballSource) , Url(MkUrl, fromUrl) , Version (MkVersion, fromVersion) ) where -import Data.Kind (Type)-import Data.Map (Map)-import Data.Text (Text)-import Dhall (FromDhall, Generic, ToDhall)-import Path (Dir, File, Path, Rel)-import Path.Dhall ()+import Data.Kind (Type)+import Data.Map (Map)+import Data.String (IsString)+import Data.Text (Text)+import Dhall (FromDhall, Generic, ToDhall)+import Language.Haskell.TH (Exp, Q)+import Language.Haskell.TH.Lift (deriveLift, lift)+import Path (Dir, File, Path, Rel, parseRelDir)+import Path.Dhall () type Url :: Type newtype Url = MkUrl { fromUrl :: Text } deriving stock (Eq, Show)- deriving newtype (FromDhall, ToDhall)+ deriving newtype (FromDhall, ToDhall, IsString) type Repo :: Type newtype Repo = MkRepo { fromRepo :: Url } deriving stock (Eq, Show)- deriving newtype (FromDhall, ToDhall)+ deriving newtype (FromDhall, ToDhall, IsString) type Subdir :: Type newtype Subdir = MkSubdir { fromSubdir :: Path Rel Dir } deriving stock (Eq, Show) deriving newtype (FromDhall, ToDhall) +$(deriveLift 'MkSubdir)++mkSubdir :: FilePath -> Q Exp+mkSubdir = either (error . show) (lift . MkSubdir) . parseRelDir+ type Name :: Type newtype Name = MkName { fromName :: Text } deriving stock (Eq, Ord, Show)- deriving newtype (FromDhall, ToDhall)+ deriving newtype (FromDhall, ToDhall, IsString) type Version :: Type newtype Version = MkVersion { fromVersion :: Text } deriving stock (Eq, Show)- deriving newtype (FromDhall, ToDhall)+ deriving newtype (FromDhall, ToDhall, IsString) type GitSource :: Type data GitSource where@@ -132,7 +142,7 @@ newtype Revision where MkRevision :: { fromRevision :: Text } -> Revision deriving stock (Show, Eq, Generic)- deriving newtype (FromDhall, ToDhall)+ deriving newtype (FromDhall, ToDhall, IsString) type Compiler :: Type newtype Compiler where