From 547187e4289e55ea26696497c7bcd90bcb9fe6bf Mon Sep 17 00:00:00 2001 From: VegOwOtenks Date: Sun, 13 Jul 2025 13:24:48 +0200 Subject: [PATCH] License + GADT --- java-classfile.cabal | 23 ++++++----------------- src/Language/Java/Classfile/Magic.hs | 11 ++++------- 2 files changed, 10 insertions(+), 24 deletions(-) diff --git a/java-classfile.cabal b/java-classfile.cabal index 222313e..c47d7a3 100644 --- a/java-classfile.cabal +++ b/java-classfile.cabal @@ -1,4 +1,4 @@ -cabal-version: 2.2 +cabal-version: 1.12 -- This file has been generated from package.yaml by hpack version 0.38.1. -- @@ -6,23 +6,18 @@ cabal-version: 2.2 name: java-classfile version: 0.1.0.0 -description: Please see the README on GitHub at -homepage: https://github.com/githubuser/java-classfile#readme -bug-reports: https://github.com/githubuser/java-classfile/issues -author: Author name here +synopsis: Multi-Stage classfile parsing and verification. +description: Please see the README on Forgejo at +author: VegOwOtenks maintainer: example@example.com -copyright: 2025 Author name here -license: BSD-3-Clause +copyright: 2025 VegOwOtenks +license: AGPL-3 license-file: LICENSE build-type: Simple extra-source-files: README.md CHANGELOG.md -source-repository head - type: git - location: https://github.com/githubuser/java-classfile - library exposed-modules: Data.Enum.Util @@ -47,8 +42,6 @@ library Language.Java.Classfile.Version other-modules: Paths_java_classfile - autogen-modules: - Paths_java_classfile hs-source-dirs: src ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints @@ -64,8 +57,6 @@ executable java-classfile-exe main-is: Main.hs other-modules: Paths_java_classfile - autogen-modules: - Paths_java_classfile hs-source-dirs: app ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N @@ -83,8 +74,6 @@ test-suite java-classfile-test main-is: Spec.hs other-modules: Paths_java_classfile - autogen-modules: - Paths_java_classfile hs-source-dirs: test ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N diff --git a/src/Language/Java/Classfile/Magic.hs b/src/Language/Java/Classfile/Magic.hs index 31cc35c..9d75142 100644 --- a/src/Language/Java/Classfile/Magic.hs +++ b/src/Language/Java/Classfile/Magic.hs @@ -5,6 +5,7 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE StandaloneKindSignatures #-} {-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE GADTs #-} module Language.Java.Classfile.Magic (Magic(..)) where import Data.Word (Word32) import Language.Java.Classfile.Extractable (Extractable, extract, expectConstant) @@ -16,13 +17,9 @@ import Data.Kind (Type) -- | 'Stage'-indexed Magic type. The 'Resolve' stage is only a unit type. type Magic :: Stage -> Type -data family Magic stage - -newtype instance Magic Parse = Magic (Hex Word32) - deriving Show - -data instance Magic Resolve = Cafebabe - deriving Show +data Magic stage where + Magic :: Hex Word32 -> Magic Parse + Cafebabe :: Magic Resolve instance Extractable (Magic Parse) where extract :: Extract (Magic Parse)