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

@ -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)