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

Copyright(c) Galois Inc 2014-2019
MaintainerJoe Hendrix <jhendrix@galois.com>
Safe HaskellSafe
LanguageHaskell98

Data.Parameterized.Classes

Contents

Description

This module declares classes for working with types with the kind k -> * for any kind k. These are generalizations of the Data.Functor.Classes types as they work with any kind k, and are not restricted to *.

Synopsis

Equality exports

class TestEquality (f :: k -> Type) where #

This class contains types where you can learn the equality of two types from information contained in terms. Typically, only singleton types should inhabit this class.

Methods

testEquality :: f a -> f b -> Maybe (a :~: b) #

Conditionally prove the equality of a and b.

Instances
TestEquality BoolRepr Source # 
Instance details

Defined in Data.Parameterized.BoolRepr

Methods

testEquality :: BoolRepr a -> BoolRepr b -> Maybe (a :~: b) #

TestEquality NatRepr Source # 
Instance details

Defined in Data.Parameterized.NatRepr.Internal

Methods

testEquality :: NatRepr a -> NatRepr b -> Maybe (a :~: b) #

TestEquality SymbolRepr Source # 
Instance details

Defined in Data.Parameterized.SymbolRepr

Methods

testEquality :: SymbolRepr a -> SymbolRepr b -> Maybe (a :~: b) #

TestEquality PeanoRepr Source # 
Instance details

Defined in Data.Parameterized.Peano

Methods

testEquality :: PeanoRepr a -> PeanoRepr b -> Maybe (a :~: b) #

TestEquality (Nonce :: k -> Type) Source # 
Instance details

Defined in Data.Parameterized.Nonce.Unsafe

Methods

testEquality :: Nonce a -> Nonce b -> Maybe (a :~: b) #

TestEquality (TypeRep :: k -> Type) 
Instance details

Defined in Data.Typeable.Internal

Methods

testEquality :: TypeRep a -> TypeRep b -> Maybe (a :~: b) #

TestEquality (Nonce s :: k -> Type) Source # 
Instance details

Defined in Data.Parameterized.Nonce

Methods

testEquality :: Nonce s a -> Nonce s b -> Maybe (a :~: b) #

TestEquality ((:~:) a :: k -> Type)

Since: base-4.7.0.0

Instance details

Defined in Data.Type.Equality

Methods

testEquality :: (a :~: a0) -> (a :~: b) -> Maybe (a0 :~: b) #

TestEquality (Index l :: k -> Type) Source # 
Instance details

Defined in Data.Parameterized.List

Methods

testEquality :: Index l a -> Index l b -> Maybe (a :~: b) #

TestEquality (Index ctx :: k -> Type) Source # 
Instance details

Defined in Data.Parameterized.Context.Unsafe

Methods

testEquality :: Index ctx a -> Index ctx b -> Maybe (a :~: b) #

TestEquality (Index ctx :: k -> Type) Source # 
Instance details

Defined in Data.Parameterized.Context.Safe

Methods

testEquality :: Index ctx a -> Index ctx b -> Maybe (a :~: b) #

TestEquality ((:~~:) a :: k -> Type)

Since: base-4.10.0.0

Instance details

Defined in Data.Type.Equality

Methods

testEquality :: (a :~~: a0) -> (a :~~: b) -> Maybe (a0 :~: b) #

TestEquality f => TestEquality (Compose f g :: k1 -> Type) Source # 
Instance details

Defined in Data.Parameterized.Compose

Methods

testEquality :: Compose f g a -> Compose f g b -> Maybe (a :~: b) #

TestEquality f => TestEquality (List f :: [k] -> Type) Source # 
Instance details

Defined in Data.Parameterized.List

Methods

testEquality :: List f a -> List f b -> Maybe (a :~: b) #

TestEquality f => TestEquality (Assignment f :: Ctx k -> Type) Source # 
Instance details

Defined in Data.Parameterized.Context.Unsafe

Methods

