parameterized-utils-2.1.11.0: Classes and data structures for working with data-kind indexed types

Copyright | (c) Galois Inc 2014-2015
Maintainer | Joe Hendrix <jhendrix@galois.com>
Safe Haskell | Trustworthy
Language | Haskell2010

Data.Parameterized.TraversableFC

Description

This module declares classes for working with structures that accept a parametric type parameter followed by some fixed kind.

Synopsis

- class TestEqualityFC (t :: (k -> Type) -> l -> Type) where
  - testEqualityFC :: (forall (x :: k) (y :: k). f x -> f y -> Maybe (x :~: y)) -> forall (x :: l) (y :: l). t f x -> t f y -> Maybe (x :~: y)
- class TestEqualityFC t => OrdFC (t :: (k -> Type) -> l -> Type) where
  - compareFC :: (forall (x :: k) (y :: k). f x -> f y -> OrderingF x y) -> forall (x :: l) (y :: l). t f x -> t f y -> OrderingF x y
- class ShowFC (t :: (k -> Type) -> l -> Type) where
  - showFC :: (forall (x :: k). f x -> String) -> forall (x :: l). t f x -> String
  - showsPrecFC :: (forall (x :: k). Int -> f x -> ShowS) -> forall (x :: l). Int -> t f x -> ShowS
- class HashableFC (t :: (k -> Type) -> l -> Type) where
  - hashWithSaltFC :: (forall (x :: k). Int -> f x -> Int) -> forall (x :: l). Int -> t f x -> Int
- class FunctorFC (t :: (k -> Type) -> l -> Type) where
  - fmapFC :: (forall (x :: k). f x -> g x) -> forall (x :: l). t f x -> t g x
- class FoldableFC (t :: (k -> Type) -> l -> Type) where
  - foldMapFC :: forall f m. Monoid m => (forall (x :: k). f x -> m) -> forall (x :: l). t f x -> m
  - foldrFC :: (forall (x :: k). f x -> b -> b) -> forall (x :: l). b -> t f x -> b
  - foldlFC :: forall f b. (forall (x :: k). b -> f x -> b) -> forall (x :: l). b -> t f x -> b
  - foldrFC' :: (forall (x :: k). f x -> b -> b) -> forall (x :: l). b -> t f x -> b
  - foldlFC' :: forall f b. (forall (x :: k). b -> f x -> b) -> forall (x :: l). b -> t f x -> b
  - toListFC :: (forall (x :: k). f x -> a) -> forall (x :: l). t f x -> [a]
- foldlMFC :: forall {k} {l} t m b f (c :: l). (FoldableFC t, Monad m) => (forall (x :: k). b -> f x -> m b) -> b -> t f c -> m b
- foldlMFC' :: forall {k} {l} t m b f (c :: l). (FoldableFC t, Monad m) => (forall (x :: k). b -> f x -> m b) -> b -> t f c -> m b
- foldrMFC :: forall {k} {l} t m f b (c :: l). (FoldableFC t, Monad m) => (forall (x :: k). f x -> b -> m b) -> b -> t f c -> m b
- foldrMFC' :: forall {k} {l} t m f b (c :: l). (FoldableFC t, Monad m) => (forall (x :: k). f x -> b -> m b) -> b -> t f c -> m b
- class (FunctorFC t, FoldableFC t) => TraversableFC (t :: (k -> Type) -> l -> Type) where
  - traverseFC :: forall f g m. Applicative m => (forall (x :: k). f x -> m (g x)) -> forall (x :: l). t f x -> m (t g x)
