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

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

Data.Parameterized.Some

Description

This module provides `Some`, a GADT that hides a type parameter.

Synopsis

- data Some (f :: k -> Type) = Some (f x)
- viewSome :: (forall (tp :: k). f tp -> r) -> Some f -> r
- mapSome :: (forall (tp :: k). f tp -> g tp) -> Some f -> Some g
- traverseSome :: forall {k} m f g. Functor m => (forall (tp :: k). f tp -> m (g tp)) -> Some f -> m (Some g)
- traverseSome_ :: forall {k} m f. Functor m => (forall (tp :: k). f tp -> m ()) -> Some f -> m ()
- someLens :: forall {k} f a. (forall (tp :: k) (f1 :: Type -> Type). Functor f1 => (a -> f1 a) -> f tp -> f1 (f tp)) -> Lens' (Some f) a

# Documentation

data Some (f :: k -> Type) Source #

Constructors

Some (f x) |

#### Instances

Instances details

OrdC (Some :: (k -> Type) -> Type) Source # |
Instance details Defined in Data.Parameterized.ClassesC Methods compareC :: (forall (x :: k) (y :: k). f x -> g y -> OrderingF x y) -> Some f -> Some g -> Ordering Source #
TestEqualityC (Some :: (k -> Type) -> Type) Source # | This instance demonstrates where the above class is useful: namely, in types with existential quantification.
Instance details Defined in Data.Parameterized.ClassesC Methods testEqualityC :: (forall (x :: k) (y :: k). f x -> f y -> Maybe (x :~: y)) -> Some f -> Some f -> Bool Source #
FoldableF (Some :: (k -> Type) -> Type) Source # |

Instance details

Defined in Data.Parameterized.Some

Methods

foldMapF :: Monoid m => (forall (s :: k). e s -> m) -> Some e -> m Source #

foldrF :: (forall (s :: k). e s -> b -> b) -> b -> Some e -> b Source #

foldlF :: (forall (s :: k). b -> e s -> b) -> b -> Some e -> b Source #

foldrF' :: (forall (s :: k). e s -> b -> b) -> b -> Some e -> b Source #

foldlF' :: (forall (s :: k). b -> e s -> b) -> b -> Some e -> b Source #

toListF :: (forall (tp :: k). f tp -> a) -> Some f -> [a] Source #

FunctorF (Some :: (k -> Type) -> Type) Source # |
Instance details Defined in Data.Parameterized.Some Methods fmapF :: (forall (x :: k). f x -> g x) -> Some f -> Some g Source #
TraversableF (Some :: (k -> Type) -> Type) Source # |
Instance details Defined in Data.Parameterized.Some Methods traverseF :: Applicative m => (forall (s :: k). e s -> m (f s)) -> Some e -> m (Some f) Source #
ShowF f => Show (Some f) Source # |
Instance details Defined in Data.Parameterized.Some Methods showsPrec :: Int -> Some f -> ShowS Source # show :: Some f -> String Source # showList :: [Some f] -> ShowS Source #
TestEquality f => Eq (Some f) Source # |
Instance details Defined in Data.Parameterized.Some Methods (==) :: Some f -> Some f -> Bool Source # (/=) :: Some f -> Some f -> Bool Source #
OrdF f => Ord (Some f) Source # |
Instance details Defined in Data.Parameterized.Some Methods compare :: Some f -> Some f -> Ordering Source # (<) :: Some f -> Some f -> Bool Source # (<=) :: Some f -> Some f -> Bool Source # (>) :: Some f -> Some f -> Bool Source # (>=) :: Some f -> Some f -> Bool Source # max :: Some f -> Some f -> Some f Source # min :: Some f -> Some f -> Some f Source #
(HashableF f, TestEquality f) => Hashable (Some f) Source # |
Instance details Defined in Data.Parameterized.Some Methods hashWithSalt :: Int -> Some f -> Int Source # hash :: Some f -> Int Source #

viewSome :: (forall (tp :: k). f tp -> r) -> Some f -> r Source #

Project out of Some.

mapSome :: (forall (tp :: k). f tp -> g tp) -> Some f -> Some g Source #

Apply function to inner value.

traverseSome :: forall {k} m f g. Functor m => (forall (tp :: k). f tp -> m (g tp)) -> Some f -> m (Some g) Source #

Modify the inner value.

traverseSome_ :: forall {k} m f. Functor m => (forall (tp :: k). f tp -> m ()) -> Some f -> m () Source #

Modify the inner value.

someLens :: forall {k} f a. (forall (tp :: k) (f1 :: Type -> Type). Functor f1 => (a -> f1 a) -> f tp -> f1 (f tp)) -> Lens' (Some f) a Source #

A lens that is polymorphic in the index may be used on a value with an existentially-quantified index.