testEquality :: Assignment f a -> Assignment f b -> Maybe (a :~: b) #

TestEquality f => TestEquality (Assignment f :: Ctx k -> Type) Source # 
Instance details

Defined in Data.Parameterized.Context.Safe

Methods

testEquality :: Assignment f a -> Assignment f b -> Maybe (a :~: b) #

data (a :: k) :~: (b :: k) :: forall k. k -> k -> Type where infix 4 #

Propositional equality. If a :~: b is inhabited by some terminating value, then the type a is the same as the type b. To use this equality in practice, pattern-match on the a :~: b to get out the Refl constructor; in the body of the pattern-match, the compiler knows that a ~ b.

Since: base-4.7.0.0

Constructors

Refl :: forall k (a :: k) (b :: k). a :~: a 
Instances
Category ((:~:) :: k -> k -> Type)

Since: base-4.7.0.0

Instance details

Defined in Control.Category

Methods

id :: a :~: a #

(.) :: (b :~: c) -> (a :~: b) -> a :~: c #

TestEquality ((:~:) a :: k -> Type)

Since: base-4.7.0.0

Instance details

Defined in Data.Type.Equality

Methods

testEquality :: (a :~: a0) -> (a :~: b) -> Maybe (a0 :~: b) #

NFData2 ((:~:) :: Type -> Type -> Type)

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

liftRnf2 :: (a -> ()) -> (b -> ()) -> (a :~: b) -> () #

NFData1 ((:~:) a)

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

liftRnf :: (a0 -> ()) -> (a :~: a0) -> () #

a ~ b => Bounded (a :~: b)

Since: base-4.7.0.0

Instance details

Defined in Data.Type.Equality

Methods

minBound :: a :~: b #

maxBound :: a :~: b #

a ~ b => Enum (a :~: b)

Since: base-4.7.0.0

Instance details

Defined in Data.Type.Equality

Methods

succ :: (a :~: b) -> a :~: b #

pred :: (a :~: b) -> a :~: b #

toEnum :: Int -> a :~: b #

fromEnum :: (a :~: b) -> Int #

enumFrom :: (a :~: b) -> [a :~: b] #

enumFromThen :: (a :~: b) -> (a :~: b) -> [a :~: b] #

enumFromTo :: (a :~: b) -> (a :~: b) -> [a :~: b] #

enumFromThenTo :: (a :~: b) -> (a :~: b) -> (a :~: b) -> [a :~: b] #

Eq (a :~: b)

Since: base-4.7.0.0

Instance details

Defined in Data.Type.Equality

Methods

(==) :: (a :~: b) -> (a :~: b) -> Bool #

(/=) :: (a :~: b) -> (a :~: b) -> Bool #

(a ~ b, Data a) => Data (a :~: b)

Since: base-4.7.0.0

Instance details

Defined in Data.Data

Methods

gfoldl :: (forall d b0. Data d => c (d -> b0) -> d -> c b0) -> (forall g. g -> c g) -> (a :~: b) -> c (a :~: b) #

gunfold :: (forall b0 r. Data b0 => c (b0 -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (a :~: b) #

toConstr :: (a :~: b) -> Constr #

dataTypeOf :: (a :~: b) -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (a :~: b)) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (a :~: b)) #

gmapT :: (forall b0. Data b0 => b0 -> b0) -> (a :~: b) -> a :~: b #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> (a :~: b) -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> (a :~: b) -> r #

gmapQ :: (forall d. Data d => d -> u) -> (a :~: b) -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> (a :~: b) -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> (a :~: b) -> m (a :~: b) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> (a :~: b) -> m (a :~: b) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> (a :~: b) -> m (a :~: b) #

Ord (a :~: b)

Since: base-4.7.0.0

Instance details

Defined in Data.Type.Equality

Methods

compare :: (a :~: b) -> (a :~: b) -> Ordering #

(<) :: (a :~: b) -> (a :~: b) -> Bool #

(<=) :: (a :~: b) -> (a :~: b) -> Bool #