- traverseFC_ :: (FoldableFC t, Applicative m) => (forall (x :: k). f x -> m a) -> forall (x :: l). t f x -> m ()
- forMFC_ :: forall {k} {l} t m f (c :: l) a. (FoldableFC t, Applicative m) => t f c -> (forall (x :: k). f x -> m a) -> m ()
- forFC_ :: forall {k} {l} t m f (c :: l) a. (FoldableFC t, Applicative m) => t f c -> (forall (x :: k). f x -> m a) -> m ()
- forFC :: forall {k} {l} t m f (x :: l) g. (TraversableFC t, Applicative m) => t f x -> (forall (y :: k). f y -> m (g y)) -> m (t g x)
- fmapFCDefault :: TraversableFC t => forall (f :: k -> Type) (g :: k -> Type). (forall (x :: k). f x -> g x) -> forall (x :: l). t f x -> t g x
- foldMapFCDefault :: (TraversableFC t, Monoid m) => (forall (x :: k). f x -> m) -> forall (x :: l). t f x -> m
- allFC :: FoldableFC t => (forall (x :: k). f x -> Bool) -> forall (x :: l). t f x -> Bool
- anyFC :: FoldableFC t => (forall (x :: k). f x -> Bool) -> forall (x :: l). t f x -> Bool
- lengthFC :: forall {k} {l} t (f :: k -> Type) (x :: l). FoldableFC t => t f x -> Int

# Documentation

class TestEqualityFC (t :: (k -> Type) -> l -> Type) where Source #

A parameterized class for types which can be tested for parameterized equality, when given an equality test for subterms.

Methods

testEqualityFC :: (forall (x :: k) (y :: k). f x -> f y -> Maybe (x :~: y)) -> forall (x :: l) (y :: l). t f x -> t f y -> Maybe (x :~: y) Source #

#### Instances

Instances details

TestEqualityFC (Assignment :: (k -> Type) -> Ctx k -> Type) Source # |
Instance details Defined in Data.Parameterized.Context.Unsafe Methods testEqualityFC :: (forall (x :: k) (y :: k). f x -> f y -> Maybe (x :~: y)) -> forall (x :: Ctx k) (y :: Ctx k). Assignment f x -> Assignment f y -> Maybe (x :~: y) Source #

class TestEqualityFC t => OrdFC (t :: (k -> Type) -> l -> Type) where Source #

A parameterized class for types which can be tested for parameterized ordering, when given an comparison test for subterms.

Methods

compareFC :: (forall (x :: k) (y :: k). f x -> f y -> OrderingF x y) -> forall (x :: l) (y :: l). t f x -> t f y -> OrderingF x y Source #

#### Instances

Instances details

OrdFC (Assignment :: (k -> Type) -> Ctx k -> Type) Source # |
Instance details Defined in Data.Parameterized.Context.Unsafe Methods compareFC :: (forall (x :: k) (y :: k). f x -> f y -> OrderingF x y) -> forall (x :: Ctx k) (y :: Ctx k). Assignment f x -> Assignment f y -> OrderingF x y Source #

class ShowFC (t :: (k -> Type) -> l -> Type) where Source #

A parameterized class for types which can be shown, when given functions to show parameterized subterms.

Minimal complete definition

showFC | showsPrecFC

Methods

showFC :: (forall (x :: k). f x -> String) -> forall (x :: l). t f x -> String Source #

showsPrecFC :: (forall (x :: k). Int -> f x -> ShowS) -> forall (x :: l). Int -> t f x -> ShowS Source #

class HashableFC (t :: (k -> Type) -> l -> Type) where Source #

A parameterized class for types which can be hashed, when given functions to hash parameterized subterms.

Methods

hashWithSaltFC :: (forall (x :: k). Int -> f x -> Int) -> forall (x :: l). Int -> t f x -> Int Source #

class FunctorFC (t :: (k -> Type) -> l -> Type) where Source #

A parameterized type that is a functor on all instances.

Laws:

Identity
  ``fmapFC` `id` == `id``
Composition
  ``fmapFC` (f . g) == `fmapFC` f . `fmapFC` g`

Methods

fmapFC :: (forall (x :: k). f x -> g x) -> forall (x :: l). t f x -> t g x Source #

#### Instances

Instances details

