-- it is stupid that we need UndecidableInstances just to call another
-- type function (see instance Apply below which requires this)
{-# LANGUAGE UndecidableInstances #-}
module Darcs.Patch.V1.Prim ( Prim(..) ) where

import Darcs.Prelude

import Data.Coerce ( coerce )

import Darcs.Patch.Annotate ( Annotate(..) )
import Darcs.Patch.Apply ( Apply(..) )
import Darcs.Patch.Commute ( Commute(..) )
import Darcs.Patch.FileHunk ( IsHunk(..) )
import Darcs.Patch.Format
    ( PatchListFormat(..)
    , ListFormat(ListFormatV1)
    , FileNameFormat(FileNameFormatV1,FileNameFormatDisplay) )
import Darcs.Patch.Inspect ( PatchInspect )
import Darcs.Patch.Invert ( Invert )
import Darcs.Patch.Merge ( CleanMerge )
import Darcs.Patch.Read ( ReadPatch(..) )
import Darcs.Patch.Repair ( RepairToFL(..) )
import Darcs.Patch.Show
    ( ShowPatchBasic(..)
    , ShowPatchFor(..)
    , ShowPatch(..)
    , ShowContextPatch(..)
    )
import Darcs.Patch.Summary ( plainSummaryPrim, plainSummaryPrims )

import Darcs.Patch.Witnesses.Eq ( Eq2 )
import Darcs.Patch.Witnesses.Show ( Show1, Show2 )
import Darcs.Patch.Witnesses.Sealed ( mapSeal )

import Darcs.Patch.Prim.Class
    ( PrimConstruct(..), PrimCanonize(..)
    , PrimClassify(..), PrimDetails(..)
    , PrimShow(..), PrimRead(..)
    , PrimApply(..)
    , PrimSift(..)
    , PrimMangleUnravelled(..)
    )
import qualified Darcs.Patch.Prim.V1 as Base ( Prim )

newtype Prim x y = Prim { Prim x y -> Prim x y
unPrim :: Base.Prim x y } deriving
    ( Prim wX wY -> AnnotatedM ()
(forall wX wY. Prim wX wY -> AnnotatedM ()) -> Annotate Prim
forall wX wY. Prim wX wY -> AnnotatedM ()
forall (p :: * -> * -> *).
(forall wX wY. p wX wY -> AnnotatedM ()) -> Annotate p
annotate :: Prim wX wY -> AnnotatedM ()
$cannotate :: forall wX wY. Prim wX wY -> AnnotatedM ()
Annotate
    , Prim wX wY -> m ()
Prim wX wY -> m ()
(forall (m :: * -> *) wX wY.
 ApplyMonad (ApplyState Prim) m =>
 Prim wX wY -> m ())
-> (forall (m :: * -> *) wX wY.
    ApplyMonad (ApplyState Prim) m =>
    Prim wX wY -> m ())
-> Apply Prim
forall (m :: * -> *) wX wY.
ApplyMonad (ApplyState Prim) m =>
Prim wX wY -> m ()
forall (p :: * -> * -> *).
(forall (m :: * -> *) wX wY.
 ApplyMonad (ApplyState p) m =>
 p wX wY -> m ())
-> (forall (m :: * -> *) wX wY.
    ApplyMonad (ApplyState p) m =>
    p wX wY -> m ())
-> Apply p
unapply :: Prim wX wY -> m ()
$cunapply :: forall (m :: * -> *) wX wY.
ApplyMonad (ApplyState Prim) m =>
Prim wX wY -> m ()
apply :: Prim wX wY -> m ()
$capply :: forall (m :: * -> *) wX wY.
ApplyMonad (ApplyState Prim) m =>
Prim wX wY -> m ()
Apply
    , (:\/:) Prim Prim wX wY -> Maybe ((:/\:) Prim Prim wX wY)
(forall wX wY.
 (:\/:) Prim Prim wX wY -> Maybe ((:/\:) Prim Prim wX wY))
-> CleanMerge Prim
forall wX wY.
(:\/:) Prim Prim wX wY -> Maybe ((:/\:) Prim Prim wX wY)
forall (p :: * -> * -> *).
(forall wX wY. (:\/:) p p wX wY -> Maybe ((:/\:) p p wX wY))
-> CleanMerge p
cleanMerge :: (:\/:) Prim Prim wX wY -> Maybe ((:/\:) Prim Prim wX wY)
$ccleanMerge :: forall wX wY.
(:\/:) Prim Prim wX wY -> Maybe ((:/\:) Prim Prim wX wY)
CleanMerge
    , (:>) Prim Prim wX wY -> Maybe ((:>) Prim Prim wX wY)
(forall wX wY.
 (:>) Prim Prim wX wY -> Maybe ((:>) Prim Prim wX wY))
-> Commute Prim
forall wX wY. (:>) Prim Prim wX wY -> Maybe ((:>) Prim Prim wX wY)
forall (p :: * -> * -> *).
(forall wX wY. (:>) p p wX wY -> Maybe ((:>) p p wX wY))
-> Commute p
commute :: (:>) Prim Prim wX wY -> Maybe ((:>) Prim Prim wX wY)
$ccommute :: forall wX wY. (:>) Prim Prim wX wY -> Maybe ((:>) Prim Prim wX wY)
Commute
    , Prim wX wY -> Prim wY wX
(forall wX wY. Prim wX wY -> Prim wY wX) -> Invert Prim
forall wX wY. Prim wX wY -> Prim wY wX
forall (p :: * -> * -> *).
(forall wX wY. p wX wY -> p wY wX) -> Invert p
invert :: Prim wX wY -> Prim wY wX
$cinvert :: forall wX wY. Prim wX wY -> Prim wY wX
Invert
    , Prim wX wY -> Maybe (FileHunk wX wY)
(forall wX wY. Prim wX wY -> Maybe (FileHunk wX wY)) -> IsHunk Prim
forall wX wY. Prim wX wY -> Maybe (FileHunk wX wY)
forall (p :: * -> * -> *).
(forall wX wY. p wX wY -> Maybe (FileHunk wX wY)) -> IsHunk p
isHunk :: Prim wX wY -> Maybe (FileHunk wX wY)
$cisHunk :: forall wX wY. Prim wX wY -> Maybe (FileHunk wX wY)
IsHunk
    , Prim wA wB -> Prim wC wD -> Bool
Prim wA wB -> Prim wA wC -> EqCheck wB wC
Prim wA wC -> Prim wB wC -> EqCheck wA wB
(forall wA wB wC wD. Prim wA wB -> Prim wC wD -> Bool)
-> (forall wA wB wC. Prim wA wB -> Prim wA wC -> EqCheck wB wC)
-> (forall wA wC wB. Prim wA wC -> Prim wB wC -> EqCheck wA wB)
-> Eq2 Prim
forall wA wB wC. Prim wA wB -> Prim wA wC -> EqCheck wB wC
forall wA wC wB. Prim wA wC -> Prim wB wC -> EqCheck wA wB
forall wA wB wC wD. Prim wA wB -> Prim wC wD -> Bool
forall (p :: * -> * -> *).
(forall wA wB wC wD. p wA wB -> p wC wD -> Bool)
-> (forall wA wB wC. p wA wB -> p wA wC -> EqCheck wB wC)
-> (forall wA wC wB. p wA wC -> p wB wC -> EqCheck wA wB)
-> Eq2 p
=/\= :: Prim wA wC -> Prim wB wC -> EqCheck wA wB
$c=/\= :: forall wA wC wB. Prim wA wC -> Prim wB wC -> EqCheck wA wB
=\/= :: Prim wA wB -> Prim wA wC -> EqCheck wB wC
$c=\/= :: forall wA wB wC. Prim wA wB -> Prim wA wC -> EqCheck wB wC
unsafeCompare :: Prim wA wB -> Prim wC wD -> Bool
$cunsafeCompare :: forall wA wB wC wD. Prim wA wB -> Prim wC wD -> Bool
Eq2
    , Prim wX wY -> [AnchoredPath]
(ByteString -> Bool) -> Prim wX wY -> Bool
(forall wX wY. Prim wX wY -> [AnchoredPath])
-> (forall wX wY. (ByteString -> Bool) -> Prim wX wY -> Bool)
-> PatchInspect Prim
forall wX wY. Prim wX wY -> [AnchoredPath]
forall wX wY. (ByteString -> Bool) -> Prim wX wY -> Bool
forall (p :: * -> * -> *).
(forall wX wY. p wX wY -> [AnchoredPath])
-> (forall wX wY. (ByteString -> Bool) -> p wX wY -> Bool)
-> PatchInspect p
hunkMatches :: (ByteString -> Bool) -> Prim wX wY -> Bool
$chunkMatches :: forall wX wY. (ByteString -> Bool) -> Prim wX wY -> Bool
listTouchedFiles :: Prim wX wY -> [AnchoredPath]
$clistTouchedFiles :: forall wX wY. Prim wX wY -> [AnchoredPath]
PatchInspect
    , FL Prim wX wY -> m ()
(forall (m :: * -> *) wX wY.
 ApplyMonad (ApplyState Prim) m =>
 FL Prim wX wY -> m ())
-> PrimApply Prim
forall (m :: * -> *) wX wY.
ApplyMonad (ApplyState Prim) m =>
FL Prim wX wY -> m ()
forall (prim :: * -> * -> *).
(forall (m :: * -> *) wX wY.
 ApplyMonad (ApplyState prim) m =>
 FL prim wX wY -> m ())
-> PrimApply prim
applyPrimFL :: FL Prim wX wY -> m ()
$capplyPrimFL :: forall (m :: * -> *) wX wY.
ApplyMonad (ApplyState Prim) m =>
FL Prim wX wY -> m ()
PrimApply
    , DiffAlgorithm -> FL Prim wX wY -> FL Prim wX wY
DiffAlgorithm -> Prim wX wY -> FL Prim wX wY
FL Prim wX wY -> FL Prim wX wY
FL Prim wX wY -> FL Prim wX wY
(:>) Prim Prim wX wY -> Maybe (FL Prim wX wY)
Prim wX wY -> Prim wY wZ -> Maybe (Prim wX wZ)
Prim wX wZ -> Prim wX wY -> Maybe (Prim wY wZ)
(forall wX wY. FL Prim wX wY -> FL Prim wX wY)
-> (forall wX wY. FL Prim wX wY -> FL Prim wX wY)
-> (forall wX wY. DiffAlgorithm -> Prim wX wY -> FL Prim wX wY)
-> (forall wX wY. DiffAlgorithm -> FL Prim wX wY -> FL Prim wX wY)
-> (forall wX wY. (:>) Prim Prim wX wY -> Maybe (FL Prim wX wY))
-> (forall wX wY wZ.
    Prim wX wY -> Prim wY wZ -> Maybe (Prim wX wZ))
-> (forall wX wZ wY.
    Prim wX wZ -> Prim wX wY -> Maybe (Prim wY wZ))
-> PrimCanonize Prim
forall wX wY. DiffAlgorithm -> FL Prim wX wY -> FL Prim wX wY
forall wX wY. DiffAlgorithm -> Prim wX wY -> FL Prim wX wY
forall wX wY. FL Prim wX wY -> FL Prim wX wY
forall wX wY. (:>) Prim Prim wX wY -> Maybe (FL Prim wX wY)
forall wX wZ wY. Prim wX wZ -> Prim wX wY -> Maybe (Prim wY wZ)
forall wX wY wZ. Prim wX wY -> Prim wY wZ -> Maybe (Prim wX wZ)
forall (prim :: * -> * -> *).
(forall wX wY. FL prim wX wY -> FL prim wX wY)
-> (forall wX wY. FL prim wX wY -> FL prim wX wY)
-> (forall wX wY. DiffAlgorithm -> prim wX wY -> FL prim wX wY)
-> (forall wX wY. DiffAlgorithm -> FL prim wX wY -> FL prim wX wY)
-> (forall wX wY. (:>) prim prim wX wY -> Maybe (FL prim wX wY))
-> (forall wX wY wZ.
    prim wX wY -> prim wY wZ -> Maybe (prim wX wZ))
-> (forall wX wZ wY.
    prim wX wZ -> prim wX wY -> Maybe (prim wY wZ))
-> PrimCanonize prim
primDecoalesce :: Prim wX wZ -> Prim wX wY -> Maybe (Prim wY wZ)
$cprimDecoalesce :: forall wX wZ wY. Prim wX wZ -> Prim wX wY -> Maybe (Prim wY wZ)
primCoalesce :: Prim wX wY -> Prim wY wZ -> Maybe (Prim wX wZ)
$cprimCoalesce :: forall wX wY wZ. Prim wX wY -> Prim wY wZ -> Maybe (Prim wX wZ)
coalesce :: (:>) Prim Prim wX wY -> Maybe (FL Prim wX wY)
$ccoalesce :: forall wX wY. (:>) Prim Prim wX wY -> Maybe (FL Prim wX wY)
canonizeFL :: DiffAlgorithm -> FL Prim wX wY -> FL Prim wX wY
$ccanonizeFL :: forall wX wY. DiffAlgorithm -> FL Prim wX wY -> FL Prim wX wY
canonize :: DiffAlgorithm -> Prim wX wY -> FL Prim wX wY
$ccanonize :: forall wX wY. DiffAlgorithm -> Prim wX wY -> FL Prim wX wY
sortCoalesceFL :: FL Prim wX wY -> FL Prim wX wY
$csortCoalesceFL :: forall wX wY. FL Prim wX wY -> FL Prim wX wY
tryToShrink :: FL Prim wX wY -> FL Prim wX wY
$ctryToShrink :: forall wX wY. FL Prim wX wY -> FL Prim wX wY
PrimCanonize
    , Prim wX wY -> Bool
Prim wX wY -> Bool
Prim wX wY -> Bool
Prim wX wY -> Bool
Prim wX wY -> Bool
Prim wX wY -> Bool
Prim wX wY -> Bool
Prim wX wY -> Bool
Prim wX wY -> Bool
Prim wX wY -> Maybe AnchoredPath
(forall wX wY. Prim wX wY -> Bool)
-> (forall wX wY. Prim wX wY -> Bool)
-> (forall wX wY. Prim wX wY -> Bool)
-> (forall wX wY. Prim wX wY -> Bool)
-> (forall wX wY. Prim wX wY -> Bool)
-> (forall wX wY. Prim wX wY -> Bool)
-> (forall wX wY. Prim wX wY -> Bool)
-> (forall wX wY. Prim wX wY -> Bool)
-> (forall wX wY. Prim wX wY -> Bool)
-> (forall wX wY. Prim wX wY -> Maybe AnchoredPath)
-> PrimClassify Prim
forall wX wY. Prim wX wY -> Bool
forall wX wY. Prim wX wY -> Maybe AnchoredPath
forall (prim :: * -> * -> *).
(forall wX wY. prim wX wY -> Bool)
-> (forall wX wY. prim wX wY -> Bool)
-> (forall wX wY. prim wX wY -> Bool)
-> (forall wX wY. prim wX wY -> Bool)
-> (forall wX wY. prim wX wY -> Bool)
-> (forall wX wY. prim wX wY -> Bool)
-> (forall wX wY. prim wX wY -> Bool)
-> (forall wX wY. prim wX wY -> Bool)
-> (forall wX wY. prim wX wY -> Bool)
-> (forall wX wY. prim wX wY -> Maybe AnchoredPath)
-> PrimClassify prim
is_filepatch :: Prim wX wY -> Maybe AnchoredPath
$cis_filepatch :: forall wX wY. Prim wX wY -> Maybe AnchoredPath
primIsSetpref :: Prim wX wY -> Bool
$cprimIsSetpref :: forall wX wY. Prim wX wY -> Bool
primIsBinary :: Prim wX wY -> Bool
$cprimIsBinary :: forall wX wY. Prim wX wY -> Bool
primIsTokReplace :: Prim wX wY -> Bool
$cprimIsTokReplace :: forall wX wY. Prim wX wY -> Bool
primIsHunk :: Prim wX wY -> Bool
$cprimIsHunk :: forall wX wY. Prim wX wY -> Bool
primIsMove :: Prim wX wY -> Bool
$cprimIsMove :: forall wX wY. Prim wX wY -> Bool
primIsRmdir :: Prim wX wY -> Bool
$cprimIsRmdir :: forall wX wY. Prim wX wY -> Bool
primIsAdddir :: Prim wX wY -> Bool
$cprimIsAdddir :: forall wX wY. Prim wX wY -> Bool
primIsRmfile :: Prim wX wY -> Bool
$cprimIsRmfile :: forall wX wY. Prim wX wY -> Bool
primIsAddfile :: Prim wX wY -> Bool
$cprimIsAddfile :: forall wX wY. Prim wX wY -> Bool
PrimClassify
    , String -> String -> String -> Prim wX wY
AnchoredPath -> Prim wX wY
AnchoredPath -> Prim wX wY
AnchoredPath -> Prim wX wY
AnchoredPath -> Prim wX wY
AnchoredPath -> Int -> [ByteString] -> [ByteString] -> Prim wX wY
AnchoredPath -> String -> String -> String -> Prim wX wY
AnchoredPath -> ByteString -> ByteString -> Prim wX wY
AnchoredPath -> AnchoredPath -> Prim wX wY
FileHunk wX wY -> Prim wX wY
(forall wX wY. AnchoredPath -> Prim wX wY)
-> (forall wX wY. AnchoredPath -> Prim wX wY)
-> (forall wX wY. AnchoredPath -> Prim wX wY)
-> (forall wX wY. AnchoredPath -> Prim wX wY)
-> (forall wX wY. AnchoredPath -> AnchoredPath -> Prim wX wY)
-> (forall wX wY. String -> String -> String -> Prim wX wY)
-> (forall wX wY.
    AnchoredPath -> Int -> [ByteString] -> [ByteString] -> Prim wX wY)
-> (forall wX wY.
    AnchoredPath -> String -> String -> String -> Prim wX wY)
-> (forall wX wY.
    AnchoredPath -> ByteString -> ByteString -> Prim wX wY)
-> (forall wX wY. FileHunk wX wY -> Prim wX wY)
-> PrimConstruct Prim
forall wX wY. String -> String -> String -> Prim wX wY
forall wX wY. AnchoredPath -> Prim wX wY
forall wX wY.
AnchoredPath -> Int -> [ByteString] -> [ByteString] -> Prim wX wY
forall wX wY.
AnchoredPath -> String -> String -> String -> Prim wX wY
forall wX wY.
AnchoredPath -> ByteString -> ByteString -> Prim wX wY
forall wX wY. AnchoredPath -> AnchoredPath -> Prim wX wY
forall wX wY. FileHunk wX wY -> Prim wX wY
forall (prim :: * -> * -> *).
(forall wX wY. AnchoredPath -> prim wX wY)
-> (forall wX wY. AnchoredPath -> prim wX wY)
-> (forall wX wY. AnchoredPath -> prim wX wY)
-> (forall wX wY. AnchoredPath -> prim wX wY)
-> (forall wX wY. AnchoredPath -> AnchoredPath -> prim wX wY)
-> (forall wX wY. String -> String -> String -> prim wX wY)
-> (forall wX wY.
    AnchoredPath -> Int -> [ByteString] -> [ByteString] -> prim wX wY)
-> (forall wX wY.
    AnchoredPath -> String -> String -> String -> prim wX wY)
-> (forall wX wY.
    AnchoredPath -> ByteString -> ByteString -> prim wX wY)
-> (forall wX wY. FileHunk wX wY -> prim wX wY)
-> PrimConstruct prim
primFromHunk :: FileHunk wX wY -> Prim wX wY
$cprimFromHunk :: forall wX wY. FileHunk wX wY -> Prim wX wY
binary :: AnchoredPath -> ByteString -> ByteString -> Prim wX wY
$cbinary :: forall wX wY.
AnchoredPath -> ByteString -> ByteString -> Prim wX wY
tokreplace :: AnchoredPath -> String -> String -> String -> Prim wX wY
$ctokreplace :: forall wX wY.
AnchoredPath -> String -> String -> String -> Prim wX wY
hunk :: AnchoredPath -> Int -> [ByteString] -> [ByteString] -> Prim wX wY
$chunk :: forall wX wY.
AnchoredPath -> Int -> [ByteString] -> [ByteString] -> Prim wX wY
changepref :: String -> String -> String -> Prim wX wY
$cchangepref :: forall wX wY. String -> String -> String -> Prim wX wY
move :: AnchoredPath -> AnchoredPath -> Prim wX wY
$cmove :: forall wX wY. AnchoredPath -> AnchoredPath -> Prim wX wY
rmdir :: AnchoredPath -> Prim wX wY
$crmdir :: forall wX wY. AnchoredPath -> Prim wX wY
adddir :: AnchoredPath -> Prim wX wY
$cadddir :: forall wX wY. AnchoredPath -> Prim wX wY
rmfile :: AnchoredPath -> Prim wX wY
$crmfile :: forall wX wY. AnchoredPath -> Prim wX wY
addfile :: AnchoredPath -> Prim wX wY
$caddfile :: forall wX wY. AnchoredPath -> Prim wX wY
PrimConstruct
    , Prim wX wY -> [SummDetail]
(forall wX wY. Prim wX wY -> [SummDetail]) -> PrimDetails Prim
forall wX wY. Prim wX wY -> [SummDetail]
forall (prim :: * -> * -> *).
(forall wX wY. prim wX wY -> [SummDetail]) -> PrimDetails prim
summarizePrim :: Prim wX wY -> [SummDetail]
$csummarizePrim :: forall wX wY. Prim wX wY -> [SummDetail]
PrimDetails
    , Unravelled Prim wX -> Maybe (Mangled Prim wX)
(forall wX. Unravelled Prim wX -> Maybe (Mangled Prim wX))
-> PrimMangleUnravelled Prim
forall wX. Unravelled Prim wX -> Maybe (Mangled Prim wX)
forall (prim :: * -> * -> *).
(forall wX. Unravelled prim wX -> Maybe (Mangled prim wX))
-> PrimMangleUnravelled prim
mangleUnravelled :: Unravelled Prim wX -> Maybe (Mangled Prim wX)
$cmangleUnravelled :: forall wX. Unravelled Prim wX -> Maybe (Mangled Prim wX)
PrimMangleUnravelled
    , FL Prim wX wY -> Sealed (FL Prim wX)
(forall wX wY. FL Prim wX wY -> Sealed (FL Prim wX))
-> PrimSift Prim
forall wX wY. FL Prim wX wY -> Sealed (FL Prim wX)
forall (prim :: * -> * -> *).
(forall wX wY. FL prim wX wY -> Sealed (FL prim wX))
-> PrimSift prim
siftForPending :: FL Prim wX wY -> Sealed (FL Prim wX)
$csiftForPending :: forall wX wY. FL Prim wX wY -> Sealed (FL Prim wX)
PrimSift
    , Int -> Prim x y -> ShowS
[Prim x y] -> ShowS
Prim x y -> String
(Int -> Prim x y -> ShowS)
-> (Prim x y -> String) -> ([Prim x y] -> ShowS) -> Show (Prim x y)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall x y. Int -> Prim x y -> ShowS
forall x y. [Prim x y] -> ShowS
forall x y. Prim x y -> String
showList :: [Prim x y] -> ShowS
$cshowList :: forall x y. [Prim x y] -> ShowS
show :: Prim x y -> String
$cshow :: forall x y. Prim x y -> String
showsPrec :: Int -> Prim x y -> ShowS
$cshowsPrec :: forall x y. Int -> Prim x y -> ShowS
Show
    )

instance Show1 (Prim wX)

instance Show2 Prim

instance ReadPatch Prim where
  readPatch' :: Parser (Sealed (Prim wX))
readPatch' = (Sealed (Prim wX) -> Sealed (Prim wX))
-> Parser ByteString (Sealed (Prim wX))
-> Parser (Sealed (Prim wX))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((forall wX. Prim wX wX -> Prim wX wX)
-> Sealed (Prim wX) -> Sealed (Prim wX)
forall (a :: * -> *) (b :: * -> *).
(forall wX. a wX -> b wX) -> Sealed a -> Sealed b
mapSeal forall wX. Prim wX wX -> Prim wX wX
forall x y. Prim x y -> Prim x y
Prim) (FileNameFormat -> Parser ByteString (Sealed (Prim wX))
forall (prim :: * -> * -> *) wX.
PrimRead prim =>
FileNameFormat -> Parser (Sealed (prim wX))
readPrim FileNameFormat
FileNameFormatV1)

fileNameFormat :: ShowPatchFor -> FileNameFormat
fileNameFormat :: ShowPatchFor -> FileNameFormat
fileNameFormat ShowPatchFor
ForDisplay = FileNameFormat
FileNameFormatDisplay
fileNameFormat ShowPatchFor
ForStorage = FileNameFormat
FileNameFormatV1

instance ShowPatchBasic Prim where
  showPatch :: ShowPatchFor -> Prim wX wY -> Doc
showPatch ShowPatchFor
fmt = FileNameFormat -> Prim wX wY -> Doc
forall (prim :: * -> * -> *) wA wB.
PrimShow prim =>
FileNameFormat -> prim wA wB -> Doc
showPrim (ShowPatchFor -> FileNameFormat
fileNameFormat ShowPatchFor
fmt) (Prim wX wY -> Doc)
-> (Prim wX wY -> Prim wX wY) -> Prim wX wY -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Prim wX wY -> Prim wX wY
forall x y. Prim x y -> Prim x y
unPrim

instance ShowContextPatch Prim where
  showContextPatch :: ShowPatchFor -> Prim wX wY -> m Doc
showContextPatch ShowPatchFor
fmt = FileNameFormat -> Prim wX wY -> m Doc
forall (prim :: * -> * -> *) (m :: * -> *) wA wB.
(PrimShow prim, ApplyMonad (ApplyState prim) m) =>
FileNameFormat -> prim wA wB -> m Doc
showPrimCtx (ShowPatchFor -> FileNameFormat
fileNameFormat ShowPatchFor
fmt) (Prim wX wY -> m Doc)
-> (Prim wX wY -> Prim wX wY) -> Prim wX wY -> m Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Prim wX wY -> Prim wX wY
forall x y. Prim x y -> Prim x y
unPrim

instance ShowPatch Prim where
  summary :: Prim wX wY -> Doc
summary = Prim wX wY -> Doc
forall (prim :: * -> * -> *) wX wY.
PrimDetails prim =>
prim wX wY -> Doc
plainSummaryPrim (Prim wX wY -> Doc)
-> (Prim wX wY -> Prim wX wY) -> Prim wX wY -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Prim wX wY -> Prim wX wY
forall x y. Prim x y -> Prim x y
unPrim
  summaryFL :: FL Prim wX wY -> Doc
summaryFL = Bool -> FL Prim wX wY -> Doc
forall (prim :: * -> * -> *) wX wY.
PrimDetails prim =>
Bool -> FL prim wX wY -> Doc
plainSummaryPrims Bool
False
  thing :: Prim wX wY -> String
thing Prim wX wY
_ = String
"change"

instance PatchListFormat Prim where
  patchListFormat :: ListFormat Prim
patchListFormat = ListFormat Prim
forall (p :: * -> * -> *). ListFormat p
ListFormatV1

instance RepairToFL Prim where
  applyAndTryToFixFL :: Prim wX wY -> m (Maybe (String, FL Prim wX wY))
applyAndTryToFixFL = (Maybe (String, FL Prim wX wY) -> Maybe (String, FL Prim wX wY))
-> m (Maybe (String, FL Prim wX wY))
-> m (Maybe (String, FL Prim wX wY))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Maybe (String, FL Prim wX wY) -> Maybe (String, FL Prim wX wY)
coerce (m (Maybe (String, FL Prim wX wY))
 -> m (Maybe (String, FL Prim wX wY)))
-> (Prim wX wY -> m (Maybe (String, FL Prim wX wY)))
-> Prim wX wY
-> m (Maybe (String, FL Prim wX wY))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Prim wX wY -> m (Maybe (String, FL Prim wX wY))
forall (p :: * -> * -> *) (m :: * -> *) wX wY.
(RepairToFL p, ApplyMonad (ApplyState p) m) =>
p wX wY -> m (Maybe (String, FL p wX wY))
applyAndTryToFixFL (Prim wX wY -> m (Maybe (String, FL Prim wX wY)))
-> (Prim wX wY -> Prim wX wY)
-> Prim wX wY
-> m (Maybe (String, FL Prim wX wY))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Prim wX wY -> Prim wX wY
forall x y. Prim x y -> Prim x y
unPrim