(>) :: (a :~: b) -> (a :~: b) -> Bool #

(>=) :: (a :~: b) -> (a :~: b) -> Bool #

max :: (a :~: b) -> (a :~: b) -> a :~: b #

min :: (a :~: b) -> (a :~: b) -> a :~: b #

a ~ b => Read (a :~: b)

Since: base-4.7.0.0

Instance details

Defined in Data.Type.Equality

Methods

readsPrec :: Int -> ReadS (a :~: b) #

readList :: ReadS [a :~: b] #

readPrec :: ReadPrec (a :~: b) #

readListPrec :: ReadPrec [a :~: b] #

Show (a :~: b)

Since: base-4.7.0.0

Instance details

Defined in Data.Type.Equality

Methods

showsPrec :: Int -> (a :~: b) -> ShowS #

show :: (a :~: b) -> String #

showList :: [a :~: b] -> ShowS #

NFData (a :~: b)

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: (a :~: b) -> () #

class EqF (f :: k -> *) where Source #

EqF provides a method eqF for testing whether two parameterized types are equal.

Unlike TestEquality, this only works when the type arguments are the same, and does not provide a proof that the types have the same type when they are equal. Thus this can be implemented over parameterized types that are unable to provide evidence that their type arguments are equal.

Methods

eqF :: f a -> f a -> Bool Source #

Instances
Eq a => EqF (Const a :: k -> Type) Source # 
Instance details

Defined in Data.Parameterized.Classes

Methods

eqF :: Const a a0 -> Const a a0 -> Bool Source #

class PolyEq u v where Source #

A polymorphic equality operator that generalizes TestEquality.

Minimal complete definition

polyEqF

Methods

polyEqF :: u -> v -> Maybe (u :~: v) Source #

polyEq :: u -> v -> Bool Source #

Instances
PolyEq (NatRepr m) (NatRepr n) Source # 
Instance details

Defined in Data.Parameterized.NatRepr.Internal

PolyEq (BoolRepr m) (BoolRepr n) Source # 
Instance details

Defined in Data.Parameterized.BoolRepr

PolyEq (PeanoRepr m) (PeanoRepr n) Source # 
Instance details

Defined in Data.Parameterized.Peano

TestEquality f => PolyEq (Assignment f x) (Assignment f y) Source # 
Instance details

Defined in Data.Parameterized.Context.Safe

Ordering generalization

class TestEquality ktp => OrdF (ktp :: k -> *) where Source #

A parameterized type that can be compared on distinct instances.

Minimal complete definition

compareF

Methods

compareF :: ktp x -> ktp y -> OrderingF x y Source #

compareF compares two keys with different type parameters. Instances must ensure that keys are only equal if the type parameters are equal.

leqF :: ktp x -> ktp y -> Bool Source #

ltF :: ktp x -> ktp y -> Bool Source #

geqF :: ktp x -> ktp y -> Bool Source #

gtF :: ktp x -> ktp y -> Bool Source #

Instances
OrdF BoolRepr Source # 
Instance details

Defined in Data.Parameterized.BoolRepr

OrdF NatRepr Source # 
Instance details

Defined in Data.Parameterized.NatRepr.Internal

OrdF SymbolRepr Source # 
Instance details

Defined in Data.Parameterized.SymbolRepr

OrdF PeanoRepr Source # 
Instance details

Defined in Data.Parameterized.Peano

OrdF (Nonce :: k -> Type) Source # 
Instance details

Defined in Data.Parameterized.Nonce.Unsafe

Methods

compareF :: Nonce x -> Nonce y -> OrderingF x y Source #

leqF :: Nonce x -> Nonce y -> Bool Source #

ltF :: Nonce x -> Nonce y -> Bool Source #

geqF :: Nonce x -> Nonce y -> Bool Source #

gtF :: Nonce x -> Nonce y -> Bool Source #

OrdF (Nonce s :: k -> Type) Source # 
Instance details

