2{-# LANGUAGE DeriveGeneric #-}
3{-# LANGUAGE FlexibleContexts #-}
4{-# LANGUAGE FlexibleInstances #-}
5{-# LANGUAGE LambdaCase #-}
6{-# LANGUAGE StandaloneDeriving #-}
7{-# LANGUAGE UndecidableInstances #-}
9module Data.Patch.Patchable where
12#if !MIN_VERSION_base(4,11,0)
13import Data.Semigroup (Semigroup (..))
17-- | Like SemiMap/PartialMap but for anything patchable
20 | Patchable_Complete (PatchTarget p)
23deriving instance (Eq p, Eq (PatchTarget p)) => Eq (Patchable p)
24deriving instance (Ord p, Ord (PatchTarget p)) => Ord (Patchable p)
25deriving instance (Show p, Show (PatchTarget p)) => Show (Patchable p)
26deriving instance (Read p, Read (PatchTarget p)) => Read (Patchable p)
28completePatchable :: Patchable p -> Maybe (PatchTarget p)
29completePatchable = \case
30 Patchable_Complete t -> Just t
31 Patchable_Patch _ -> Nothing
34#if !MIN_VERSION_base(4,11,0)
38 ) => Monoid (Patchable p) where
39 mempty = Patchable_Patch mempty
42instance (Semigroup p, Patch p) => Semigroup (Patchable p) where
44 (Patchable_Patch a, Patchable_Patch b) -> Patchable_Patch $ a <> b
45 (Patchable_Patch a, Patchable_Complete b) -> Patchable_Complete $ applyAlways a b
46 (Patchable_Complete a, _) -> Patchable_Complete a
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list