{-# OPTIONS_GHC -fno-warn-orphans #-}
module Darcs.Patch.V1.Viewing () where

import Darcs.Prelude

import Darcs.Patch.Apply ( apply )
import Darcs.Patch.Prim ( PrimPatch )
import Darcs.Patch.Show ( ShowPatch(..), ShowContextPatch(..), showPatch )
import Darcs.Patch.Summary ( plainSummary, plainSummaryFL )

import Darcs.Patch.V1.Apply ()
import Darcs.Patch.V1.Core ( RepoPatchV1(..) )
import Darcs.Patch.V1.Show ()

instance PrimPatch prim => ShowContextPatch (RepoPatchV1 prim) where
    showPatchWithContextAndApply :: forall (m :: * -> *) wX wY.
ApplyMonad (ApplyState (RepoPatchV1 prim)) m =>
ShowPatchFor -> RepoPatchV1 prim wX wY -> m Doc
showPatchWithContextAndApply ShowPatchFor
f (PP prim wX wY
p) = ShowPatchFor -> prim wX wY -> m Doc
forall (m :: * -> *) wX wY.
ApplyMonad (ApplyState prim) m =>
ShowPatchFor -> prim wX wY -> m Doc
forall (p :: * -> * -> *) (m :: * -> *) wX wY.
(ShowContextPatch p, ApplyMonad (ApplyState p) m) =>
ShowPatchFor -> p wX wY -> m Doc
showPatchWithContextAndApply ShowPatchFor
f prim wX wY
p
    showPatchWithContextAndApply ShowPatchFor
f RepoPatchV1 prim wX wY
p = RepoPatchV1 prim wX wY -> m ()
forall (m :: * -> *) wX wY.
ApplyMonad (ApplyState (RepoPatchV1 prim)) m =>
RepoPatchV1 prim wX wY -> m ()
forall (p :: * -> * -> *) (m :: * -> *) wX wY.
(Apply p, ApplyMonad (ApplyState p) m) =>
p wX wY -> m ()
apply RepoPatchV1 prim wX wY
p m () -> m Doc -> m Doc
forall a b. m a -> m b -> m b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Doc -> m Doc
forall a. a -> m a
forall (m :: * -> *) a. Monad m => a -> m a
return (ShowPatchFor -> RepoPatchV1 prim wX wY -> Doc
forall wX wY. ShowPatchFor -> RepoPatchV1 prim wX wY -> Doc
forall (p :: * -> * -> *) wX wY.
ShowPatchBasic p =>
ShowPatchFor -> p wX wY -> Doc
showPatch ShowPatchFor
f RepoPatchV1 prim wX wY
p)

instance PrimPatch prim => ShowPatch (RepoPatchV1 prim) where
    summary :: forall wX wY. RepoPatchV1 prim wX wY -> Doc
summary = RepoPatchV1 prim wX wY -> Doc
forall (e :: * -> * -> *) wX wY.
(Summary e, PrimDetails (PrimOf e)) =>
e wX wY -> Doc
plainSummary
    summaryFL :: forall wX wY. FL (RepoPatchV1 prim) wX wY -> Doc
summaryFL = FL (RepoPatchV1 prim) wX wY -> Doc
forall (e :: * -> * -> *) wX wY.
(Summary e, PrimDetails (PrimOf e)) =>
FL e wX wY -> Doc
plainSummaryFL
    thing :: forall wX wY. RepoPatchV1 prim wX wY -> String
thing RepoPatchV1 prim wX wY
_ = String
"change"