License + GADT

This commit is contained in:
vegowotenks 2025-07-13 13:24:48 +02:00
parent cc83c07086
commit 547187e428
2 changed files with 10 additions and 24 deletions

View file

@ -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. -- 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 name: java-classfile
version: 0.1.0.0 version: 0.1.0.0
description: Please see the README on GitHub at <https://github.com/githubuser/java-classfile#readme> synopsis: Multi-Stage classfile parsing and verification.
homepage: https://github.com/githubuser/java-classfile#readme description: Please see the README on Forgejo at <https://git.jossco.de/vegowotenks/java-classfile#readme>
bug-reports: https://github.com/githubuser/java-classfile/issues author: VegOwOtenks
author: Author name here
maintainer: example@example.com maintainer: example@example.com
copyright: 2025 Author name here copyright: 2025 VegOwOtenks
license: BSD-3-Clause license: AGPL-3
license-file: LICENSE license-file: LICENSE
build-type: Simple build-type: Simple
extra-source-files: extra-source-files:
README.md README.md
CHANGELOG.md CHANGELOG.md
source-repository head
type: git
location: https://github.com/githubuser/java-classfile
library library
exposed-modules: exposed-modules:
Data.Enum.Util Data.Enum.Util
@ -47,8 +42,6 @@ library
Language.Java.Classfile.Version Language.Java.Classfile.Version
other-modules: other-modules:
Paths_java_classfile Paths_java_classfile
autogen-modules:
Paths_java_classfile
hs-source-dirs: hs-source-dirs:
src src
ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints 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 main-is: Main.hs
other-modules: other-modules:
Paths_java_classfile Paths_java_classfile
autogen-modules:
Paths_java_classfile
hs-source-dirs: hs-source-dirs:
app 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 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 main-is: Spec.hs
other-modules: other-modules:
Paths_java_classfile Paths_java_classfile
autogen-modules:
Paths_java_classfile
hs-source-dirs: hs-source-dirs:
test 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 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

View file

@ -5,6 +5,7 @@
{-# LANGUAGE DataKinds #-} {-# LANGUAGE DataKinds #-}
{-# LANGUAGE StandaloneKindSignatures #-} {-# LANGUAGE StandaloneKindSignatures #-}
{-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
module Language.Java.Classfile.Magic (Magic(..)) where module Language.Java.Classfile.Magic (Magic(..)) where
import Data.Word (Word32) import Data.Word (Word32)
import Language.Java.Classfile.Extractable (Extractable, extract, expectConstant) 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. -- | 'Stage'-indexed Magic type. The 'Resolve' stage is only a unit type.
type Magic :: Stage -> Type type Magic :: Stage -> Type
data family Magic stage data Magic stage where
Magic :: Hex Word32 -> Magic Parse
newtype instance Magic Parse = Magic (Hex Word32) Cafebabe :: Magic Resolve
deriving Show
data instance Magic Resolve = Cafebabe
deriving Show
instance Extractable (Magic Parse) where instance Extractable (Magic Parse) where
extract :: Extract (Magic Parse) extract :: Extract (Magic Parse)