diff --git a/autodocodec-api-usage/autodocodec-api-usage.cabal b/autodocodec-api-usage/autodocodec-api-usage.cabal index db5a704..1f80f55 100644 --- a/autodocodec-api-usage/autodocodec-api-usage.cabal +++ b/autodocodec-api-usage/autodocodec-api-usage.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.35.2. +-- This file has been generated from package.yaml by hpack version 0.36.0. -- -- see: https://github.com/sol/hpack diff --git a/autodocodec-api-usage/test/Autodocodec/Aeson/SchemaSpec.hs b/autodocodec-api-usage/test/Autodocodec/Aeson/SchemaSpec.hs index 63b02c7..22604e7 100644 --- a/autodocodec-api-usage/test/Autodocodec/Aeson/SchemaSpec.hs +++ b/autodocodec-api-usage/test/Autodocodec/Aeson/SchemaSpec.hs @@ -236,7 +236,7 @@ jsonSchemaSpec filePath = jsonSchemaSpec' :: forall a. - HasCodec a => + (HasCodec a) => FilePath -> Spec jsonSchemaSpec' filePath = diff --git a/autodocodec-api-usage/test/Autodocodec/MultipartSpec.hs b/autodocodec-api-usage/test/Autodocodec/MultipartSpec.hs index 68d5144..e45da18 100644 --- a/autodocodec-api-usage/test/Autodocodec/MultipartSpec.hs +++ b/autodocodec-api-usage/test/Autodocodec/MultipartSpec.hs @@ -23,13 +23,13 @@ deriving instance Show Tmp deriving instance Show Mem -deriving instance Show (MultipartResult tag) => Show (MultipartData tag) +deriving instance (Show (MultipartResult tag)) => Show (MultipartData tag) deriving instance Eq Tmp deriving instance Eq Mem -deriving instance Eq (MultipartResult tag) => Eq (MultipartData tag) +deriving instance (Eq (MultipartResult tag)) => Eq (MultipartData tag) spec :: Spec spec = do diff --git a/autodocodec-api-usage/test_resources/json-schema/expression.json b/autodocodec-api-usage/test_resources/json-schema/expression.json index f3c6f4a..dc8afdf 100644 --- a/autodocodec-api-usage/test_resources/json-schema/expression.json +++ b/autodocodec-api-usage/test_resources/json-schema/expression.json @@ -3,6 +3,25 @@ "Expression": { "$comment": "Expression", "oneOf": [ + { + "properties": { + "left": { + "$ref": "#/$defs/Expression" + }, + "right": { + "$ref": "#/$defs/Expression" + }, + "type": { + "const": "sum" + } + }, + "required": [ + "type", + "right", + "left" + ], + "type": "object" + }, { "properties": { "left": { @@ -38,25 +57,6 @@ "value" ], "type": "object" - }, - { - "properties": { - "left": { - "$ref": "#/$defs/Expression" - }, - "right": { - "$ref": "#/$defs/Expression" - }, - "type": { - "const": "sum" - } - }, - "required": [ - "type", - "right", - "left" - ], - "type": "object" } ], "type": "object" diff --git a/autodocodec-api-usage/test_resources/json-schema/these.json b/autodocodec-api-usage/test_resources/json-schema/these.json index 19f18b8..fa0708e 100644 --- a/autodocodec-api-usage/test_resources/json-schema/these.json +++ b/autodocodec-api-usage/test_resources/json-schema/these.json @@ -3,16 +3,18 @@ "oneOf": [ { "properties": { - "text": { - "type": "string" + "int": { + "maximum": 9223372036854775807, + "minimum": -9223372036854775808, + "type": "number" }, "type": { - "const": "this" + "const": "that" } }, "required": [ "type", - "text" + "int" ], "type": "object" }, @@ -39,18 +41,16 @@ }, { "properties": { - "int": { - "maximum": 9223372036854775807, - "minimum": -9223372036854775808, - "type": "number" + "text": { + "type": "string" }, "type": { - "const": "that" + "const": "this" } }, "required": [ "type", - "int" + "text" ], "type": "object" } diff --git a/autodocodec-api-usage/test_resources/openapi-schema/declareSchemaRef/expression.json b/autodocodec-api-usage/test_resources/openapi-schema/declareSchemaRef/expression.json index 73b1769..08fa152 100644 --- a/autodocodec-api-usage/test_resources/openapi-schema/declareSchemaRef/expression.json +++ b/autodocodec-api-usage/test_resources/openapi-schema/declareSchemaRef/expression.json @@ -10,14 +10,14 @@ "propertyName": "type" }, "oneOf": [ + { + "$ref": "#/components/schemas/SumExpression" + }, { "$ref": "#/components/schemas/ProductExpression" }, { "$ref": "#/components/schemas/LiteralExpression" - }, - { - "$ref": "#/components/schemas/SumExpression" } ] }, diff --git a/autodocodec-api-usage/test_resources/openapi-schema/declareSchemaRef/these.json b/autodocodec-api-usage/test_resources/openapi-schema/declareSchemaRef/these.json index 024382b..b768b97 100644 --- a/autodocodec-api-usage/test_resources/openapi-schema/declareSchemaRef/these.json +++ b/autodocodec-api-usage/test_resources/openapi-schema/declareSchemaRef/these.json @@ -55,13 +55,13 @@ }, "oneOf": [ { - "$ref": "#/components/schemas/This" + "$ref": "#/components/schemas/That" }, { "$ref": "#/components/schemas/Both" }, { - "$ref": "#/components/schemas/That" + "$ref": "#/components/schemas/This" } ] }, diff --git a/autodocodec-api-usage/test_resources/openapi-schema/expression.json b/autodocodec-api-usage/test_resources/openapi-schema/expression.json index a309609..279bb7f 100644 --- a/autodocodec-api-usage/test_resources/openapi-schema/expression.json +++ b/autodocodec-api-usage/test_resources/openapi-schema/expression.json @@ -11,14 +11,14 @@ "propertyName": "type" }, "oneOf": [ + { + "$ref": "#/components/schemas/SumExpression" + }, { "$ref": "#/components/schemas/ProductExpression" }, { "$ref": "#/components/schemas/LiteralExpression" - }, - { - "$ref": "#/components/schemas/SumExpression" } ] }, diff --git a/autodocodec-api-usage/test_resources/openapi-schema/these.json b/autodocodec-api-usage/test_resources/openapi-schema/these.json index b60b11c..cccb2cb 100644 --- a/autodocodec-api-usage/test_resources/openapi-schema/these.json +++ b/autodocodec-api-usage/test_resources/openapi-schema/these.json @@ -56,13 +56,13 @@ }, "oneOf": [ { - "$ref": "#/components/schemas/This" + "$ref": "#/components/schemas/That" }, { "$ref": "#/components/schemas/Both" }, { - "$ref": "#/components/schemas/That" + "$ref": "#/components/schemas/This" } ] }, diff --git a/autodocodec-api-usage/test_resources/show-codec/expression.txt b/autodocodec-api-usage/test_resources/show-codec/expression.txt index 3172e4e..97cfe64 100644 --- a/autodocodec-api-usage/test_resources/show-codec/expression.txt +++ b/autodocodec-api-usage/test_resources/show-codec/expression.txt @@ -5,7 +5,21 @@ ReferenceCodec (DiscriminatedUnionCodec "type" _ - [ ( "product" + [ ( "sum" + , BimapCodec + _ + _ + (ApCodec + (BimapCodec + _ + _ + (RequiredKeyCodec "left" Nothing (ReferenceCodec "Expression"))) + (BimapCodec + _ + _ + (RequiredKeyCodec "right" Nothing (ReferenceCodec "Expression")))) + ) + , ( "product" , BimapCodec _ _ @@ -37,18 +51,4 @@ ReferenceCodec , numberBoundsUpper = 9.223372036854775807e18 })))) ) - , ( "sum" - , BimapCodec - _ - _ - (ApCodec - (BimapCodec - _ - _ - (RequiredKeyCodec "left" Nothing (ReferenceCodec "Expression"))) - (BimapCodec - _ - _ - (RequiredKeyCodec "right" Nothing (ReferenceCodec "Expression")))) - ) ])) \ No newline at end of file diff --git a/autodocodec-api-usage/test_resources/show-codec/these.txt b/autodocodec-api-usage/test_resources/show-codec/these.txt index 945fd16..4f324d1 100644 --- a/autodocodec-api-usage/test_resources/show-codec/these.txt +++ b/autodocodec-api-usage/test_resources/show-codec/these.txt @@ -3,9 +3,23 @@ ObjectOfCodec (DiscriminatedUnionCodec "type" _ - [ ( "this" + [ ( "that" , BimapCodec - _ _ (RequiredKeyCodec "text" Nothing (StringCodec Nothing)) + _ + _ + (RequiredKeyCodec + "int" + Nothing + (BimapCodec + _ + _ + (NumberCodec + Nothing + (Just + NumberBounds + { numberBoundsLower = -9.223372036854775808e18 + , numberBoundsUpper = 9.223372036854775807e18 + })))) ) , ( "both" , BimapCodec @@ -31,22 +45,8 @@ ObjectOfCodec , numberBoundsUpper = 9.223372036854775807e18 })))))) ) - , ( "that" + , ( "this" , BimapCodec - _ - _ - (RequiredKeyCodec - "int" - Nothing - (BimapCodec - _ - _ - (NumberCodec - Nothing - (Just - NumberBounds - { numberBoundsLower = -9.223372036854775808e18 - , numberBoundsUpper = 9.223372036854775807e18 - })))) + _ _ (RequiredKeyCodec "text" Nothing (StringCodec Nothing)) ) ]) \ No newline at end of file diff --git a/autodocodec-api-usage/test_resources/yaml-schema/expression.txt b/autodocodec-api-usage/test_resources/yaml-schema/expression.txt index 420ae73..e3a48fc 100644 --- a/autodocodec-api-usage/test_resources/yaml-schema/expression.txt +++ b/autodocodec-api-usage/test_resources/yaml-schema/expression.txt @@ -5,16 +5,16 @@ ref: Expression right: # required ref: Expression + type: # required + sum +, left: # required + ref: Expression + right: # required + ref: Expression type: # required product , value: # required  # between -9223372036854775808 and 9223372036854775807 type: # required literal -, left: # required - ref: Expression - right: # required - ref: Expression - type: # required - sum ] diff --git a/autodocodec-api-usage/test_resources/yaml-schema/these.txt b/autodocodec-api-usage/test_resources/yaml-schema/these.txt index 51eb449..fd6f837 100644 --- a/autodocodec-api-usage/test_resources/yaml-schema/these.txt +++ b/autodocodec-api-usage/test_resources/yaml-schema/these.txt @@ -1,17 +1,17 @@ # These # one of -[ text: # required -  +[ int: # required +  # between -9223372036854775808 and 9223372036854775807 type: # required - this + that , text: # required  int: # required  # between -9223372036854775808 and 9223372036854775807 type: # required both -, int: # required -  # between -9223372036854775808 and 9223372036854775807 +, text: # required +  type: # required - that + this ] diff --git a/autodocodec-openapi3/autodocodec-openapi3.cabal b/autodocodec-openapi3/autodocodec-openapi3.cabal index 74140b2..36eb6d0 100644 --- a/autodocodec-openapi3/autodocodec-openapi3.cabal +++ b/autodocodec-openapi3/autodocodec-openapi3.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.35.2. +-- This file has been generated from package.yaml by hpack version 0.36.0. -- -- see: https://github.com/sol/hpack diff --git a/autodocodec-openapi3/src/Autodocodec/OpenAPI/Schema.hs b/autodocodec-openapi3/src/Autodocodec/OpenAPI/Schema.hs index 5eb7d4f..5906799 100644 --- a/autodocodec-openapi3/src/Autodocodec/OpenAPI/Schema.hs +++ b/autodocodec-openapi3/src/Autodocodec/OpenAPI/Schema.hs @@ -28,7 +28,7 @@ import Data.Scientific import Data.Text (Text) -- | Use a type's 'codec' to implement 'declareNamedSchema'. -declareNamedSchemaViaCodec :: HasCodec value => Proxy value -> Declare (Definitions Schema) NamedSchema +declareNamedSchemaViaCodec :: (HasCodec value) => Proxy value -> Declare (Definitions Schema) NamedSchema declareNamedSchemaViaCodec proxy = declareNamedSchemaVia codec proxy -- | Use a given 'codec' to implement 'declareNamedSchema'. @@ -219,7 +219,7 @@ declareNamedSchemaVia c' Proxy = evalStateT (go c') mempty combineObjectSchemas :: [Schema] -> Schema combineObjectSchemas = mconcat - combineSchemasOr :: MonadDeclare (Definitions Schema) m => Union -> NamedSchema -> NamedSchema -> m NamedSchema + combineSchemasOr :: (MonadDeclare (Definitions Schema) m) => Union -> NamedSchema -> NamedSchema -> m NamedSchema combineSchemasOr u ns1 ns2 = do let s1 = _namedSchemaSchema ns1 let s2 = _namedSchemaSchema ns2 @@ -250,12 +250,12 @@ declareNamedSchemaVia c' Proxy = evalStateT (go c') mempty (Nothing, Just s2s) -> prototype & orLens ?~ (s1Ref : s2s) (Nothing, Nothing) -> prototype & orLens ?~ [s1Ref, s2Ref] -declareSpecificNamedSchemaRef :: MonadDeclare (Definitions Schema) m => OpenAPI.NamedSchema -> m (Referenced NamedSchema) +declareSpecificNamedSchemaRef :: (MonadDeclare (Definitions Schema) m) => OpenAPI.NamedSchema -> m (Referenced NamedSchema) declareSpecificNamedSchemaRef namedSchema = fmap (NamedSchema (_namedSchemaName namedSchema)) <$> declareSpecificSchemaRef (_namedSchemaName namedSchema) (_namedSchemaSchema namedSchema) -declareSpecificSchemaRef :: MonadDeclare (Definitions Schema) m => Maybe Text -> OpenAPI.Schema -> m (Referenced Schema) +declareSpecificSchemaRef :: (MonadDeclare (Definitions Schema) m) => Maybe Text -> OpenAPI.Schema -> m (Referenced Schema) declareSpecificSchemaRef mName s = case mName of Nothing -> pure $ Inline s diff --git a/autodocodec-schema/autodocodec-schema.cabal b/autodocodec-schema/autodocodec-schema.cabal index 2c23fc6..ce1de4b 100644 --- a/autodocodec-schema/autodocodec-schema.cabal +++ b/autodocodec-schema/autodocodec-schema.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.35.2. +-- This file has been generated from package.yaml by hpack version 0.36.0. -- -- see: https://github.com/sol/hpack diff --git a/autodocodec-schema/src/Autodocodec/Schema.hs b/autodocodec-schema/src/Autodocodec/Schema.hs index 3ce0283..1c255a9 100644 --- a/autodocodec-schema/src/Autodocodec/Schema.hs +++ b/autodocodec-schema/src/Autodocodec/Schema.hs @@ -308,7 +308,7 @@ data KeyRequirement instance Validity KeyRequirement -jsonSchemaViaCodec :: forall a. HasCodec a => JSONSchema +jsonSchemaViaCodec :: forall a. (HasCodec a) => JSONSchema jsonSchemaViaCodec = jsonSchemaVia (codec @a) jsonSchemaVia :: ValueCodec input output -> JSONSchema diff --git a/autodocodec-servant-multipart/autodocodec-servant-multipart.cabal b/autodocodec-servant-multipart/autodocodec-servant-multipart.cabal index db38884..ec0cd90 100644 --- a/autodocodec-servant-multipart/autodocodec-servant-multipart.cabal +++ b/autodocodec-servant-multipart/autodocodec-servant-multipart.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.35.2. +-- This file has been generated from package.yaml by hpack version 0.36.0. -- -- see: https://github.com/sol/hpack diff --git a/autodocodec-servant-multipart/src/Autodocodec/Multipart.hs b/autodocodec-servant-multipart/src/Autodocodec/Multipart.hs index 453e3e5..27fd1e6 100644 --- a/autodocodec-servant-multipart/src/Autodocodec/Multipart.hs +++ b/autodocodec-servant-multipart/src/Autodocodec/Multipart.hs @@ -23,7 +23,7 @@ import qualified Data.Vector as V import Servant.Multipart as Servant import Servant.Multipart.API as Servant -toMultipartViaCodec :: forall a tag. HasObjectCodec a => a -> MultipartData tag +toMultipartViaCodec :: forall a tag. (HasObjectCodec a) => a -> MultipartData tag toMultipartViaCodec = toMultipartVia (objectCodec @a) toMultipartVia :: ObjectCodec a void -> a -> MultipartData tag @@ -116,10 +116,10 @@ mappendMultipartData mpd1 mpd2 = files = files mpd1 ++ files mpd2 } -instance HasObjectCodec a => Servant.ToMultipart tag (Autodocodec a) where +instance (HasObjectCodec a) => Servant.ToMultipart tag (Autodocodec a) where toMultipart = toMultipartViaCodec . unAutodocodec -fromMultipartViaCodec :: forall a tag. HasObjectCodec a => MultipartData tag -> Either String a +fromMultipartViaCodec :: forall a tag. (HasObjectCodec a) => MultipartData tag -> Either String a fromMultipartViaCodec = fromMultipartVia (objectCodec @a) fromMultipartVia :: ObjectCodec void a -> MultipartData tag -> Either String a @@ -248,5 +248,5 @@ lookupMInput iname = Right . fmap iValue . find ((== iname) . iName) . inputs lookupLInput :: Text -> MultipartData tag -> Either String [Text] lookupLInput iname = Right . map iValue . filter ((== iname) . iName) . inputs -instance HasObjectCodec a => Servant.FromMultipart tag (Autodocodec a) where +instance (HasObjectCodec a) => Servant.FromMultipart tag (Autodocodec a) where fromMultipart = fmap Autodocodec . fromMultipartViaCodec diff --git a/autodocodec-swagger2/autodocodec-swagger2.cabal b/autodocodec-swagger2/autodocodec-swagger2.cabal index 6bfd2d7..3949ad9 100644 --- a/autodocodec-swagger2/autodocodec-swagger2.cabal +++ b/autodocodec-swagger2/autodocodec-swagger2.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.35.2. +-- This file has been generated from package.yaml by hpack version 0.36.0. -- -- see: https://github.com/sol/hpack diff --git a/autodocodec-swagger2/src/Autodocodec/Swagger/Schema.hs b/autodocodec-swagger2/src/Autodocodec/Swagger/Schema.hs index cc23e86..17765f7 100644 --- a/autodocodec-swagger2/src/Autodocodec/Swagger/Schema.hs +++ b/autodocodec-swagger2/src/Autodocodec/Swagger/Schema.hs @@ -22,7 +22,7 @@ import Data.Swagger.Declare as Swagger import Data.Text (Text) -- | Use a type's 'codec' to implement 'declareNamedSchema'. -declareNamedSchemaViaCodec :: HasCodec value => Proxy value -> Declare (Definitions Schema) NamedSchema +declareNamedSchemaViaCodec :: (HasCodec value) => Proxy value -> Declare (Definitions Schema) NamedSchema declareNamedSchemaViaCodec proxy = declareNamedSchemaVia codec proxy -- | Use a given 'codec' to implement 'declareNamedSchema'. diff --git a/autodocodec-yaml/autodocodec-yaml.cabal b/autodocodec-yaml/autodocodec-yaml.cabal index 2c245fa..c99b640 100644 --- a/autodocodec-yaml/autodocodec-yaml.cabal +++ b/autodocodec-yaml/autodocodec-yaml.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.35.2. +-- This file has been generated from package.yaml by hpack version 0.36.0. -- -- see: https://github.com/sol/hpack diff --git a/autodocodec-yaml/src/Autodocodec/Yaml.hs b/autodocodec-yaml/src/Autodocodec/Yaml.hs index 91d9945..6540c91 100644 --- a/autodocodec-yaml/src/Autodocodec/Yaml.hs +++ b/autodocodec-yaml/src/Autodocodec/Yaml.hs @@ -38,9 +38,9 @@ import qualified Data.Yaml as Yaml import qualified Data.Yaml.Builder as Yaml -- | Encode a value as a Yaml 'ByteString' via its type's 'codec'. -encodeYamlViaCodec :: HasCodec a => a -> ByteString +encodeYamlViaCodec :: (HasCodec a) => a -> ByteString encodeYamlViaCodec = Yaml.toByteString . Autodocodec -- | Parse a Yaml 'ByteString' using a type's 'codec'. -eitherDecodeYamlViaCodec :: HasCodec a => ByteString -> Either Yaml.ParseException a +eitherDecodeYamlViaCodec :: (HasCodec a) => ByteString -> Either Yaml.ParseException a eitherDecodeYamlViaCodec = fmap unAutodocodec . Yaml.decodeEither' diff --git a/autodocodec-yaml/src/Autodocodec/Yaml/Encode.hs b/autodocodec-yaml/src/Autodocodec/Yaml/Encode.hs index d7138cd..9967689 100644 --- a/autodocodec-yaml/src/Autodocodec/Yaml/Encode.hs +++ b/autodocodec-yaml/src/Autodocodec/Yaml/Encode.hs @@ -21,7 +21,7 @@ import qualified Data.Yaml as JSON import Data.Yaml.Builder as Yaml -- | Implement 'Yaml.toYaml' using a type's codec -toYamlViaCodec :: HasCodec a => a -> YamlBuilder +toYamlViaCodec :: (HasCodec a) => a -> YamlBuilder toYamlViaCodec = toYamlVia codec -- | Implement 'Yaml.toYaml' using a given codec @@ -92,5 +92,5 @@ toYamlVia = flip go JSON.Object o -> yamlObject o JSON.Array v -> Yaml.array $ map yamlValue $ V.toList v -instance HasCodec a => ToYaml (Autodocodec a) where +instance (HasCodec a) => ToYaml (Autodocodec a) where toYaml = toYamlViaCodec . unAutodocodec diff --git a/autodocodec-yaml/src/Autodocodec/Yaml/IO.hs b/autodocodec-yaml/src/Autodocodec/Yaml/IO.hs index e414a9c..ce6858e 100644 --- a/autodocodec-yaml/src/Autodocodec/Yaml/IO.hs +++ b/autodocodec-yaml/src/Autodocodec/Yaml/IO.hs @@ -16,13 +16,13 @@ import System.Exit -- | Helper function to read a yaml file for a type in 'HasCodec' -- -- This will output a colourful yaml schema if parsing fails. -readYamlConfigFile :: HasCodec a => Path r File -> IO (Maybe a) +readYamlConfigFile :: (HasCodec a) => Path r File -> IO (Maybe a) readYamlConfigFile p = readFirstYamlConfigFile [p] -- | Helper function to read the first in a list of yaml files for a type is 'HasCodec' -- -- This will output a colourful yaml schema if parsing fails. -readFirstYamlConfigFile :: forall a r. HasCodec a => [Path r File] -> IO (Maybe a) +readFirstYamlConfigFile :: forall a r. (HasCodec a) => [Path r File] -> IO (Maybe a) readFirstYamlConfigFile files = go files where go :: [Path r File] -> IO (Maybe a) diff --git a/autodocodec-yaml/src/Autodocodec/Yaml/Schema.hs b/autodocodec-yaml/src/Autodocodec/Yaml/Schema.hs index 2de8c99..33baefd 100644 --- a/autodocodec-yaml/src/Autodocodec/Yaml/Schema.hs +++ b/autodocodec-yaml/src/Autodocodec/Yaml/Schema.hs @@ -21,7 +21,7 @@ import Data.Yaml as Yaml import Text.Colour -- | Render a human-readable schema for a type's 'codec', in colour. -renderColouredSchemaViaCodec :: forall a. HasCodec a => Text +renderColouredSchemaViaCodec :: forall a. (HasCodec a) => Text renderColouredSchemaViaCodec = renderColouredSchemaVia (codec @a) -- | Render a human-readable schema for a given codec, in colour. @@ -29,7 +29,7 @@ renderColouredSchemaVia :: ValueCodec input output -> Text renderColouredSchemaVia = renderChunksText With24BitColours . schemaChunksVia -- | Render a human-readable schema for a type's 'codec', without colour. -renderPlainSchemaViaCodec :: forall a. HasCodec a => Text +renderPlainSchemaViaCodec :: forall a. (HasCodec a) => Text renderPlainSchemaViaCodec = renderPlainSchemaVia (codec @a) -- | Render a human-readable schema for a given codec, without colour. @@ -37,7 +37,7 @@ renderPlainSchemaVia :: ValueCodec input output -> Text renderPlainSchemaVia = renderChunksText WithoutColours . schemaChunksVia -- | Produce potentially-coloured 'Chunk's for a human-readable schema for a type's 'codec'. -schemaChunksViaCodec :: forall a. HasCodec a => [Chunk] +schemaChunksViaCodec :: forall a. (HasCodec a) => [Chunk] schemaChunksViaCodec = schemaChunksVia (codec @a) -- | Produce potentially-coloured 'Chunk's for a human-readable schema for a given codec. diff --git a/autodocodec/autodocodec.cabal b/autodocodec/autodocodec.cabal index a2acab8..4c0a972 100644 --- a/autodocodec/autodocodec.cabal +++ b/autodocodec/autodocodec.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.35.2. +-- This file has been generated from package.yaml by hpack version 0.36.0. -- -- see: https://github.com/sol/hpack diff --git a/autodocodec/src/Autodocodec/Aeson.hs b/autodocodec/src/Autodocodec/Aeson.hs index 567ccde..baa5cd1 100644 --- a/autodocodec/src/Autodocodec/Aeson.hs +++ b/autodocodec/src/Autodocodec/Aeson.hs @@ -39,9 +39,9 @@ import qualified Data.Aeson as Aeson import qualified Data.ByteString.Lazy as LB -- | Encode a value as a JSON 'LB.ByteString' via its type's 'codec'. -encodeJSONViaCodec :: HasCodec a => a -> LB.ByteString +encodeJSONViaCodec :: (HasCodec a) => a -> LB.ByteString encodeJSONViaCodec = Aeson.encode . Autodocodec -- | Parse a JSON 'LB.ByteString' using a type's 'codec'. -eitherDecodeJSONViaCodec :: HasCodec a => LB.ByteString -> Either String a +eitherDecodeJSONViaCodec :: (HasCodec a) => LB.ByteString -> Either String a eitherDecodeJSONViaCodec = fmap unAutodocodec . Aeson.eitherDecode diff --git a/autodocodec/src/Autodocodec/Aeson/Compat.hs b/autodocodec/src/Autodocodec/Aeson/Compat.hs index afee18e..88c7489 100644 --- a/autodocodec/src/Autodocodec/Aeson/Compat.hs +++ b/autodocodec/src/Autodocodec/Aeson/Compat.hs @@ -69,21 +69,21 @@ map :: (v1 -> v2) -> HM.HashMap Text v1 -> HM.HashMap Text v2 map = HM.map #endif -liftToJSON :: JSON.ToJSON1 f => (a -> JSON.Value) -> ([a] -> JSON.Value) -> f a -> JSON.Value +liftToJSON :: (JSON.ToJSON1 f) => (a -> JSON.Value) -> ([a] -> JSON.Value) -> f a -> JSON.Value #if MIN_VERSION_aeson(2,2,0) liftToJSON = JSON.liftToJSON (const False) #else liftToJSON = JSON.liftToJSON #endif -liftToEncoding :: JSON.ToJSON1 f => (a -> JSON.Encoding) -> ([a] -> JSON.Encoding) -> f a -> JSON.Encoding +liftToEncoding :: (JSON.ToJSON1 f) => (a -> JSON.Encoding) -> ([a] -> JSON.Encoding) -> f a -> JSON.Encoding #if MIN_VERSION_aeson(2,2,0) liftToEncoding = JSON.liftToEncoding (const False) #else liftToEncoding = JSON.liftToEncoding #endif -liftParseJSON :: JSON.FromJSON1 f => (JSON.Value -> JSON.Parser a) -> (JSON.Value -> JSON.Parser [a]) -> JSON.Value -> JSON.Parser (f a) +liftParseJSON :: (JSON.FromJSON1 f) => (JSON.Value -> JSON.Parser a) -> (JSON.Value -> JSON.Parser [a]) -> JSON.Value -> JSON.Parser (f a) #if MIN_VERSION_aeson(2,2,0) liftParseJSON = JSON.liftParseJSON Nothing #else diff --git a/autodocodec/src/Autodocodec/Aeson/Decode.hs b/autodocodec/src/Autodocodec/Aeson/Decode.hs index 14a785e..1263a80 100644 --- a/autodocodec/src/Autodocodec/Aeson/Decode.hs +++ b/autodocodec/src/Autodocodec/Aeson/Decode.hs @@ -33,14 +33,14 @@ import Data.Vector (Vector) import qualified Data.Vector as V -- | Implement 'JSON.parseJSON' via a type's codec. -parseJSONViaCodec :: HasCodec a => JSON.Value -> JSON.Parser a +parseJSONViaCodec :: (HasCodec a) => JSON.Value -> JSON.Parser a parseJSONViaCodec = parseJSONVia codec -- | Implement 'JSON.parseJSON' via a given codec. parseJSONVia :: ValueCodec void a -> JSON.Value -> JSON.Parser a parseJSONVia = parseJSONContextVia -parseJSONObjectViaCodec :: HasObjectCodec a => JSON.Object -> JSON.Parser a +parseJSONObjectViaCodec :: (HasObjectCodec a) => JSON.Object -> JSON.Parser a parseJSONObjectViaCodec = parseJSONObjectVia objectCodec parseJSONObjectVia :: ObjectCodec void a -> JSON.Object -> JSON.Parser a @@ -152,5 +152,5 @@ parseJSONContextVia codec_ context_ = PureCodec a -> pure a ApCodec ocf oca -> go (value :: JSON.Object) ocf <*> go (value :: JSON.Object) oca -instance HasCodec a => JSON.FromJSON (Autodocodec a) where +instance (HasCodec a) => JSON.FromJSON (Autodocodec a) where parseJSON = fmap Autodocodec <$> parseJSONViaCodec diff --git a/autodocodec/src/Autodocodec/Aeson/Encode.hs b/autodocodec/src/Autodocodec/Aeson/Encode.hs index c702ca8..71c710c 100644 --- a/autodocodec/src/Autodocodec/Aeson/Encode.hs +++ b/autodocodec/src/Autodocodec/Aeson/Encode.hs @@ -33,10 +33,10 @@ import Data.Vector (Vector) import qualified Data.Vector as V -- | Implement 'JSON.toJSON' via a type's codec. -toJSONViaCodec :: HasCodec a => a -> JSON.Value +toJSONViaCodec :: (HasCodec a) => a -> JSON.Value toJSONViaCodec = toJSONVia codec -toJSONObjectViaCodec :: HasObjectCodec a => a -> JSON.Object +toJSONObjectViaCodec :: (HasObjectCodec a) => a -> JSON.Object toJSONObjectViaCodec = toJSONObjectVia objectCodec toJSONObjectVia :: ObjectCodec a void -> a -> JSON.Object @@ -90,10 +90,10 @@ toJSONVia = flip go ReferenceCodec _ c -> go a c -- | Implement 'JSON.toEncoding' via a type's codec. -toEncodingViaCodec :: HasCodec a => a -> JSON.Encoding +toEncodingViaCodec :: (HasCodec a) => a -> JSON.Encoding toEncodingViaCodec = toEncodingVia codec -toSeriesViaCodec :: HasObjectCodec a => a -> JSON.Series +toSeriesViaCodec :: (HasObjectCodec a) => a -> JSON.Series toSeriesViaCodec = toSeriesVia objectCodec toSeriesVia :: ObjectCodec a void -> a -> JSON.Series @@ -144,6 +144,6 @@ toEncodingVia = flip go CommentCodec _ c -> go a c ReferenceCodec _ c -> go a c -instance HasCodec a => JSON.ToJSON (Autodocodec a) where +instance (HasCodec a) => JSON.ToJSON (Autodocodec a) where toJSON = toJSONViaCodec . unAutodocodec toEncoding = toEncodingViaCodec . unAutodocodec diff --git a/autodocodec/src/Autodocodec/Class.hs b/autodocodec/src/Autodocodec/Class.hs index 1b671eb..2e8de63 100644 --- a/autodocodec/src/Autodocodec/Class.hs +++ b/autodocodec/src/Autodocodec/Class.hs @@ -119,10 +119,10 @@ instance HasCodec Natural where instance HasCodec JSON.Value where codec = ValueCodec -instance HasCodec a => HasCodec (Identity a) where +instance (HasCodec a) => HasCodec (Identity a) where codec = dimapCodec runIdentity Identity codec -instance HasCodec a => HasCodec (Maybe a) where +instance (HasCodec a) => HasCodec (Maybe a) where codec = maybeCodec codec instance (HasCodec l, HasCodec r) => HasCodec (Either l r) where @@ -131,13 +131,13 @@ instance (HasCodec l, HasCodec r) => HasCodec (Either l r) where (ObjectOfCodec Nothing (requiredField' "Left")) (ObjectOfCodec Nothing (requiredField' "Right")) -instance HasCodec a => HasCodec (Vector a) where +instance (HasCodec a) => HasCodec (Vector a) where codec = vectorCodec codec -instance HasCodec a => HasCodec [a] where +instance (HasCodec a) => HasCodec [a] where codec = listCodecForStringCompatibility -instance HasCodec a => HasCodec (NonEmpty a) where +instance (HasCodec a) => HasCodec (NonEmpty a) where codec = nonEmptyCodec codec instance (Ord a, HasCodec a) => HasCodec (Set a) where @@ -194,7 +194,7 @@ class HasObjectCodec object where -- -- See 'requiredFieldWith' requiredField :: - HasCodec output => + (HasCodec output) => -- | Key Text -> -- | Documentation @@ -204,7 +204,7 @@ requiredField key = requiredFieldWith key codec -- | Like 'requiredField', but without documentation requiredField' :: - HasCodec output => + (HasCodec output) => -- | Key Text -> ObjectCodec output output @@ -218,7 +218,7 @@ requiredField' key = requiredFieldWith' key codec -- -- See 'optionalFieldWith' optionalField :: - HasCodec output => + (HasCodec output) => -- | Key Text -> -- | Documentation @@ -228,7 +228,7 @@ optionalField key = optionalFieldWith key codec -- | Like 'optionalField', but without documentation optionalField' :: - HasCodec output => + (HasCodec output) => -- | Key Text -> ObjectCodec (Maybe output) (Maybe output) @@ -270,7 +270,7 @@ optionalFieldWithDefault' key defaultValue = optionalFieldWithDefaultWith' key c -- During encoding, the field will be in the object if it is not 'Nothing', and omitted otherwise. optionalFieldOrNull :: forall output. - HasCodec output => + (HasCodec output) => -- | Key Text -> -- | Documentation @@ -281,7 +281,7 @@ optionalFieldOrNull key doc = orNullHelper $ OptionalKeyCodec key (maybeCodec co -- | Like 'optionalFieldOrNull', but without documentation optionalFieldOrNull' :: forall output. - HasCodec output => + (HasCodec output) => -- | Key Text -> ObjectCodec (Maybe output) (Maybe output) diff --git a/autodocodec/src/Autodocodec/Codec.hs b/autodocodec/src/Autodocodec/Codec.hs index 4795ec2..5a0edf7 100644 --- a/autodocodec/src/Autodocodec/Codec.hs +++ b/autodocodec/src/Autodocodec/Codec.hs @@ -235,7 +235,7 @@ data Codec context input output where Maybe Text -> ObjectCodec value value OptionalKeyWithOmittedDefaultCodec :: - Eq value => + (Eq value) => -- | Key Text -> -- | Codec for the value @@ -975,7 +975,7 @@ optionalFieldWithDefaultWith' key c defaultValue = OptionalKeyWithDefaultCodec k -- -- The shown version of the default value will appear in the documentation. optionalFieldWithOmittedDefaultWith :: - Eq output => + (Eq output) => -- | Key Text -> -- | Codec for the value @@ -989,7 +989,7 @@ optionalFieldWithOmittedDefaultWith key c defaultValue doc = OptionalKeyWithOmit -- | Like 'optionalFieldWithOmittedDefaultWith', but without documentation. optionalFieldWithOmittedDefaultWith' :: - Eq output => + (Eq output) => -- | Key Text -> -- | Codec for the value @@ -1002,7 +1002,7 @@ optionalFieldWithOmittedDefaultWith' key c defaultValue = OptionalKeyWithOmitted -- | Like 'optionalFieldWithOmittedDefaultWith', but the value may also be -- @null@ and that will be interpreted as the default value. optionalFieldOrNullWithOmittedDefaultWith :: - Eq output => + (Eq output) => -- | Key Text -> -- | Codec for the value @@ -1022,7 +1022,7 @@ optionalFieldOrNullWithOmittedDefaultWith key c defaultValue doc = dimapCodec f -- | Like 'optionalFieldWithOmittedDefaultWith'', but the value may also be -- @null@ and that will be interpreted as the default value. optionalFieldOrNullWithOmittedDefaultWith' :: - Eq output => + (Eq output) => -- | Key Text -> -- | Codec for the value @@ -1720,7 +1720,7 @@ parseAlternative c cAlt = matchChoiceCodec c cAlt Left -- If you don't provide a string for one of the type's constructors, the last codec in the list will be used instead. enumCodec :: forall enum context. - Eq enum => + (Eq enum) => NonEmpty (enum, Codec context enum enum) -> Codec context enum enum enumCodec = go @@ -1755,7 +1755,7 @@ enumCodec = go -- String "foo" stringConstCodec :: forall constant. - Eq constant => + (Eq constant) => NonEmpty (constant, Text) -> JSONCodec constant stringConstCodec = diff --git a/flake.lock b/flake.lock index eee1a91..7a4932d 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "fast-myers-diff": { "flake": false, "locked": { - "lastModified": 1696885120, - "narHash": "sha256-wqJ0/P3pXOISDhRHpEt11GVYllb+DFt46Mh+k/y1bYw=", + "lastModified": 1701674450, + "narHash": "sha256-1RP8wXPZGKB/OSdxcjvxAJCqC+trWzrNcD7UGAdpHiA=", "owner": "NorfairKing", "repo": "fast-myers-diff", - "rev": "c106ef803c69ef9440399247ec4ffd59c84f6fc7", + "rev": "7fe372e635f293cc76de95773bdc4f0eaae89597", "type": "github" }, "original": { @@ -19,11 +19,11 @@ "flake-compat": { "flake": false, "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", "owner": "edolstra", "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", "type": "github" }, "original": { @@ -37,11 +37,11 @@ "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1701473968, - "narHash": "sha256-YcVE5emp1qQ8ieHUnxt1wCZCC3ZfAS+SRRWZ2TMda7E=", + "lastModified": 1715865404, + "narHash": "sha256-/GJvTdTpuDjNn84j82cU6bXztE0MSkdnTWClUCRub78=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "34fed993f1674c8d06d58b37ce1e0fe5eebcb9f5", + "rev": "8dc45382d5206bd292f9c2768b8058a8fd8311d9", "type": "github" }, "original": { @@ -55,47 +55,11 @@ "nixpkgs-lib": "nixpkgs-lib_2" }, "locked": { - "lastModified": 1701473968, - "narHash": "sha256-YcVE5emp1qQ8ieHUnxt1wCZCC3ZfAS+SRRWZ2TMda7E=", + "lastModified": 1706830856, + "narHash": "sha256-a0NYyp+h9hlb7ddVz4LUn1vT/PLwqfrWYcHMvFB1xYg=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "34fed993f1674c8d06d58b37ce1e0fe5eebcb9f5", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "flake-parts", - "type": "github" - } - }, - "flake-parts_3": { - "inputs": { - "nixpkgs-lib": "nixpkgs-lib_3" - }, - "locked": { - "lastModified": 1701473968, - "narHash": "sha256-YcVE5emp1qQ8ieHUnxt1wCZCC3ZfAS+SRRWZ2TMda7E=", - "owner": "hercules-ci", - "repo": "flake-parts", - "rev": "34fed993f1674c8d06d58b37ce1e0fe5eebcb9f5", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "flake-parts", - "type": "github" - } - }, - "flake-parts_4": { - "inputs": { - "nixpkgs-lib": "nixpkgs-lib_4" - }, - "locked": { - "lastModified": 1701473968, - "narHash": "sha256-YcVE5emp1qQ8ieHUnxt1wCZCC3ZfAS+SRRWZ2TMda7E=", - "owner": "hercules-ci", - "repo": "flake-parts", - "rev": "34fed993f1674c8d06d58b37ce1e0fe5eebcb9f5", + "rev": "b253292d9c0a5ead9bc98c4e9a26c6312e27d69f", "type": "github" }, "original": { @@ -119,69 +83,6 @@ "type": "github" } }, - "flake-utils_2": { - "locked": { - "lastModified": 1644229661, - "narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_3": { - "locked": { - "lastModified": 1644229661, - "narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_4": { - "locked": { - "lastModified": 1644229661, - "narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_5": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1685518550, - "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "gitignore": { "inputs": { "nixpkgs": [ @@ -190,11 +91,11 @@ ] }, "locked": { - "lastModified": 1660459072, - "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", "owner": "hercules-ci", "repo": "gitignore.nix", - "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", "type": "github" }, "original": { @@ -205,18 +106,21 @@ }, "horizon-advance": { "inputs": { - "flake-parts": "flake-parts", + "flake-parts": [ + "horizon-advance", + "horizon-core", + "flake-parts" + ], "horizon-core": "horizon-core", "horizon-hoogle": "horizon-hoogle_2", - "lint-utils": "lint-utils_4", - "nixpkgs": "nixpkgs_8" + "nixpkgs": "nixpkgs_4" }, "locked": { - "lastModified": 1701590988, - "narHash": "sha256-2/AYk1nKj5QIHdh3juuqPc5YIQB1A83WLq3RzjC0408=", + "lastModified": 1717012228, + "narHash": "sha256-UIpKU6LuVl/NyXfjiiORU/U5husGdJ2bu8uem9cuJaY=", "ref": "refs/heads/master", - "rev": "a449a4988eea3d9dd75a945d6eb0668c06a12972", - "revCount": 107, + "rev": "ee6680b0c3fb1a78fb306132e791615939d9dba5", + "revCount": 247, "type": "git", "url": "https://gitlab.horizon-haskell.net/package-sets/horizon-advance" }, @@ -227,17 +131,22 @@ }, "horizon-build-packages": { "inputs": { - "flake-parts": "flake-parts_3", + "flake-parts": [ + "horizon-advance", + "horizon-core", + "horizon-build-packages", + "horizon-ghc", + "flake-parts" + ], "horizon-ghc": "horizon-ghc", - "lint-utils": "lint-utils_2", - "nixpkgs": "nixpkgs_4" + "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1701564295, - "narHash": "sha256-ibYE2ZnXBLDlZax5YkDeCsK4uw+8G/34ryotBut0IHY=", + "lastModified": 1716737729, + "narHash": "sha256-SXTIu6TI4Rr3dS0uz1B9Z2hFGIfcwQb9C01HHbVLDR4=", "ref": "refs/heads/master", - "rev": "f9c03cb2e31af63709cde8b4b6421b0e3c6d42fc", - "revCount": 6, + "rev": "9e75556c0249b074322829f2c1825d33de1c9ee1", + "revCount": 89, "type": "git", "url": "https://gitlab.horizon-haskell.net/package-sets/horizon-build-packages" }, @@ -248,18 +157,17 @@ }, "horizon-core": { "inputs": { - "flake-parts": "flake-parts_2", + "flake-parts": "flake-parts", "horizon-build-packages": "horizon-build-packages", "horizon-hoogle": "horizon-hoogle", - "lint-utils": "lint-utils_3", - "nixpkgs": "nixpkgs_6" + "nixpkgs": "nixpkgs_3" }, "locked": { - "lastModified": 1701564656, - "narHash": "sha256-pfpZwQG/jsytUxhh2i1QlruaHfLouUYUqK2muLLvRZE=", + "lastModified": 1717010610, + "narHash": "sha256-P4/chUeLzOMNIp9tig9SOz4F9ZtweV6nSrafJd9ixzo=", "ref": "refs/heads/master", - "rev": "94bae51d90c2a5e5fd89fe45285a10c36e98b0cd", - "revCount": 1222, + "rev": "0c4c5338351fcd82ddb94ada87f73f9c91e29819", + "revCount": 1367, "type": "git", "url": "https://gitlab.horizon-haskell.net/package-sets/horizon-core" }, @@ -270,16 +178,30 @@ }, "horizon-ghc": { "inputs": { - "flake-parts": "flake-parts_4", - "lint-utils": "lint-utils", - "nixpkgs": "nixpkgs_2" + "flake-parts": [ + "horizon-advance", + "horizon-core", + "horizon-build-packages", + "horizon-ghc", + "nixica", + "flake-parts" + ], + "nixica": "nixica", + "nixpkgs": [ + "horizon-advance", + "horizon-core", + "horizon-build-packages", + "horizon-ghc", + "nixica", + "nixpkgs" + ] }, "locked": { - "lastModified": 1701518837, - "narHash": "sha256-92faPC+q5EMNf37EGhdt9pvWWFi0mTq0Szk6wOyxyrQ=", + "lastModified": 1716628408, + "narHash": "sha256-owaGnYzy8NQxaB9KpdsMdDJ5i2WWb9OBrCmAlrdY9OA=", "ref": "refs/heads/master", - "rev": "0b35eb150bfc8ee338688adda23587521cd97da6", - "revCount": 6, + "rev": "1ff3a6b692dbb3fe21533e84502d5c1f4790c4a9", + "revCount": 101, "type": "git", "url": "https://gitlab.horizon-haskell.net/ghc/horizon-ghc" }, @@ -321,91 +243,61 @@ "lint-utils": { "inputs": { "flake-utils": "flake-utils", + "nixpkgs": [ + "horizon-advance", + "horizon-core", + "horizon-build-packages", + "horizon-ghc", + "nixica", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1708583908, + "narHash": "sha256-zuNxxkt/wS8Z5TbGarf4QZVDt1R65dDkEw/s2T/tCW4=", + "owner": "homotopic", + "repo": "lint-utils", + "rev": "2d77caa3644065ee0f462cc5ea654280c59127b2", + "type": "github" + }, + "original": { + "owner": "homotopic", + "repo": "lint-utils", + "type": "github" + } + }, + "nixica": { + "inputs": { + "flake-parts": "flake-parts_2", + "lint-utils": "lint-utils", "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1699441004, - "narHash": "sha256-7v7CH8ZiB2RClPtpgDLfQxeR+14KXoFl2qTdXd27sL0=", + "lastModified": 1709796500, + "narHash": "sha256-No1tx+wo5DjOCPAF6ayhQlRMB3jD6kKdp/9bh/dSN9c=", "ref": "refs/heads/master", - "rev": "226003d10c2d192b088f7c3c9ee7ca549c421a9c", - "revCount": 52, + "rev": "688f425ae7fdc0bb76b907863d27c5efaa19ce8a", + "revCount": 17, "type": "git", - "url": "https://gitlab.nixica.dev/nix/lint-utils" + "url": "https://gitlab.horizon-haskell.net/nix/nixica-library" }, "original": { "type": "git", - "url": "https://gitlab.nixica.dev/nix/lint-utils" - } - }, - "lint-utils_2": { - "inputs": { - "flake-utils": "flake-utils_2", - "nixpkgs": "nixpkgs_3" - }, - "locked": { - "lastModified": 1699441004, - "narHash": "sha256-7v7CH8ZiB2RClPtpgDLfQxeR+14KXoFl2qTdXd27sL0=", - "ref": "refs/heads/master", - "rev": "226003d10c2d192b088f7c3c9ee7ca549c421a9c", - "revCount": 52, - "type": "git", - "url": "https://gitlab.nixica.dev/nix/lint-utils" - }, - "original": { - "type": "git", - "url": "https://gitlab.nixica.dev/nix/lint-utils" - } - }, - "lint-utils_3": { - "inputs": { - "flake-utils": "flake-utils_3", - "nixpkgs": "nixpkgs_5" - }, - "locked": { - "lastModified": 1699441004, - "narHash": "sha256-7v7CH8ZiB2RClPtpgDLfQxeR+14KXoFl2qTdXd27sL0=", - "ref": "refs/heads/master", - "rev": "226003d10c2d192b088f7c3c9ee7ca549c421a9c", - "revCount": 52, - "type": "git", - "url": "https://gitlab.nixica.dev/nix/lint-utils" - }, - "original": { - "type": "git", - "url": "https://gitlab.nixica.dev/nix/lint-utils" - } - }, - "lint-utils_4": { - "inputs": { - "flake-utils": "flake-utils_4", - "nixpkgs": "nixpkgs_7" - }, - "locked": { - "lastModified": 1699441004, - "narHash": "sha256-7v7CH8ZiB2RClPtpgDLfQxeR+14KXoFl2qTdXd27sL0=", - "ref": "refs/heads/master", - "rev": "226003d10c2d192b088f7c3c9ee7ca549c421a9c", - "revCount": 52, - "type": "git", - "url": "https://gitlab.nixica.dev/nix/lint-utils" - }, - "original": { - "type": "git", - "url": "https://gitlab.nixica.dev/nix/lint-utils" + "url": "https://gitlab.horizon-haskell.net/nix/nixica-library" } }, "nixpkgs": { "locked": { - "lastModified": 1644525281, - "narHash": "sha256-D3VuWLdnLmAXIkooWAtbTGSQI9Fc1lkvAr94wTxhnTU=", + "lastModified": 1708992772, + "narHash": "sha256-TWy2VNWAzNOPbZ1InbJtm7GYOyIG/BWKPCwmNDCnDLs=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "48d63e924a2666baf37f4f14a18f19347fbd54a2", + "rev": "7e5ed63169046d8250ded004cfbd5f8b13b264e7", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-unstable", + "ref": "haskell-updates", "repo": "nixpkgs", "type": "github" } @@ -460,11 +352,11 @@ }, "nixpkgs-23_05": { "locked": { - "lastModified": 1701540982, - "narHash": "sha256-5ajSy6ODgGmAbmymRdHnjfVnuVrACjI8wXoGVvrtvww=", + "lastModified": 1704290814, + "narHash": "sha256-LWvKHp7kGxk/GEtlrGYV68qIvPHkU9iToomNFGagixU=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "6386d8aafc28b3a7ed03880a57bdc6eb4465491d", + "rev": "70bdadeb94ffc8806c0570eb5c2695ad29f0e421", "type": "github" }, "original": { @@ -476,66 +368,24 @@ }, "nixpkgs-lib": { "locked": { - "dir": "lib", - "lastModified": 1701253981, - "narHash": "sha256-ztaDIyZ7HrTAfEEUt9AtTDNoCYxUdSd6NrRHaYOIxtk=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "e92039b55bcd58469325ded85d4f58dd5a4eaf58", - "type": "github" + "lastModified": 1714640452, + "narHash": "sha256-QBx10+k6JWz6u7VsohfSw8g8hjdBZEf8CFzXH1/1Z94=", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/50eb7ecf4cd0a5756d7275c8ba36790e5bd53e33.tar.gz" }, "original": { - "dir": "lib", - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/50eb7ecf4cd0a5756d7275c8ba36790e5bd53e33.tar.gz" } }, "nixpkgs-lib_2": { "locked": { "dir": "lib", - "lastModified": 1701253981, - "narHash": "sha256-ztaDIyZ7HrTAfEEUt9AtTDNoCYxUdSd6NrRHaYOIxtk=", + "lastModified": 1706550542, + "narHash": "sha256-UcsnCG6wx++23yeER4Hg18CXWbgNpqNXcHIo5/1Y+hc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "e92039b55bcd58469325ded85d4f58dd5a4eaf58", - "type": "github" - }, - "original": { - "dir": "lib", - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-lib_3": { - "locked": { - "dir": "lib", - "lastModified": 1701253981, - "narHash": "sha256-ztaDIyZ7HrTAfEEUt9AtTDNoCYxUdSd6NrRHaYOIxtk=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "e92039b55bcd58469325ded85d4f58dd5a4eaf58", - "type": "github" - }, - "original": { - "dir": "lib", - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-lib_4": { - "locked": { - "dir": "lib", - "lastModified": 1701253981, - "narHash": "sha256-ztaDIyZ7HrTAfEEUt9AtTDNoCYxUdSd6NrRHaYOIxtk=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "e92039b55bcd58469325ded85d4f58dd5a4eaf58", + "rev": "97b17f32362e475016f942bbdfda4a4a72a8a652", "type": "github" }, "original": { @@ -548,155 +398,11 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1685801374, - "narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=", + "lastModified": 1710695816, + "narHash": "sha256-3Eh7fhEID17pv9ZxrPwCLfqXnYP006RKzSs0JptsN84=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "c37ca420157f4abc31e26f436c1145f8951ff373", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-23.05", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_10": { - "locked": { - "lastModified": 1689261696, - "narHash": "sha256-LzfUtFs9MQRvIoQ3MfgSuipBVMXslMPH/vZ+nM40LkA=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "df1eee2aa65052a18121ed4971081576b25d6b5c", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_2": { - "locked": { - "lastModified": 1701253981, - "narHash": "sha256-ztaDIyZ7HrTAfEEUt9AtTDNoCYxUdSd6NrRHaYOIxtk=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "e92039b55bcd58469325ded85d4f58dd5a4eaf58", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_3": { - "locked": { - "lastModified": 1644525281, - "narHash": "sha256-D3VuWLdnLmAXIkooWAtbTGSQI9Fc1lkvAr94wTxhnTU=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "48d63e924a2666baf37f4f14a18f19347fbd54a2", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_4": { - "locked": { - "lastModified": 1701253981, - "narHash": "sha256-ztaDIyZ7HrTAfEEUt9AtTDNoCYxUdSd6NrRHaYOIxtk=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "e92039b55bcd58469325ded85d4f58dd5a4eaf58", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_5": { - "locked": { - "lastModified": 1644525281, - "narHash": "sha256-D3VuWLdnLmAXIkooWAtbTGSQI9Fc1lkvAr94wTxhnTU=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "48d63e924a2666baf37f4f14a18f19347fbd54a2", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_6": { - "locked": { - "lastModified": 1701253981, - "narHash": "sha256-ztaDIyZ7HrTAfEEUt9AtTDNoCYxUdSd6NrRHaYOIxtk=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "e92039b55bcd58469325ded85d4f58dd5a4eaf58", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_7": { - "locked": { - "lastModified": 1644525281, - "narHash": "sha256-D3VuWLdnLmAXIkooWAtbTGSQI9Fc1lkvAr94wTxhnTU=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "48d63e924a2666baf37f4f14a18f19347fbd54a2", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_8": { - "locked": { - "lastModified": 1701253981, - "narHash": "sha256-ztaDIyZ7HrTAfEEUt9AtTDNoCYxUdSd6NrRHaYOIxtk=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "e92039b55bcd58469325ded85d4f58dd5a4eaf58", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_9": { - "locked": { - "lastModified": 1701539137, - "narHash": "sha256-nVO/5QYpf1GwjvtpXhyxx5M3U/WN0MwBro4Lsk+9mL0=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "933d7dc155096e7575d207be6fb7792bc9f34f6d", + "rev": "614b4613980a522ba49f0d194531beddbb7220d3", "type": "github" }, "original": { @@ -706,20 +412,99 @@ "type": "github" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 1716596003, + "narHash": "sha256-WW4LMtqDXBqXQ1TlMpCYZhpkwxQsr77RvLb8UfdaSXs=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "edc6c261ab4ffb277af409e37a52718a91b255bc", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "haskell-updates", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1716941663, + "narHash": "sha256-gwGF1JseZqX7xAGxH6Rqec1MHpHCsrv9DeynO3aTZsA=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a3713f011c88039a21cadbaf012a962c903747e5", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "haskell-updates", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_4": { + "locked": { + "lastModified": 1716941663, + "narHash": "sha256-gwGF1JseZqX7xAGxH6Rqec1MHpHCsrv9DeynO3aTZsA=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a3713f011c88039a21cadbaf012a962c903747e5", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "haskell-updates", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_5": { + "locked": { + "lastModified": 1716633019, + "narHash": "sha256-xim1b5/HZYbWaZKyI7cn9TJCM6ewNVZnesRr00mXeS4=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9d29cd266cebf80234c98dd0b87256b6be0af44e", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-23.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_6": { + "locked": { + "lastModified": 1710765496, + "narHash": "sha256-p7ryWEeQfMwTB6E0wIUd5V2cFTgq+DRRBz2hYGnJZyA=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "e367f7a1fb93137af22a3908f00b9a35e2d286a7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "pre-commit-hooks": { "inputs": { "flake-compat": "flake-compat", - "flake-utils": "flake-utils_5", "gitignore": "gitignore", - "nixpkgs": "nixpkgs_10", + "nixpkgs": "nixpkgs_6", "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1700922917, - "narHash": "sha256-ej2fch/T584b5K9sk1UhmZF7W6wEfDHuoUYpFN8dtvM=", + "lastModified": 1716213921, + "narHash": "sha256-xrsYFST8ij4QWaV6HEokCUNIZLjjLP1bYC60K8XiBVA=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "e5ee5c5f3844550c01d2131096c7271cec5e9b78", + "rev": "0e8fcc54b842ad8428c9e705cb5994eaf05c26a0", "type": "github" }, "original": { @@ -732,7 +517,7 @@ "inputs": { "fast-myers-diff": "fast-myers-diff", "horizon-advance": "horizon-advance", - "nixpkgs": "nixpkgs_9", + "nixpkgs": "nixpkgs_5", "nixpkgs-21_11": "nixpkgs-21_11", "nixpkgs-22_05": "nixpkgs-22_05", "nixpkgs-22_11": "nixpkgs-22_11", @@ -746,11 +531,11 @@ "safe-coloured-text": { "flake": false, "locked": { - "lastModified": 1696884906, - "narHash": "sha256-7CanCNOCB5gFwqhEPFIoOojoM1iVJZKF5YRy7unUDuo=", + "lastModified": 1717050271, + "narHash": "sha256-pSpfWpwS08HFMsShTe+QGBTHrJ4VTUP9nF/zxVwM4ok=", "owner": "NorfairKing", "repo": "safe-coloured-text", - "rev": "50abcbfa2a2ed15c6186fa2381fe818bd93a730b", + "rev": "ad5a6a204ce4701dec54a7273a4cd70572a4e9cf", "type": "github" }, "original": { @@ -762,11 +547,11 @@ "sydtest": { "flake": false, "locked": { - "lastModified": 1696883645, - "narHash": "sha256-Yr5piSv96hgKC7z7aHqo8kMKJPyL8ZG2lbDb7oFUZxw=", + "lastModified": 1701869719, + "narHash": "sha256-+qrn2utn8W754ifrm5phT3DtAtK78vjlNObFWRHRxHg=", "owner": "NorfairKing", "repo": "sydtest", - "rev": "6313c1b211d14c1215cdf97b9933675cf9c2adb9", + "rev": "d22ec20ca32854f880295cb373f84e874be916bb", "type": "github" }, "original": { @@ -775,29 +560,14 @@ "type": "github" } }, - "systems": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, "validity": { "flake": false, "locked": { - "lastModified": 1696884006, - "narHash": "sha256-w2dKXZrNxXm/hsYkef5ZLTDxm3IsIzdj3i2qc1GC+A8=", + "lastModified": 1717013463, + "narHash": "sha256-fvvwX8l7CN2ErNqd6AbdvzuyL3+aOM8oGkHFm8ezNro=", "owner": "NorfairKing", "repo": "validity", - "rev": "34e17fe6d92765209f1db8127aee13c74285805d", + "rev": "63105e3de6022f8e23ccc39db7974613e089487c", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 34e0d42..cc68ad0 100644 --- a/flake.nix +++ b/flake.nix @@ -91,14 +91,7 @@ niv zlib cabal-install - ]) ++ (with pre-commit-hooks.packages.${system}; - [ - hlint - hpack - nixpkgs-fmt - ormolu - cabal2nix - ]); + ]) ++ self.checks.${system}.pre-commit.enabledPackages; shellHook = self.checks.${system}.pre-commit.shellHook; }; nix-ci.cachix = { diff --git a/stack.yaml b/stack.yaml index 7de130a..9d37d59 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,4 +1,4 @@ -resolver: lts-20.25 +resolver: lts-21.22 packages: - autodocodec - autodocodec-api-usage @@ -35,7 +35,6 @@ extra-deps: - sydtest - sydtest-aeson - sydtest-discover -- envparse-0.4.1@sha256:989902e6368532548f61de1fa245ad2b39176cddd8743b20071af519a709ce30,2842 ghc-options: "$locals": -Wall -Wincomplete-uni-patterns -Wincomplete-record-updates -Wpartial-fields -Widentities -Wredundant-constraints -Wcpp-undef