Defined in Data.Parameterized.Nonce

Methods

compareF :: Nonce s x -> Nonce s y -> OrderingF x y Source #

leqF :: Nonce s x -> Nonce s y -> Bool Source #

ltF :: Nonce s x -> Nonce s y -> Bool Source #

geqF :: Nonce s x -> Nonce s y -> Bool Source #

gtF :: Nonce s x -> Nonce s y -> Bool Source #

OrdF (Index l :: k -> Type) Source # 
Instance details

Defined in Data.Parameterized.List

Methods

compareF :: Index l x -> Index l y -> OrderingF x y Source #

leqF :: Index l x -> Index l y -> Bool Source #

ltF :: Index l x -> Index l y -> Bool Source #

geqF :: Index l x -> Index l y -> Bool Source #

gtF :: Index l x -> Index l y -> Bool Source #

OrdF (Index ctx :: k -> Type) Source # 
Instance details

Defined in Data.Parameterized.Context.Unsafe

Methods

compareF :: Index ctx x -> Index ctx y -> OrderingF x y Source #

leqF :: Index ctx x -> Index ctx y -> Bool Source #

ltF :: Index ctx x -> Index ctx y -> Bool Source #

geqF :: Index ctx x -> Index ctx y -> Bool Source #

gtF :: Index ctx x -> Index ctx y -> Bool Source #

OrdF (Index ctx :: k -> Type) Source # 
Instance details

Defined in Data.Parameterized.Context.Safe

Methods

compareF :: Index ctx x -> Index ctx y -> OrderingF x y Source #

leqF :: Index ctx x -> Index ctx y -> Bool Source #

ltF :: Index ctx x -> Index ctx y -> Bool Source #

geqF :: Index ctx x -> Index ctx y -> Bool Source #

gtF :: Index ctx x -> Index ctx y -> Bool Source #

OrdF f => OrdF (Compose f g :: k1 -> Type) Source # 
Instance details

Defined in Data.Parameterized.Classes

Methods

compareF :: Compose f g x -> Compose f g y -> OrderingF x y Source #

leqF :: Compose f g x -> Compose f g y -> Bool Source #

ltF :: Compose f g x -> Compose f g y -> Bool Source #

geqF :: Compose f g x -> Compose f g y -> Bool Source #

gtF :: Compose f g x -> Compose f g y -> Bool Source #

OrdF f => OrdF (List f :: [k] -> Type) Source # 
Instance details

Defined in Data.Parameterized.List

Methods

compareF :: List f x -> List f y -> OrderingF x y Source #

leqF :: List f x -> List f y -> Bool Source #

ltF :: List f x -> List f y -> Bool Source #

geqF :: List f x -> List f y -> Bool Source #

gtF :: List f x -> List f y -> Bool Source #

OrdF f => OrdF (Assignment f :: Ctx k -> Type) Source # 
Instance details

Defined in Data.Parameterized.Context.Unsafe

OrdF f => OrdF (Assignment f :: Ctx k -> Type) Source # 
Instance details

Defined in Data.Parameterized.Context.Safe

lexCompareF :: forall (f :: j -> *) (a :: j) (b :: j) (c :: k) (d :: k). OrdF f => f a -> f b -> (a ~ b => OrderingF c d) -> OrderingF c d Source #

Compare two values, and if they are equal compare the next values, otherwise return LTF or GTF

data OrderingF x y where Source #

Ordering over two distinct types with a proof they are equal.

Constructors

LTF :: OrderingF x y 
EQF :: OrderingF x x 
GTF :: OrderingF x y 

joinOrderingF :: forall (a :: j) (b :: j) (c :: k) (d :: k). OrderingF a b -> (a ~ b => OrderingF c d) -> OrderingF c d Source #

joinOrderingF x y first compares on x, returning an equivalent value if it is not EQF. If it is EQF, it returns y.

toOrdering :: OrderingF x y -> Ordering Source #

Convert OrderingF to standard ordering.

