darcs-2.18.2: a distributed, interactive, smart revision control system

Safe Haskell | None
Language | Haskell2010

Darcs.Patch.Witnesses.Sealed

Synopsis

- data Sealed (a :: Type -> Type) where
  - Sealed :: forall (a :: Type -> Type) wX. a wX -> Sealed a
- seal :: a wX -> Sealed a
- unseal :: (forall wX. a wX -> b) -> Sealed a -> b
- mapSeal :: (forall wX. a wX -> b wX) -> Sealed a -> Sealed b
- data Sealed2 (a :: Type -> Type -> Type) where
  - Sealed2 :: forall (a :: Type -> Type -> Type) wX wY. !(a wX wY) -> Sealed2 a
- seal2 :: a wX wY -> Sealed2 a
- unseal2 :: (forall wX wY. a wX wY -> b) -> Sealed2 a -> b
- mapSeal2 :: (forall wX wY. a wX wY -> b wX wY) -> Sealed2 a -> Sealed2 b
- data FlippedSeal (a :: Type -> Type -> Type) wY where
  - FlippedSeal :: forall (a :: Type -> Type -> Type) wX wY. !(a wX wY) -> FlippedSeal a wY
- flipSeal :: a wX wY -> FlippedSeal a wY
- unsealFlipped :: (forall wX wY. a wX wY -> b) -> FlippedSeal a wZ -> b
- mapFlipped :: (forall wX. a wX wY -> b wX wZ) -> FlippedSeal a wY -> FlippedSeal b wZ
- data Dup (p :: Type -> Type) wX wY where
  - Dup :: forall (p :: Type -> Type) wX. p wX -> Dup p wX wX
- class Gap (w :: (Type -> Type -> Type) -> Type) where
  - emptyGap :: (forall wX. p wX wX) -> w p
  - freeGap :: (forall wX wY. p wX wY) -> w p
  - joinGap :: (forall wX wY wZ. p wX wY -> q wY wZ -> r wX wZ) -> w p -> w q -> w r
- data FreeLeft (p :: Type -> Type -> Type)
- unFreeLeft :: forall (p :: Type -> Type -> Type) wX. FreeLeft p -> Sealed (p wX)
- data FreeRight (p :: Type -> Type -> Type)
- unFreeRight :: forall (p :: Type -> Type -> Type) wX. FreeRight p -> FlippedSeal p wX

# Documentation

data Sealed (a :: Type -> Type) where #

A `Sealed` type is a way of hide an existentially quantified type parameter, in this case wX, inside the type. Note that the only thing we can currently recover about the existentially quantified type wX is that it exists.

Constructors

Sealed :: forall (a :: Type -> Type) wX. a wX -> Sealed a |

#### Instances

Instances details

Show1 a => Show (Sealed a) # |
Instance details Defined in Darcs.Patch.Witnesses.Sealed Methods showsPrec :: Int -> Sealed a -> ShowS # show :: Sealed a -> String # showList :: [Sealed a] -> ShowS #
Eq2 a => Eq (Sealed (a wX)) # |
Instance details Defined in Darcs.Patch.Witnesses.Sealed Methods (==) :: Sealed (a wX) -> Sealed (a wX) -> Bool # (/=) :: Sealed (a wX) -> Sealed (a wX) -> Bool #

seal :: a wX -> Sealed a #

unseal :: (forall wX. a wX -> b) -> Sealed a -> b #

mapSeal :: (forall wX. a wX -> b wX) -> Sealed a -> Sealed b #

data Sealed2 (a :: Type -> Type -> Type) where #

The same as `Sealed` but for two parameters (wX and wY).

Constructors

Sealed2 :: forall (a :: Type -> Type -> Type) wX wY. !(a wX wY) -> Sealed2 a |

#### Instances

Instances details

Show2 a => Show (Sealed2 a) # |
Instance details Defined in Darcs.Patch.Witnesses.Sealed Methods showsPrec :: Int -> Sealed2 a -> ShowS # show :: Sealed2 a -> String # showList :: [Sealed2 a] -> ShowS #

seal2 :: a wX wY -> Sealed2 a #

unseal2 :: (forall wX wY. a wX wY -> b) -> Sealed2 a -> b #

mapSeal2 :: (forall wX wY. a wX wY -> b wX wY) -> Sealed2 a -> Sealed2 b #

data FlippedSeal (a :: Type -> Type -> Type) wY where #

