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

import Darcs.Prelude

import Darcs.Patch.Show ( ShowPatchBasic(..), ShowPatchFor(..) )
import Darcs.Patch.V1.Core ( RepoPatchV1(..) )

import Darcs.Util.Printer ( Doc, text, blueText, ($$), (<+>) )


showPatch_ :: ShowPatchBasic prim => prim wX wY -> Doc
showPatch_ :: prim wX wY -> Doc
showPatch_ = ShowPatchFor -> prim wX wY -> Doc
forall (p :: * -> * -> *) wX wY.
ShowPatchBasic p =>
ShowPatchFor -> p wX wY -> Doc
showPatch ShowPatchFor
ForDisplay

showMerger :: ShowPatchBasic prim
           => ShowPatchFor
           -> String
           -> RepoPatchV1 prim wA wB
           -> RepoPatchV1 prim wD wE
           -> Doc
showMerger :: ShowPatchFor
-> String
-> RepoPatchV1 prim wA wB
-> RepoPatchV1 prim wD wE
-> Doc
showMerger ShowPatchFor
f String
merger_name RepoPatchV1 prim wA wB
p1 RepoPatchV1 prim wD wE
p2 =
    String -> Doc
blueText String
merger_name Doc -> Doc -> Doc
<+> String -> Doc
text String
"0.0" Doc -> Doc -> Doc
<+> String -> Doc
blueText String
"("
                           Doc -> Doc -> Doc
$$ ShowPatchFor -> RepoPatchV1 prim wA wB -> Doc
forall (p :: * -> * -> *) wX wY.
ShowPatchBasic p =>
ShowPatchFor -> p wX wY -> Doc
showPatch ShowPatchFor
f RepoPatchV1 prim wA wB
p1
                           Doc -> Doc -> Doc
$$ ShowPatchFor -> RepoPatchV1 prim wD wE -> Doc
forall (p :: * -> * -> *) wX wY.
ShowPatchBasic p =>
ShowPatchFor -> p wX wY -> Doc
showPatch ShowPatchFor
f RepoPatchV1 prim wD wE
p2
                           Doc -> Doc -> Doc
$$ String -> Doc
blueText String
")"

instance ShowPatchBasic prim => ShowPatchBasic (RepoPatchV1 prim) where
    showPatch :: ShowPatchFor -> RepoPatchV1 prim wX wY -> Doc
showPatch ShowPatchFor
f (PP prim wX wY
p) = ShowPatchFor -> prim wX wY -> Doc
forall (p :: * -> * -> *) wX wY.
ShowPatchBasic p =>
ShowPatchFor -> p wX wY -> Doc
showPatch ShowPatchFor
f prim wX wY
p
    showPatch ShowPatchFor
f (Merger FL (RepoPatchV1 prim) wX wY
_ RL (RepoPatchV1 prim) wX wB
_ RepoPatchV1 prim wC wX
p1 RepoPatchV1 prim wC wD
p2) = ShowPatchFor
-> String
-> RepoPatchV1 prim wC wX
-> RepoPatchV1 prim wC wD
-> Doc
forall (prim :: * -> * -> *) wA wB wD wE.
ShowPatchBasic prim =>
ShowPatchFor
-> String
-> RepoPatchV1 prim wA wB
-> RepoPatchV1 prim wD wE
-> Doc
showMerger ShowPatchFor
f String
"merger" RepoPatchV1 prim wC wX
p1 RepoPatchV1 prim wC wD
p2
    showPatch ShowPatchFor
f (Regrem FL (RepoPatchV1 prim) wY wX
_ RL (RepoPatchV1 prim) wY wB
_ RepoPatchV1 prim wC wY
p1 RepoPatchV1 prim wC wD
p2) = ShowPatchFor
-> String
-> RepoPatchV1 prim wC wY
-> RepoPatchV1 prim wC wD
-> Doc
forall (prim :: * -> * -> *) wA wB wD wE.
ShowPatchBasic prim =>
ShowPatchFor
-> String
-> RepoPatchV1 prim wA wB
-> RepoPatchV1 prim wD wE
-> Doc
showMerger ShowPatchFor
f String
"regrem" RepoPatchV1 prim wC wY
p1 RepoPatchV1 prim wC wD
p2