fromOrdering :: Ordering -> OrderingF x x Source #

Convert standard ordering to OrderingF.

ordFCompose :: forall (f :: k -> *) (g :: l -> k) x y. (forall w z. f w -> f z -> OrderingF w z) -> Compose f g x -> Compose f g y -> OrderingF x y Source #

If the "outer" functor has an OrdF instance, then one can be generated for the "inner" functor. The type-level evidence of equality is deduced via generativity of g, e.g. the inference g x ~ g y implies x ~ y.

Typeclass generalizations

class ShowF (f :: k -> *) where Source #

A parameterized type that can be shown on all instances.

To implement ShowF g, one should implement an instance Show (g tp) for all argument types tp, then write an empty instance instance ShowF g.

Minimal complete definition

Nothing

Methods

withShow :: p f -> q tp -> (Show (f tp) => a) -> a Source #

Provides a show instance for each type.

withShow :: Show (f tp) => p f -> q tp -> (Show (f tp) => a) -> a Source #

Provides a show instance for each type.

showF :: forall tp. f tp -> String Source #

showsPrecF :: forall tp. Int -> f tp -> String -> String Source #

Like showsPrec, the precedence argument is one more than the precedence of the enclosing context.

Instances
ShowF BoolRepr Source # 
Instance details

Defined in Data.Parameterized.BoolRepr

Methods

withShow :: p BoolRepr -> q tp -> (Show (BoolRepr tp) -> a) -> a Source #

showF :: BoolRepr tp -> String Source #

showsPrecF :: Int -> BoolRepr tp -> String -> String Source #

ShowF NatRepr Source # 
Instance details

Defined in Data.Parameterized.NatRepr.Internal

Methods

withShow :: p NatRepr -> q tp -> (Show (NatRepr tp) -> a) -> a Source #

showF :: NatRepr tp -> String Source #

showsPrecF :: Int -> NatRepr tp -> String -> String Source #

ShowF SymbolRepr Source # 
Instance details

Defined in Data.Parameterized.SymbolRepr

Methods

withShow :: p SymbolRepr -> q tp -> (Show (SymbolRepr tp) -> a) -> a Source #

showF :: SymbolRepr tp -> String Source #

showsPrecF :: Int -> SymbolRepr tp -> String -> String Source #

ShowF PeanoRepr Source # 
Instance details

Defined in Data.Parameterized.Peano

Methods

withShow :: p PeanoRepr -> q tp -> (Show (PeanoRepr tp) -> a) -> a Source #

showF :: PeanoRepr tp -> String Source #

showsPrecF :: Int -> PeanoRepr tp -> String -> String Source #

ShowF (Nonce :: k -> Type) Source # 
Instance details

Defined in Data.Parameterized.Nonce.Unsafe

Methods

withShow :: p Nonce -> q tp -> (Show (Nonce tp) -> a) -> a Source #

showF :: Nonce tp -> String Source #

showsPrecF :: Int -> Nonce tp -> String -> String Source #

Show x => ShowF (Const x :: k -> Type) Source # 
Instance details

Defined in Data.Parameterized.Classes

Methods

withShow :: p (Const x) -> q tp -> (Show (Const x tp) -> a) -> a Source #

showF :: Const x tp -> String Source #

showsPrecF :: Int -> Const x tp -> String -> String Source #

ShowF (Nonce s :: k -> Type) Source # 
Instance details

Defined in Data.Parameterized.Nonce

Methods

withShow :: p (Nonce s) -> q tp -> (Show (Nonce s tp) -> a) -> a Source #

showF :: Nonce s tp -> String Source #

showsPrecF :: Int -> Nonce s tp -> String -> String Source #

ShowF (Index l :: k -> Type) Source # 
Instance details

Defined in Data.Parameterized.List

Methods

withShow :: p (Index l) -> q tp -> (Show (Index l tp) -> a) -> a Source #

showF :: Index l tp -> String Source #

showsPrecF :: Int -> Index l tp -> String -> String Source #