FunctorFC (Ap :: (l -> Type) -> l -> Type) Source # |
Instance details Defined in Data.Parameterized.TraversableFC Methods fmapFC :: (forall (x :: l). f x -> g x) -> forall (x :: l). Ap f x -> Ap g x Source #
FunctorFC (Alt :: (l -> Type) -> l -> Type) Source # |
Instance details Defined in Data.Parameterized.TraversableFC Methods fmapFC :: (forall (x :: l). f x -> g x) -> forall (x :: l). Alt f x -> Alt g x Source #
FunctorFC (TypeAp :: (l -> Type) -> l -> Type) Source # |
Instance details Defined in Data.Parameterized.TraversableFC Methods fmapFC :: (forall (x :: l). f x -> g x) -> forall (x :: l). TypeAp f x -> TypeAp g x Source #
FunctorFC (Assignment :: (k -> Type) -> Ctx k -> Type) Source # |
Instance details Defined in Data.Parameterized.Context.Unsafe Methods fmapFC :: (forall (x :: k). f x -> g x) -> forall (x :: Ctx k). Assignment f x -> Assignment g x Source #
FunctorFC (List :: (k -> Type) -> [k] -> Type) Source # |
Instance details Defined in Data.Parameterized.List Methods fmapFC :: (forall (x :: k). f x -> g x) -> forall (x :: [k]). List f x -> List g x Source #

class FoldableFC (t :: (k -> Type) -> l -> Type) where Source #

This is a generalization of the `Foldable` class to structures over parameterized terms.

Minimal complete definition

foldMapFC | foldrFC

Methods

foldMapFC :: forall f m. Monoid m => (forall (x :: k). f x -> m) -> forall (x :: l). t f x -> m Source #

Map each element of the structure to a monoid, and combine the results.

foldrFC :: (forall (x :: k). f x -> b -> b) -> forall (x :: l). b -> t f x -> b Source #

Right-associative fold of a structure.

foldlFC :: forall f b. (forall (x :: k). b -> f x -> b) -> forall (x :: l). b -> t f x -> b Source #

Left-associative fold of a structure.

foldrFC' :: (forall (x :: k). f x -> b -> b) -> forall (x :: l). b -> t f x -> b Source #

Right-associative fold of a structure, but with strict application of the operator.

foldlFC' :: forall f b. (forall (x :: k). b -> f x -> b) -> forall (x :: l). b -> t f x -> b Source #

Left-associative fold of a parameterized structure with a strict accumulator.

toListFC :: (forall (x :: k). f x -> a) -> forall (x :: l). t f x -> [a] Source #

Convert structure to list.

#### Instances

Instances details

FoldableFC (Ap :: (l -> Type) -> l -> Type) Source # |

Instance details

Defined in Data.Parameterized.TraversableFC

Methods

foldMapFC :: forall f m. Monoid m => (forall (x :: l). f x -> m) -> forall (x :: l). Ap f x -> m Source #

foldrFC :: (forall (x :: l). f x -> b -> b) -> forall (x :: l). b -> Ap f x -> b Source #

foldlFC :: forall f b. (forall (x :: l). b -> f x -> b) -> forall (x :: l). b -> Ap f x -> b Source #

foldrFC' :: (forall (x :: l). f x -> b -> b) -> forall (x :: l). b -> Ap f x -> b Source #

foldlFC' :: forall f b. (forall (x :: l). b -> f x -> b) -> forall (x :: l). b -> Ap f x -> b Source #

toListFC :: (forall (x :: l). f x -> a) -> forall (x :: l). Ap f x -> [a] Source #

FoldableFC (Alt :: (l -> Type) -> l -> Type) Source # |

Instance details

Defined in Data.Parameterized.TraversableFC

Methods

foldMapFC :: forall f m. Monoid m => (forall (x :: l). f x -> m) -> forall (x :: l). Alt f x -> m Source #

foldrFC :: (forall (x :: l). f x -> b -> b) -> forall (x :: l). b -> Alt f x -> b Source #

foldlFC :: forall f b. (forall (x :: l). b -> f x -> b) -> forall (x :: l). b -> Alt f x -> b Source #

foldrFC' :: (forall (x :: l). f x -> b -> b) -> forall (x :: l). b -> Alt f x -> b Source #

