fix[PrettySerialize]: Optic changes

This commit is contained in:
vegowotenks 2025-08-20 19:50:06 +02:00
parent 5e6736e8da
commit 500bfa349e
3 changed files with 6 additions and 7 deletions

View file

@ -11,6 +11,7 @@
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Language.Java.Classfile (Classfile(..)) where
import GHC.Generics (Generic, Generically(Generically))
@ -59,7 +60,7 @@ data family ClassFlags stage
newtype instance ClassFlags Parse = ClassFlags (Flags ClassFlag)
deriving stock (Show, Generic)
deriving Extractable via Generically (ClassFlags Parse)
deriving PrettySerialize via Generically (ClassFlags Parse)
deriving newtype PrettySerialize
data ClassFlag
= Public -- ^ may be accessed from outside the package

View file

@ -7,9 +7,8 @@
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE DefaultSignatures #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Language.Java.Classfile.Flags (Flags(..), FlagMask(..), containsFlag) where
@ -24,14 +23,13 @@ import Language.Java.Classfile.Extractable (Extractable (extract))
import Data.Kind (Type)
import Control.Arrow ((>>>))
import qualified Data.List as List
import GHC.Generics (Generic, Generically(..))
import Pretty.Serialize (PrettySerialize)
-- | Using the 'FlagMask' instance of the type parameter, this will extract all the flags whose mask produced a non-zero value using '.&.'
newtype Flags a = Flags (Set a)
deriving (Show, Generic)
deriving via Generically (Flags a) instance (PrettySerialize (Set a)) => PrettySerialize (Flags a)
deriving (Show)
deriving newtype PrettySerialize
instance (Extractable (FlagType a), Bounded a, Enum a, Ord a, FlagMask a, Bits (FlagType a), Num (FlagType a)) => Extractable (Flags a) where
extract :: Extract (Flags a)