ShowF (Index ctx :: k -> Type) Source # 
Instance details

Defined in Data.Parameterized.Context.Unsafe

Methods

withShow :: p (Index ctx) -> q tp -> (Show (Index ctx tp) -> a) -> a Source #

showF :: Index ctx tp -> String Source #

showsPrecF :: Int -> Index ctx tp -> String -> String Source #

ShowF (Index ctx :: k -> Type) Source # 
Instance details

Defined in Data.Parameterized.Context.Safe

Methods

withShow :: p (Index ctx) -> q tp -> (Show (Index ctx tp) -> a) -> a Source #

showF :: Index ctx tp -> String Source #

showsPrecF :: Int -> Index ctx tp -> String -> String Source #

ShowF f => ShowF (List f :: [k] -> Type) Source # 
Instance details

Defined in Data.Parameterized.List

Methods

withShow :: p (List f) -> q tp -> (Show (List f tp) -> a) -> a Source #

showF :: List f tp -> String Source #

showsPrecF :: Int -> List f tp -> String -> String Source #

ShowF f => ShowF (Assignment f :: Ctx k -> Type) Source # 
Instance details

Defined in Data.Parameterized.Context.Unsafe

Methods

withShow :: p (Assignment f) -> q tp -> (Show (Assignment f tp) -> a) -> a Source #

showF :: Assignment f tp -> String Source #

showsPrecF :: Int -> Assignment f tp -> String -> String Source #

ShowF f => ShowF (Assignment f :: Ctx k -> Type) Source # 
Instance details

Defined in Data.Parameterized.Context.Safe

Methods

withShow :: p (Assignment f) -> q tp -> (Show (Assignment f tp) -> a) -> a Source #

showF :: Assignment f tp -> String Source #

showsPrecF :: Int -> Assignment f tp -> String -> String Source #

showsF :: ShowF f => f tp -> String -> String Source #

class HashableF (f :: k -> *) where Source #

A parameterized type that is hashable on all instances.

Minimal complete definition

hashWithSaltF

Methods

hashWithSaltF :: Int -> f tp -> Int Source #

hashF :: f tp -> Int Source #

Hash with default salt.

Instances
HashableF BoolRepr Source # 
Instance details

Defined in Data.Parameterized.BoolRepr

HashableF NatRepr Source # 
Instance details

Defined in Data.Parameterized.NatRepr.Internal

Methods

hashWithSaltF :: Int -> NatRepr tp -> Int Source #

hashF :: NatRepr tp -> Int Source #

HashableF SymbolRepr Source # 
Instance details

Defined in Data.Parameterized.SymbolRepr

HashableF PeanoRepr Source # 
Instance details

Defined in Data.Parameterized.Peano

HashableF (Nonce :: k -> Type) Source # 
Instance details

Defined in Data.Parameterized.Nonce.Unsafe

Methods

hashWithSaltF :: Int -> Nonce tp -> Int Source #

hashF :: Nonce tp -> Int Source #

Hashable a => HashableF (Const a :: k -> Type) Source # 
Instance details

Defined in Data.Parameterized.Classes

Methods

hashWithSaltF :: Int -> Const a tp -> Int Source #

hashF :: Const a tp -> Int Source #

HashableF (Nonce s :: k -> Type) Source # 
Instance details

Defined in Data.Parameterized.Nonce

Methods

hashWithSaltF :: Int -> Nonce s tp -> Int Source #

hashF :: Nonce s tp -> Int Source #

HashableF (Index ctx :: k -> Type) Source # 
Instance details

Defined in Data.Parameterized.Context.Unsafe

Methods

hashWithSaltF :: Int -> Index ctx tp -> Int Source #

hashF :: Index ctx tp -> Int Source #

HashableF (Index ctx :: k -> Type) Source # 
Instance details

Defined in Data.Parameterized.Context.Safe

Methods

hashWithSaltF :: Int -> Index ctx tp -> Int Source #