foldlFC' :: forall f b. (forall (x :: l). b -> f x -> b) -> forall (x :: l). b -> Alt f x -> b Source #

toListFC :: (forall (x :: l). f x -> a) -> forall (x :: l). Alt f x -> [a] Source #

FoldableFC (TypeAp :: (l -> Type) -> l -> Type) Source # |

Instance details

Defined in Data.Parameterized.TraversableFC

Methods

foldMapFC :: forall f m. Monoid m => (forall (x :: l). f x -> m) -> forall (x :: l). TypeAp f x -> m Source #

foldrFC :: (forall (x :: l). f x -> b -> b) -> forall (x :: l). b -> TypeAp f x -> b Source #

foldlFC :: forall f b. (forall (x :: l). b -> f x -> b) -> forall (x :: l). b -> TypeAp f x -> b Source #

foldrFC' :: (forall (x :: l). f x -> b -> b) -> forall (x :: l). b -> TypeAp f x -> b Source #

foldlFC' :: forall f b. (forall (x :: l). b -> f x -> b) -> forall (x :: l). b -> TypeAp f x -> b Source #

toListFC :: (forall (x :: l). f x -> a) -> forall (x :: l). TypeAp f x -> [a] Source #

FoldableFC (Assignment :: (k -> Type) -> Ctx k -> Type) Source # |

Instance details

Defined in Data.Parameterized.Context.Unsafe

Methods

foldMapFC :: forall f m. Monoid m => (forall (x :: k). f x -> m) -> forall (x :: Ctx k). Assignment f x -> m Source #

foldrFC :: (forall (x :: k). f x -> b -> b) -> forall (x :: Ctx k). b -> Assignment f x -> b Source #

foldlFC :: forall f b. (forall (x :: k). b -> f x -> b) -> forall (x :: Ctx k). b -> Assignment f x -> b Source #

foldrFC' :: (forall (x :: k). f x -> b -> b) -> forall (x :: Ctx k). b -> Assignment f x -> b Source #

foldlFC' :: forall f b. (forall (x :: k). b -> f x -> b) -> forall (x :: Ctx k). b -> Assignment f x -> b Source #

toListFC :: (forall (x :: k). f x -> a) -> forall (x :: Ctx k). Assignment f x -> [a] Source #

FoldableFC (List :: (k -> Type) -> [k] -> Type) Source # |

Instance details

Defined in Data.Parameterized.List

Methods

foldMapFC :: forall f m. Monoid m => (forall (x :: k). f x -> m) -> forall (x :: [k]). List f x -> m Source #

foldrFC :: (forall (x :: k). f x -> b -> b) -> forall (x :: [k]). b -> List f x -> b Source #

foldlFC :: forall f b. (forall (x :: k). b -> f x -> b) -> forall (x :: [k]). b -> List f x -> b Source #

foldrFC' :: (forall (x :: k). f x -> b -> b) -> forall (x :: [k]). b -> List f x -> b Source #

foldlFC' :: forall f b. (forall (x :: k). b -> f x -> b) -> forall (x :: [k]). b -> List f x -> b Source #

toListFC :: (forall (x :: k). f x -> a) -> forall (x :: [k]). List f x -> [a] Source #

foldlMFC :: forall {k} {l} t m b f (c :: l). (FoldableFC t, Monad m) => (forall (x :: k). b -> f x -> m b) -> b -> t f c -> m b Source #

Monadic fold over the elements of a structure from left to right.

foldlMFC' :: forall {k} {l} t m b f (c :: l). (FoldableFC t, Monad m) => (forall (x :: k). b -> f x -> m b) -> b -> t f c -> m b Source #

Monadic strict fold over the elements of a structure from left to right.

foldrMFC :: forall {k} {l} t m f b (c :: l). (FoldableFC t, Monad m) => (forall (x :: k). f x -> b -> m b) -> b -> t f c -> m b Source #

Monadic fold over the elements of a structure from right to left.

foldrMFC' :: forall {k} {l} t m f b (c :: l). (FoldableFC t, Monad m) => (forall (x :: k). f x -> b -> m b) -> b -> t f c -> m b Source #