Constructors

FlippedSeal :: forall (a :: Type -> Type -> Type) wX wY. !(a wX wY) -> FlippedSeal a wY |

flipSeal :: a wX wY -> FlippedSeal a wY #

unsealFlipped :: (forall wX wY. a wX wY -> b) -> FlippedSeal a wZ -> b #

mapFlipped :: (forall wX. a wX wY -> b wX wZ) -> FlippedSeal a wY -> FlippedSeal b wZ #

data Dup (p :: Type -> Type) wX wY where #

Duplicate a single witness. This is for situations where a patch-like type is expected, i.e. a type with two witnesses, but we have only a type with one witness. Naturally, any concrete value must have both witnesses agreeing.

Note that ``Sealed` (`Dup` p wX)` is isomorphic to `p wX`.

Constructors

Dup :: forall (p :: Type -> Type) wX. p wX -> Dup p wX wX |

class Gap (w :: (Type -> Type -> Type) -> Type) where #

`Gap` abstracts over `FreeLeft` and `FreeRight` for code constructing these values

Methods

emptyGap :: (forall wX. p wX wX) -> w p #

An empty `Gap`, e.g. `NilFL` or `NilRL`

freeGap :: (forall wX wY. p wX wY) -> w p #

A `Gap` constructed from a completely polymorphic value, for example the constructors for primitive patches

joinGap :: (forall wX wY wZ. p wX wY -> q wY wZ -> r wX wZ) -> w p -> w q -> w r #

Compose two `Gap` values together in series, e.g. 'joinGap (+>+)' or 'joinGap (:>:)'

#### Instances

Instances details

Gap FreeLeft # |
Instance details Defined in Darcs.Patch.Witnesses.Sealed Methods emptyGap :: (forall wX. p wX wX) -> FreeLeft p # freeGap :: (forall wX wY. p wX wY) -> FreeLeft p # joinGap :: (forall wX wY wZ. p wX wY -> q wY wZ -> r wX wZ) -> FreeLeft p -> FreeLeft q -> FreeLeft r #
Gap FreeRight # |
Instance details Defined in Darcs.Patch.Witnesses.Sealed Methods emptyGap :: (forall wX. p wX wX) -> FreeRight p # freeGap :: (forall wX wY. p wX wY) -> FreeRight p # joinGap :: (forall wX wY wZ. p wX wY -> q wY wZ -> r wX wZ) -> FreeRight p -> FreeRight q -> FreeRight r #

data FreeLeft (p :: Type -> Type -> Type) #

`FreeLeft` p is `forall x . exists y . p x y` In other words the caller is free to specify the left witness, and then the right witness is an existential. Note that the order of the type constructors is important for ensuring that `y` is dependent on the `x` that is supplied. This is why `Stepped` is needed, rather than writing the more obvious `Sealed` (`Poly` p) which would notionally have the same quantification of the type witnesses.

#### Instances

Instances details

Gap FreeLeft # |
Instance details Defined in Darcs.Patch.Witnesses.Sealed Methods emptyGap :: (forall wX. p wX wX) -> FreeLeft p # freeGap :: (forall wX wY. p wX wY) -> FreeLeft p # joinGap :: (forall wX wY wZ. p wX wY -> q wY wZ -> r wX wZ) -> FreeLeft p -> FreeLeft q -> FreeLeft r #

unFreeLeft :: forall (p :: Type -> Type -> Type) wX. FreeLeft p -> Sealed (p wX) #

Unwrap a `FreeLeft` value

data FreeRight (p :: Type -> Type -> Type) #

`FreeRight` p is `forall y . exists x . p x y` In other words the caller is free to specify the right witness, and then the left witness is an existential. Note that the order of the type constructors is important for ensuring that `x` is dependent on the `y` that is supplied.

#### Instances

Instances details

Gap FreeRight # |
Instance details Defined in Darcs.Patch.Witnesses.Sealed Methods emptyGap :: (forall wX. p wX wX) -> FreeRight p # freeGap :: (forall wX wY. p wX wY) -> FreeRight p # joinGap :: (forall wX wY wZ. p wX wY -> q wY wZ -> r wX wZ) -> FreeRight p -> FreeRight q -> FreeRight r #

unFreeRight :: forall (p :: Type -> Type -> Type) wX. FreeRight p -> FlippedSeal p wX #

Unwrap a `FreeRight` value