Skip to content

Cosmetic changes for publishing in Hackage #82

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.direnv

.devenv
dist-newstyle
dist-newstyle
.vscode
3 changes: 0 additions & 3 deletions .vscode/settings.json

This file was deleted.

17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<h1 align="center">Cuddle</h1>

Cuddle is a library for generating and manipulating [CDDL](https://datatracker.ietf.org/doc/html/rfc8610).
Cuddle is a library for generating and manipulating [CDDL](https://datatracker.ietf.org/doc/html/rfc8610).

<p align="center">
<a href="https://github.com/input-output-hk/cuddle/actions/workflows/ci.yml">
Expand All @@ -27,7 +27,7 @@ Cuddle currently supports the following CDDL features:
### Partial support

- Representation types
- Representation types are correctly parsed and formatted, but only certain
- Representation types are correctly parsed and formatted, but only certain
types are understood in CBOR generation.
- Cuts
- Cut syntax is parsed and formatted, but ignored for CBOR generation.
Expand All @@ -46,27 +46,28 @@ Cuddle currently supports the following CDDL features:
## The cuddle tool

Included in this package is a command line tool for working with CDDL files. It
currently supports three functions:
currently supports four functions:

- Formatting of CDDL files
- Validating that a CDDL file is legal
- Generating random CBOR terms matching CDDL productions.
- Generating random CBOR terms matching CDDL productions
- Testing compliance of a CBOR file against a CDDL spec.

# Huddle

One of the principal features of Cuddle is the ability to define your CDDL in a
One of the principal features of Cuddle is the ability to define your CDDL in a
Haskell DSL, called Huddle. This offers the following benefits:

- Ability to use Haskell's abstraction facilities to define more complex CDDL
- Ability to use Haskell's abstraction facilities to define more complex CDDL
constructions.
- Some measure of compile-time safety for your CDDL. Attempting to reference
an undefined identifier will be a compile-time error, for example.
- The ability to modularise your configuration. CDDL lacks any real facility
for splitting a CDDL spec amongst multiple files. We solve this instead using
Haskell's module system.

Obviously, this comes with the downside of needing to sensibly mesh the
different abstraction facilities offered by Haskell and CDDL. We have tried to
Obviously, this comes with the downside of needing to sensibly mesh the
different abstraction facilities offered by Haskell and CDDL. We have tried to
find a balance where the Huddle code roughly matches the CDDL but gains many
of the advantages of writing in Haskell.

Expand Down
200 changes: 112 additions & 88 deletions cuddle.cabal
Original file line number Diff line number Diff line change
@@ -1,32 +1,55 @@
cabal-version: 3.4
name: cuddle
version: 0.5.0.0
synopsis: CDDL Generator and test utilities

-- description:
license: Apache-2.0
license-file: LICENSE
author: IOG Ledger Team
maintainer: [email protected]

-- copyright:
category: Codec
build-type: Simple
cabal-version: 3.4
name: cuddle
version: 0.5.0.0
synopsis: CDDL Generator and test utilities
description:
Cuddle is a library for generating and manipulating [CDDL](https://datatracker.ietf.org/doc/html/rfc8610).

Included in this package is a command line tool for working with CDDL files. It
currently supports four functions:

- Formatting of CDDL files
- Validating that a CDDL file is legal
- Generating random CBOR terms matching CDDL productions
- Testing compliance of a CBOR file against a CDDL spec.

license: Apache-2.0
license-file: LICENSE
author: IOG Ledger Team
maintainer: [email protected], [email protected]
copyright: 2025 Input Output Global Inc (IOG)
category: Codec
build-type: Simple
extra-doc-files: CHANGELOG.md
tested-with: ghc =={9.6, 9.8, 9.10, 9.12}

-- extra-source-files:
source-repository head
type: git
location: https://github.com/input-output-hk/cuddle

source-repository this
type: git
location: https://github.com/input-output-hk/cuddle
tag: cuddle-0.5.0.0

flag example
description: Enable the example executable
manual: True
default: False

common warnings
ghc-options: -Wall -Werror
ghc-options:
-Wall
-Werror

library
import: warnings
import: warnings
exposed-modules:
Codec.CBOR.Cuddle.CBOR.Gen
Codec.CBOR.Cuddle.CBOR.Validator
Codec.CBOR.Cuddle.CDDL
Codec.CBOR.Cuddle.CDDL.CtlOp
Codec.CBOR.Cuddle.CDDL.CTree
Codec.CBOR.Cuddle.CDDL.CtlOp
Codec.CBOR.Cuddle.CDDL.Postlude
Codec.CBOR.Cuddle.CDDL.Prelude
Codec.CBOR.Cuddle.CDDL.Resolve
Expand All @@ -40,75 +63,77 @@ library
Codec.CBOR.Cuddle.Pretty.Columnar
Codec.CBOR.Cuddle.Pretty.Utils

other-modules:

-- other-extensions:
build-depends:
, base >=4.18.2.1
, base16-bytestring
, boxes
, bytestring
, capability
, cborg
, containers
, data-default-class
, foldable1-classes-compat
, generic-optics
, regex-tdfa
, hashable
, megaparsec
, mtl
, mutable-containers
, optics-core
, ordered-containers
, parser-combinators
, prettyprinter
, random <1.3
, scientific
, text
, tree-diff

hs-source-dirs: src
base >=4.18 && <4.22,
base16-bytestring ^>=1.0.2,
boxes ^>=0.1.5,
bytestring >=0.11.4 && <0.13,
capability ^>=0.5,
cborg ^>=0.2.10,
containers >=0.6.7 && <0.8,
data-default-class ^>=0.2,
foldable1-classes-compat ^>=0.1.1,
generic-optics ^>=2.2.1,
hashable ^>=1.5,
megaparsec ^>=9.7,
mtl ^>=2.3.1,
mutable-containers ^>=0.3.4,
optics-core ^>=0.4.1,
ordered-containers ^>=0.2.4,
parser-combinators ^>=1.3,
prettyprinter ^>=1.7.1,
random <1.3,
regex-tdfa ^>=1.3.2,
scientific ^>=0.3.8,
text >=2.0.2 && <2.2,
tree-diff ^>=0.3.4,

hs-source-dirs: src
default-language: GHC2021

executable example
import: warnings
import: warnings

if flag(example)
buildable: True
else
buildable: False

default-language: GHC2021
other-modules:
Conway
Monad

-- other-extensions:
hs-source-dirs: example
main-is: Main.hs
hs-source-dirs: example
main-is: Main.hs
build-depends:
, base >=4.14.0.0
, cuddle
, megaparsec
, prettyprinter
, random
, text
base,
cuddle,
megaparsec,
prettyprinter,
random,
text,

executable cuddle
import: warnings
import: warnings
default-language: GHC2021
hs-source-dirs: ./bin/
main-is: Main.hs
hs-source-dirs: ./bin/
main-is: Main.hs
build-depends:
, base >=4.14.0.0
, base16-bytestring
, bytestring
, cborg
, cuddle
, megaparsec
, optparse-applicative
, prettyprinter
, random
, mtl
, text
base,
base16-bytestring,
bytestring,
cborg,
cuddle,
megaparsec,
mtl,
optparse-applicative,
prettyprinter,
random,
text,

test-suite cuddle-test
import: warnings
import: warnings
default-language: GHC2021
other-modules:
Test.Codec.CBOR.Cuddle.CDDL.Examples
Expand All @@ -117,21 +142,20 @@ test-suite cuddle-test
Test.Codec.CBOR.Cuddle.CDDL.Pretty
Test.Codec.CBOR.Cuddle.Huddle

-- other-extensions:
type: exitcode-stdio-1.0
hs-source-dirs: test
main-is: Main.hs
type: exitcode-stdio-1.0
hs-source-dirs: test
main-is: Main.hs
build-depends:
, base >=4.14.0.0
, bytestring
, cuddle
, data-default-class
, hspec
, hspec-megaparsec
, HUnit
, megaparsec
, prettyprinter
, string-qq
, QuickCheck
, text
, tree-diff
HUnit ^>=1.6.2,
QuickCheck ^>=2.15,
base,
bytestring,
cuddle,
data-default-class,
hspec ^>=2.11,
hspec-megaparsec ^>=2.2,
megaparsec,
prettyprinter,
string-qq ^>=0.0.6,
text,
tree-diff,
Binary file removed noindex.cache
Binary file not shown.