Monadic strict fold over the elements of a structure from right to left.

class (FunctorFC t, FoldableFC t) => TraversableFC (t :: (k -> Type) -> l -> Type) where Source #

Methods

traverseFC :: forall f g m. Applicative m => (forall (x :: k). f x -> m (g x)) -> forall (x :: l). t f x -> m (t g x) Source #

#### Instances

Instances details

TraversableFC (Ap :: (l -> Type) -> l -> Type) Source # |
Instance details Defined in Data.Parameterized.TraversableFC Methods traverseFC :: forall f g m. Applicative m => (forall (x :: l). f x -> m (g x)) -> forall (x :: l). Ap f x -> m (Ap g x) Source #
TraversableFC (Alt :: (l -> Type) -> l -> Type) Source # |
Instance details Defined in Data.Parameterized.TraversableFC Methods traverseFC :: forall f g m. Applicative m => (forall (x :: l). f x -> m (g x)) -> forall (x :: l). Alt f x -> m (Alt g x) Source #
TraversableFC (TypeAp :: (l -> Type) -> l -> Type) Source # |
Instance details Defined in Data.Parameterized.TraversableFC Methods traverseFC :: forall f g m. Applicative m => (forall (x :: l). f x -> m (g x)) -> forall (x :: l). TypeAp f x -> m (TypeAp g x) Source #
TraversableFC (Assignment :: (k -> Type) -> Ctx k -> Type) Source # |
Instance details Defined in Data.Parameterized.Context.Unsafe Methods traverseFC :: forall f g m. Applicative m => (forall (x :: k). f x -> m (g x)) -> forall (x :: Ctx k). Assignment f x -> m (Assignment g x) Source #
TraversableFC (List :: (k -> Type) -> [k] -> Type) Source # |
Instance details Defined in Data.Parameterized.List Methods traverseFC :: forall f g m. Applicative m => (forall (x :: k). f x -> m (g x)) -> forall (x :: [k]). List f x -> m (List g x) Source #

traverseFC_ :: (FoldableFC t, Applicative m) => (forall (x :: k). f x -> m a) -> forall (x :: l). t f x -> m () Source #

Map each element of a structure to an action, evaluate these actions from left to right, and ignore the results.

forMFC_ :: forall {k} {l} t m f (c :: l) a. (FoldableFC t, Applicative m) => t f c -> (forall (x :: k). f x -> m a) -> m () Source #

Deprecated: Use forFC_

Map each element of a structure to an action, evaluate these actions from left to right, and ignore the results.

forFC_ :: forall {k} {l} t m f (c :: l) a. (FoldableFC t, Applicative m) => t f c -> (forall (x :: k). f x -> m a) -> m () Source #

Map each element of a structure to an action, evaluate these actions from left to right, and ignore the results.

forFC :: forall {k} {l} t m f (x :: l) g. (TraversableFC t, Applicative m) => t f x -> (forall (y :: k). f y -> m (g y)) -> m (t g x) Source #

Flipped `traverseFC`

fmapFCDefault :: TraversableFC t => forall (f :: k -> Type) (g :: k -> Type). (forall (x :: k). f x -> g x) -> forall (x :: l). t f x -> t g x Source #

This function may be used as a value for `fmapF` in a `FunctorF` instance.

foldMapFCDefault :: (TraversableFC t, Monoid m) => (forall (x :: k). f x -> m) -> forall (x :: l). t f x -> m Source #

This function may be used as a value for `foldMap` in a `Foldable` instance.

allFC :: FoldableFC t => (forall (x :: k). f x -> Bool) -> forall (x :: l). t f x -> Bool Source #

Return `True` if all values satisfy predicate.

anyFC :: FoldableFC t => (forall (x :: k). f x -> Bool) -> forall (x :: l). t f x -> Bool Source #

Return `True` if any values satisfy predicate.

lengthFC :: forall {k} {l} t (f :: k -> Type) (x :: l). FoldableFC t => t f x -> Int Source #

Return number of elements that we fold over.