hashF :: Index ctx tp -> Int Source #

HashableF f => HashableF (Assignment f :: Ctx k -> Type) Source # 
Instance details

Defined in Data.Parameterized.Context.Unsafe

Methods

hashWithSaltF :: Int -> Assignment f tp -> Int Source #

hashF :: Assignment f tp -> Int Source #

HashableF f => HashableF (Assignment f :: Ctx k -> Type) Source # 
Instance details

Defined in Data.Parameterized.Context.Safe

Methods

hashWithSaltF :: Int -> Assignment f tp -> Int Source #

hashF :: Assignment f tp -> Int Source #

class CoercibleF (rtp :: k -> *) where Source #

An instance of CoercibleF gives a way to coerce between all the types of a family. We generally use this to witness the fact that the type parameter to rtp is a phantom type by giving an implementation in terms of Data.Coerce.coerce.

Methods

coerceF :: rtp a -> rtp b Source #

Instances
CoercibleF (Const x :: k -> Type) Source # 
Instance details

Defined in Data.Parameterized.Classes

Methods

coerceF :: Const x a -> Const x b Source #

Optics generalizations

type family IndexF (m :: *) :: k -> * Source #

Instances
type IndexF (Assignment f ctx) Source # 
Instance details

Defined in Data.Parameterized.Context.Unsafe

type IndexF (Assignment f ctx) = Index ctx
type IndexF (Assignment f ctx) Source # 
Instance details

Defined in Data.Parameterized.Context.Safe

type IndexF (Assignment f ctx) = Index ctx
type IndexF (MapF k2 v) Source # 
Instance details

Defined in Data.Parameterized.Map

type IndexF (MapF k2 v) = k2

type family IxValueF (m :: *) :: k -> * Source #

Instances
type IxValueF (Assignment f ctx) Source # 
Instance details

Defined in Data.Parameterized.Context.Unsafe

type IxValueF (Assignment f ctx) = f
type IxValueF (Assignment f ctx) Source # 
Instance details

Defined in Data.Parameterized.Context.Safe

type IxValueF (Assignment f ctx) = f
type IxValueF (MapF k2 v) Source # 
Instance details

Defined in Data.Parameterized.Map

type IxValueF (MapF k2 v) = v

class IxedF k m where Source #

Parameterized generalization of the lens Ixed class.

Methods

ixF :: forall (x :: k). IndexF m x -> Traversal' m (IxValueF m x) Source #

Given an index into a container, build a traversal that visits the given element in the container, if it exists.

Instances
IxedF k (Assignment f ctx) Source # 
Instance details

Defined in Data.Parameterized.Context.Unsafe

Methods

ixF :: IndexF (Assignment f ctx) x -> Traversal' (Assignment f ctx) (IxValueF (Assignment f ctx) x) Source #

IxedF k (Assignment f ctx) Source # 
Instance details

Defined in Data.Parameterized.Context.Safe

Methods

ixF :: IndexF (Assignment f ctx) x -> Traversal' (Assignment f ctx) (IxValueF (Assignment f ctx) x) Source #

OrdF k => IxedF a (MapF k v) Source #

Turn a map key into a traversal that visits the indicated element in the map, if it exists.

Instance details

Defined in Data.Parameterized.Map

Methods

ixF :: IndexF (MapF k v) x -> Traversal' (MapF k v) (IxValueF (MapF k v) x) Source #

class IxedF k m => IxedF' k m where Source #

Parameterized generalization of the lens Ixed class, but with the guarantee that indexes exist in the container.

Methods

ixF' :: forall (x :: k). IndexF m x -> Lens' m (IxValueF m x) Source #

Given an index into a container, build a lens that points into the given element in the container.

Instances
IxedF' k (Assignment f ctx) Source # 
Instance details

Defined in Data.Parameterized.Context.Unsafe

Methods

ixF' :: IndexF (Assignment f ctx) x -> Lens' (Assignment f ctx) (IxValueF (Assignment f ctx) x) Source #

