1{-# LANGUAGE DeriveGeneric #-}
2{-# LANGUAGE FlexibleContexts #-}
3{-# LANGUAGE LambdaCase #-}
4{-# LANGUAGE StandaloneDeriving #-}
5{-# LANGUAGE TypeFamilies #-}
7-- The derived instances are undecidable in the case of a pathological instance like
8-- instance Patch x where
9-- type PatchTarget x = Patchable x
10{-# LANGUAGE UndecidableInstances #-}
12module Data.Patch.Patchable where
19-- | Like SemiMap/PartialMap but for anything patchable
22 | Patchable_Complete (PatchTarget p)
25completePatchable :: Patchable p -> Maybe (PatchTarget p)
26completePatchable = \case
27 Patchable_Complete t -> Just t
28 Patchable_Patch _ -> Nothing
30deriving instance (Eq p, Eq (PatchTarget p)) => Eq (Patchable p)
31deriving instance (Ord p, Ord (PatchTarget p)) => Ord (Patchable p)
32deriving instance (Show p, Show (PatchTarget p)) => Show (Patchable p)
33deriving instance (Read p, Read (PatchTarget p)) => Read (Patchable p)
34-- instance (ToJSON p, ToJSON (PatchTarget p)) => ToJSON (Patchable p)
35-- instance (FromJSON p, FromJSON (PatchTarget p)) => FromJSON (Patchable p)
37instance (Monoid p, Patch p) => Monoid (Patchable p) where
38 mempty = Patchable_Patch mempty
41instance (Semigroup p, Patch p) => Semigroup (Patchable p) where
43 (Patchable_Patch a, Patchable_Patch b) -> Patchable_Patch $ a <> b
44 (Patchable_Patch a, Patchable_Complete b) -> Patchable_Complete $ applyAlways a b
45 (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