File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -76,6 +76,7 @@ module Codec.Archive.Tar.Types (
7676 unfoldEntriesM ,
7777 ) where
7878
79+ import Data.Bifunctor (Bifunctor , bimap )
7980import Data.Int (Int64 )
8081import Data.List.NonEmpty (NonEmpty (.. ))
8182import Data.Monoid (Monoid (.. ))
@@ -145,7 +146,18 @@ data GenEntry tarPath linkTarget = Entry {
145146 -- | The tar format the archive is using.
146147 entryFormat :: ! Format
147148 }
148- deriving (Eq , Show )
149+ deriving
150+ ( Eq
151+ , Show
152+ , Functor -- ^ @since 0.6.4.0
153+ )
154+
155+ -- | @since 0.6.4.0
156+ instance Bifunctor GenEntry where
157+ bimap f g e = e
158+ { entryTarPath = f (entryTarPath e)
159+ , entryContent = fmap g (entryContent e)
160+ }
149161
150162-- | Monomorphic tar archive entry, ready for serialization / deserialization.
151163--
@@ -178,7 +190,12 @@ data GenEntryContent linkTarget
178190 | NamedPipe
179191 | OtherEntryType {- # UNPACK #-} !TypeCode LBS. ByteString
180192 {- # UNPACK #-} !FileSize
181- deriving (Eq , Ord , Show )
193+ deriving
194+ ( Eq
195+ , Ord
196+ , Show
197+ , Functor -- ^ @since 0.6.4.0
198+ )
182199
183200-- | Monomorphic content of a tar archive entry,
184201-- ready for serialization / deserialization.
You can’t perform that action at this time.
0 commit comments