IxedF' k (Assignment f ctx) Source # 
Instance details

Defined in Data.Parameterized.Context.Safe

Methods

ixF' :: IndexF (Assignment f ctx) x -> Lens' (Assignment f ctx) (IxValueF (Assignment f ctx) x) Source #

class IxedF k m => AtF k m where Source #

Parameterized generalization of the lens At class.

Methods

atF :: forall (x :: k). IndexF m x -> Lens' m (Maybe (IxValueF m x)) Source #

Given an index into a container, build a lens that points into the given position in the container, whether or not it currently exists. Setting values of atF to a Just value will insert the value if it does not already exist.

Instances
OrdF k => AtF a (MapF k v) Source #

Turn a map key into a lens that points into the indicated position in the map.

Instance details

Defined in Data.Parameterized.Map

Methods

atF :: IndexF (MapF k v) x -> Lens' (MapF k v) (Maybe (IxValueF (MapF k v) x)) Source #

KnownRepr

class KnownRepr (f :: k -> *) (ctx :: k) where Source #

This class is parameterized by a kind k (typically a data kind), a type constructor f of kind k -> * (typically a GADT of singleton types indexed by k), and an index parameter ctx of kind k.

Methods

knownRepr :: f ctx Source #

Instances
KnownRepr BoolRepr False Source # 
Instance details

Defined in Data.Parameterized.BoolRepr

KnownRepr BoolRepr True Source # 
Instance details

Defined in Data.Parameterized.BoolRepr

KnownNat n => KnownRepr NatRepr (n :: Nat) Source # 
Instance details

Defined in Data.Parameterized.NatRepr.Internal

KnownSymbol s => KnownRepr SymbolRepr (s :: Symbol) Source # 
Instance details

Defined in Data.Parameterized.SymbolRepr

KnownRepr PeanoRepr Z Source # 
Instance details

Defined in Data.Parameterized.Peano

KnownRepr PeanoRepr n => KnownRepr PeanoRepr (S n :: Peano) Source # 
Instance details

Defined in Data.Parameterized.Peano

Methods

knownRepr :: PeanoRepr (S n) Source #

KnownRepr (List f :: [k] -> Type) ([] :: [k]) Source # 
Instance details

Defined in Data.Parameterized.List

Methods

knownRepr :: List f [] Source #

KnownRepr (Assignment f :: Ctx k -> Type) (EmptyCtx :: Ctx k) Source # 
Instance details

Defined in Data.Parameterized.Context.Unsafe

KnownRepr (Assignment f :: Ctx k -> Type) (EmptyCtx :: Ctx k) Source # 
Instance details

Defined in Data.Parameterized.Context.Safe

(KnownRepr f s, KnownRepr (List f) sh) => KnownRepr (List f :: [a] -> Type) (s ': sh :: [a]) Source # 
Instance details

Defined in Data.Parameterized.List

Methods

knownRepr :: List f (s ': sh) Source #

(KnownRepr (Assignment f) ctx, KnownRepr f bt) => KnownRepr (Assignment f :: Ctx k -> Type) (ctx ::> bt :: Ctx k) Source # 
Instance details

Defined in Data.Parameterized.Context.Unsafe

Methods

knownRepr :: Assignment f (ctx ::> bt) Source #

(KnownRepr (Assignment f) ctx, KnownRepr f bt) => KnownRepr (Assignment f :: Ctx k -> Type) (ctx ::> bt :: Ctx k) Source # 
Instance details

Defined in Data.Parameterized.Context.Safe

Methods

knownRepr :: Assignment f (ctx ::> bt) Source #

Re-exports

isJust :: Maybe a -> Bool #

The isJust function returns True iff its argument is of the form Just _.

Examples

Expand

Basic usage:

>>> isJust (Just 3)
True
>>> isJust (Just ())
True
>>> isJust Nothing
False

Only the outer constructor is taken into consideration:

>>> isJust (Just Nothing)
True