Safe Haskell | None |
---|---|
Language | Haskell2010 |
As a simple example of a schema, let's consider a simple record type:
import Schemas import Schemas.SOP data Person = Person { name :: String , age :: Int , addresses :: [String] } personSchema :: TypedSchema Person personSchema = record $ Person <$> fieldWith string "name" name <*> fieldWith int "age" age <*> fieldWith (list string) "addresses" addresses
Or, by relying on the HasSchema
type class:
personSchema :: TypedSchema Person personSchema = record $ Person <$> field "name" name <*> field "age" age <*> field "addresses" addresses
Or, if the type is SOP generic:
personSchema = gSchema defOptions
Synopsis
- data TypedSchemaFlex from a
- type TypedSchema a = TypedSchemaFlex a a
- class HasSchema a where
- schema :: TypedSchema a
- enum :: Eq a => (a -> Text) -> NonEmpty a -> TypedSchema a
- readShow :: (Read a, Show a) => TypedSchema a
- list :: IsList l => TypedSchema (Item l) -> TypedSchema l
- vector :: TypedSchema a -> TypedSchema (Vector a)
- class Key a where
- stringMap :: TypedSchema a -> TypedSchema (HashMap Text a)
- viaJSON :: (FromJSON a, ToJSON a) => Text -> TypedSchema a
- viaIso :: Iso' a b -> TypedSchema a -> TypedSchema b
- record :: RecordFields from a -> TypedSchemaFlex from a
- data RecordFields from a
- data RecordField from a
- field :: HasSchema a => Text -> (from -> a) -> RecordFields from a
- fieldWith :: TypedSchema a -> Text -> (from -> a) -> RecordFields from a
- fieldWith' :: TypedSchemaFlex from a -> Text -> RecordFields from a
- optField :: forall a from. HasSchema a => Text -> (from -> Maybe a) -> RecordFields from (Maybe a)
- optFieldWith :: forall a from. TypedSchemaFlex from (Maybe a) -> Text -> RecordFields from (Maybe a)
- optFieldEither :: forall a from e. HasSchema a => Text -> (from -> Either e a) -> e -> RecordFields from (Either e a)
- optFieldEitherWith :: TypedSchemaFlex from (Either e a) -> Text -> e -> RecordFields from (Either e a)
- optFieldGeneral :: forall a from. TypedSchemaFlex from a -> Text -> a -> RecordFields from a
- fieldName :: RecordField from a -> Text
- fieldNameL :: Lens' (RecordField from a) Text
- overFieldNames :: (Text -> Text) -> RecordFields from a -> RecordFields from a
- extractFields :: RecordFields from a -> NonDet [(Text, Field)]
- liftJust :: TypedSchemaFlex a b -> TypedSchemaFlex (Maybe a) (Maybe b)
- liftRight :: TypedSchemaFlex a b -> TypedSchemaFlex (Either c a) (Either c b)
- liftPrism :: Text -> Prism s t a b -> TypedSchemaFlex a b -> TypedSchemaFlex s t
- union :: NonEmpty (Text, TypedSchema a) -> TypedSchema a
- union' :: NonEmpty (UnionTag from) -> TypedSchema from
- alt :: HasSchema a => Text -> Prism' from a -> UnionTag from
- altWith :: TypedSchema a -> Text -> Prism' from a -> UnionTag from
- data UnionTag from
- oneOf :: NonEmpty (TypedSchemaFlex from a) -> TypedSchemaFlex from a
- encode :: HasSchema a => a -> Value
- decode :: HasSchema a => Value -> Either [(Trace, DecodeError)] a
- encodeTo :: HasSchema a => Schema -> Maybe (a -> Value)
- decodeFrom :: HasSchema a => Schema -> Maybe (Value -> Either [(Trace, DecodeError)] a)
- encodeWith :: TypedSchemaFlex from a -> from -> Value
- decodeWith :: TypedSchemaFlex from a -> Value -> Either [(Trace, DecodeError)] a
- encodeToWith :: TypedSchema a -> Schema -> Maybe (a -> Value)
- decodeFromWith :: TypedSchema a -> Schema -> Maybe (Value -> Either [(Trace, DecodeError)] a)
- data DecodeError
- finiteValue :: Validators -> Natural -> Schema -> Value -> Value
- finiteEncode :: forall a. HasSchema a => Natural -> a -> Value
- data Schema where
- data Field = Field {
- fieldSchema :: Schema
- isRequired :: Bool
- _Empty :: Prism' Schema ()
- _Union :: Prism' Schema (NonEmpty (Text, Schema))
- extractSchema :: TypedSchemaFlex from a -> Schema
- theSchema :: forall a. HasSchema a => Schema
- data Mismatch
- = MissingRecordField { }
- | MissingEnumChoices { }
- | OptionalRecordField { }
- | InvalidRecordField {
- name :: Text
- mismatches :: [Mismatch]
- | InvalidEnumValue { }
- | InvalidConstructor { }
- | InvalidUnionValue { }
- | SchemaMismatch { }
- | ValueMismatch { }
- | EmptyAllOf
- | PrimValidatorMissing { }
- | PrimError { }
- | InvalidChoice {
- choiceNumber :: Int
- | TryFailed { }
- | AllAlternativesFailed {
- mismatches :: [Mismatch]
- type Trace = [Text]
- isSubtypeOf :: Validators -> Schema -> Schema -> Either [(Trace, Mismatch)] (Value -> Value)
- versions :: Schema -> NonEmpty Schema
- coerce :: forall sub sup. (HasSchema sub, HasSchema sup) => Value -> Maybe Value
- finite :: Natural -> Schema -> Schema
- validate :: Validators -> Schema -> Value -> [(Trace, Mismatch)]
- validatorsFor :: forall a. HasSchema a => Validators
- class Profunctor (p :: Type -> Type -> Type) where
Typed schemas
data TypedSchemaFlex from a Source #
TypedSchemaFlex enc dec
is a schema for encoding to enc
and decoding to dec
.
Usually we want enc
and dec
to be the same type but this flexibility comes in handy
for composition.
Instances
type TypedSchema a = TypedSchemaFlex a a Source #
class HasSchema a where Source #
schema :: TypedSchema a Source #
Instances
Construction
enum :: Eq a => (a -> Text) -> NonEmpty a -> TypedSchema a Source #
enum values mapping
construct a schema for a non empty set of values with a Text
mapping
readShow :: (Read a, Show a) => TypedSchema a Source #
A schema for types that can be parsed and pretty-printed. The resulting schema is opaque and cannot be subtyped/versioned, so this constructor is best used for primitive value
list :: IsList l => TypedSchema (Item l) -> TypedSchema l Source #
list sc
is the schema for a list of values with schema sc
vector :: TypedSchema a -> TypedSchema (Vector a) Source #
vector sc
is the schema for a vector of values with schema sc
stringMap :: TypedSchema a -> TypedSchema (HashMap Text a) Source #
stringMap sc
is the schema for a stringmap where the values have schema sc
viaJSON :: (FromJSON a, ToJSON a) => Text -> TypedSchema a Source #
viaJson label
constructs a schema reusing existing aeson
instances. The resulting schema
is opaque and cannot be subtyped and/or versioned, so this constructor should be used sparingly.
The label
is used to describe the extracted Schema
.
viaIso :: Iso' a b -> TypedSchema a -> TypedSchema b Source #
Apply an isomorphism to a schema
Applicative record definition
record :: RecordFields from a -> TypedSchemaFlex from a Source #
Wrap an applicative record schema
data RecordFields from a Source #
An Alternative
profunctor for defining record schemas with versioning
schemaPerson = Person $ (field "name" name | field "full name" name) * (field "age" age | pure -1)
Instances
data RecordField from a Source #
Instances
Profunctor RecordField Source # | |
Defined in Schemas.Internal dimap :: (a -> b) -> (c -> d) -> RecordField b c -> RecordField a d # lmap :: (a -> b) -> RecordField b c -> RecordField a c # rmap :: (b -> c) -> RecordField a b -> RecordField a c # (#.) :: Coercible c b => q b c -> RecordField a b -> RecordField a c # (.#) :: Coercible b a => RecordField b c -> q a b -> RecordField a c # |
field :: HasSchema a => Text -> (from -> a) -> RecordFields from a Source #
field name get
introduces a field with the default schema for the type
fieldWith :: TypedSchema a -> Text -> (from -> a) -> RecordFields from a Source #
fieldWith sc n get
introduces a field
fieldWith' :: TypedSchemaFlex from a -> Text -> RecordFields from a Source #
Generalised version of fieldWith
optField :: forall a from. HasSchema a => Text -> (from -> Maybe a) -> RecordFields from (Maybe a) Source #
optField name get
introduces an optional field with the default schema for the type
optFieldWith :: forall a from. TypedSchemaFlex from (Maybe a) -> Text -> RecordFields from (Maybe a) Source #
A generalized version of optField
. Does not handle infinite/circular data.
optFieldEither :: forall a from e. HasSchema a => Text -> (from -> Either e a) -> e -> RecordFields from (Either e a) Source #
optFieldEither name get
introduces an optional field with the default schema for the type
optFieldEitherWith :: TypedSchemaFlex from (Either e a) -> Text -> e -> RecordFields from (Either e a) Source #
A generalized version of optFieldEither
. Does not handle infinite/circular data
optFieldGeneral :: forall a from. TypedSchemaFlex from a -> Text -> a -> RecordFields from a Source #
The most general introduction form for optional fields
fieldName :: RecordField from a -> Text Source #
Name of the field
fieldNameL :: Lens' (RecordField from a) Text Source #
Lens for the fieldName
attribute
overFieldNames :: (Text -> Text) -> RecordFields from a -> RecordFields from a Source #
Map a function over all the field names
extractFields :: RecordFields from a -> NonDet [(Text, Field)] Source #
Extract all the field groups (from alternatives) in the record
Partial schemas
liftJust :: TypedSchemaFlex a b -> TypedSchemaFlex (Maybe a) (Maybe b) Source #
liftJust = liftPrism _Just
liftRight :: TypedSchemaFlex a b -> TypedSchemaFlex (Either c a) (Either c b) Source #
liftRight = liftPrism _Right
liftPrism :: Text -> Prism s t a b -> TypedSchemaFlex a b -> TypedSchemaFlex s t Source #
Project a schema through a Prism. Returns a partial schema. When encoding/decoding a value that doesn't fit the prism, an optional field will be omitted, and a required field will cause this alternative to be aborted.
Unions
union :: NonEmpty (Text, TypedSchema a) -> TypedSchema a Source #
The schema of discriminated unions
import Schemas import "generic-lens" Data.Generics.Labels () import GHC.Generics data Education = Degree Text | PhD Text | NoEducation schemaEducation = union' [ alt NoEducation #_NoEducation , alt Degree #_Degree , alt PhD #_PhD ]
Given a non empty set of tagged partial schemas, constructs the schema that applies them in order and selects the first successful match.
union' :: NonEmpty (UnionTag from) -> TypedSchema from Source #
Given a non empty set of constructors, construct the schema that selects the first matching constructor
alt :: HasSchema a => Text -> Prism' from a -> UnionTag from Source #
alt name prism
introduces a discriminated union alternative with the default schema
altWith :: TypedSchema a -> Text -> Prism' from a -> UnionTag from Source #
altWith name prism schema
introduces a discriminated union alternative
oneOf :: NonEmpty (TypedSchemaFlex from a) -> TypedSchemaFlex from a Source #
The schema of undiscriminated unions. Prefer using union
where possible
Encoding
decode :: HasSchema a => Value -> Either [(Trace, DecodeError)] a Source #
Decode using the default schema.
encodeTo :: HasSchema a => Schema -> Maybe (a -> Value) Source #
Attempt to encode to the target schema using the default schema.
First encodes using the default schema, then computes a coercion
applying isSubtypeOf
, and then applies the coercion to the encoded data.
decodeFrom :: HasSchema a => Schema -> Maybe (Value -> Either [(Trace, DecodeError)] a) Source #
Apply isSubtypeOf
to construct a coercion from the source schema to the default schema,
apply the coercion to the data, and attempt to decode using the default schema.
encodeWith :: TypedSchemaFlex from a -> from -> Value Source #
Given a value and its typed schema, produce a JSON record using the RecordField
s
decodeWith :: TypedSchemaFlex from a -> Value -> Either [(Trace, DecodeError)] a Source #
Given a JSON Value
and a typed schema, extract a Haskell value
encodeToWith :: TypedSchema a -> Schema -> Maybe (a -> Value) Source #
decodeFromWith :: TypedSchema a -> Schema -> Maybe (Value -> Either [(Trace, DecodeError)] a) Source #
data DecodeError Source #
Instances
Eq DecodeError Source # | |
Defined in Schemas.Internal (==) :: DecodeError -> DecodeError -> Bool # (/=) :: DecodeError -> DecodeError -> Bool # | |
Show DecodeError Source # | |
Defined in Schemas.Internal showsPrec :: Int -> DecodeError -> ShowS # show :: DecodeError -> String # showList :: [DecodeError] -> ShowS # |
working with recursive schemas
finiteValue :: Validators -> Natural -> Schema -> Value -> Value Source #
Ensure that a Value
is finite by enforcing a max depth in a schema preserving way
finiteEncode :: forall a. HasSchema a => Natural -> a -> Value Source #
Encode a value into a finite representation by enforcing a max depth
Untyped schemas
A schema for untyped data, such as JSON or XML.
- introduction forms:
extractSchema
,theSchema
,mempty
- operations:
isSubtypeOf
,versions
,coerce
,validate
- composition: '(<>)'
Array Schema | |
StringMap Schema | |
Enum (NonEmpty Text) | |
Record (HashMap Text Field) | |
AllOf (NonEmpty Schema) | Encoding and decoding work for all alternatives |
OneOf (NonEmpty Schema) | Decoding works for all alternatives, encoding only for one |
Prim Text | Carries the name of primitive type |
Instances
Field | |
|
Instances
Eq Field Source # | |
Show Field Source # | |
Generic Field Source # | |
HasSchema Field Source # | |
Defined in Schemas.Class | |
type Rep Field Source # | |
Defined in Schemas.Untyped type Rep Field = D1 (MetaData "Field" "Schemas.Untyped" "schemas-0.1.1.0-9zDZuHVzzF7Fl693Gilt6H" False) (C1 (MetaCons "Field" PrefixI True) (S1 (MetaSel (Just "fieldSchema") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Schema) :*: S1 (MetaSel (Just "isRequired") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool))) |
Extraction
extractSchema :: TypedSchemaFlex from a -> Schema Source #
Extract an untyped schema that can be serialized
Functions
Instances
Eq Mismatch Source # | |
Show Mismatch Source # | |
Exception Mismatch Source # | |
Defined in Schemas.Untyped toException :: Mismatch -> SomeException # fromException :: SomeException -> Maybe Mismatch # displayException :: Mismatch -> String # |
isSubtypeOf :: Validators -> Schema -> Schema -> Either [(Trace, Mismatch)] (Value -> Value) Source #
sub
returns a witness that isSubtypeOf
supsub
is a subtype of sup
, i.e. a cast function sub -> sup
Array Bool `isSubtypeOf` Bool
Just function
> Record [("a", Bool)] isSubtypeOf
Record [("a", Number)]
Nothing
versions :: Schema -> NonEmpty Schema Source #
Flattens alternatives. Returns a schema without AllOf
constructors
coerce :: forall sub sup. (HasSchema sub, HasSchema sup) => Value -> Maybe Value Source #
Coerce from sub
to sup
Returns Nothing
if sub
is not a subtype of sup
finite :: Natural -> Schema -> Schema Source #
Ensure that a Schema
is finite by enforcing a max depth.
The result is guaranteed to be a supertype of the input.
validate :: Validators -> Schema -> Value -> [(Trace, Mismatch)] Source #
Structural validation of a JSON value against a schema Ignores extraneous fields in records
validatorsFor :: forall a. HasSchema a => Validators Source #
Reexports
class Profunctor (p :: Type -> Type -> Type) where #
Formally, the class Profunctor
represents a profunctor
from Hask
-> Hask
.
Intuitively it is a bifunctor where the first argument is contravariant and the second argument is covariant.
You can define a Profunctor
by either defining dimap
or by defining both
lmap
and rmap
.
If you supply dimap
, you should ensure that:
dimap
id
id
≡id
If you supply lmap
and rmap
, ensure:
lmap
id
≡id
rmap
id
≡id
If you supply both, you should also ensure:
dimap
f g ≡lmap
f.
rmap
g
These ensure by parametricity:
dimap
(f.
g) (h.
i) ≡dimap
g h.
dimap
f ilmap
(f.
g) ≡lmap
g.
lmap
frmap
(f.
g) ≡rmap
f.
rmap
g
Instances
Profunctor ReifiedGetter | |
Defined in Control.Lens.Reified dimap :: (a -> b) -> (c -> d) -> ReifiedGetter b c -> ReifiedGetter a d # lmap :: (a -> b) -> ReifiedGetter b c -> ReifiedGetter a c # rmap :: (b -> c) -> ReifiedGetter a b -> ReifiedGetter a c # (#.) :: Coercible c b => q b c -> ReifiedGetter a b -> ReifiedGetter a c # (.#) :: Coercible b a => ReifiedGetter b c -> q a b -> ReifiedGetter a c # | |
Profunctor ReifiedFold | |
Defined in Control.Lens.Reified dimap :: (a -> b) -> (c -> d) -> ReifiedFold b c -> ReifiedFold a d # lmap :: (a -> b) -> ReifiedFold b c -> ReifiedFold a c # rmap :: (b -> c) -> ReifiedFold a b -> ReifiedFold a c # (#.) :: Coercible c b => q b c -> ReifiedFold a b -> ReifiedFold a c # (.#) :: Coercible b a => ReifiedFold b c -> q a b -> ReifiedFold a c # | |
Profunctor RecordFields Source # | |
Defined in Schemas.Internal dimap :: (a -> b) -> (c -> d) -> RecordFields b c -> RecordFields a d # lmap :: (a -> b) -> RecordFields b c -> RecordFields a c # rmap :: (b -> c) -> RecordFields a b -> RecordFields a c # (#.) :: Coercible c b => q b c -> RecordFields a b -> RecordFields a c # (.#) :: Coercible b a => RecordFields b c -> q a b -> RecordFields a c # | |
Profunctor RecordField Source # | |
Defined in Schemas.Internal dimap :: (a -> b) -> (c -> d) -> RecordField b c -> RecordField a d # lmap :: (a -> b) -> RecordField b c -> RecordField a c # rmap :: (b -> c) -> RecordField a b -> RecordField a c # (#.) :: Coercible c b => q b c -> RecordField a b -> RecordField a c # (.#) :: Coercible b a => RecordField b c -> q a b -> RecordField a c # | |
Profunctor TypedSchemaFlex Source # | |
Defined in Schemas.Internal dimap :: (a -> b) -> (c -> d) -> TypedSchemaFlex b c -> TypedSchemaFlex a d # lmap :: (a -> b) -> TypedSchemaFlex b c -> TypedSchemaFlex a c # rmap :: (b -> c) -> TypedSchemaFlex a b -> TypedSchemaFlex a c # (#.) :: Coercible c b => q b c -> TypedSchemaFlex a b -> TypedSchemaFlex a c # (.#) :: Coercible b a => TypedSchemaFlex b c -> q a b -> TypedSchemaFlex a c # | |
Monad m => Profunctor (Kleisli m) | |
Defined in Data.Profunctor.Unsafe dimap :: (a -> b) -> (c -> d) -> Kleisli m b c -> Kleisli m a d # lmap :: (a -> b) -> Kleisli m b c -> Kleisli m a c # rmap :: (b -> c) -> Kleisli m a b -> Kleisli m a c # (#.) :: Coercible c b => q b c -> Kleisli m a b -> Kleisli m a c # (.#) :: Coercible b a => Kleisli m b c -> q a b -> Kleisli m a c # | |
Profunctor (ReifiedIndexedGetter i) | |
Defined in Control.Lens.Reified dimap :: (a -> b) -> (c -> d) -> ReifiedIndexedGetter i b c -> ReifiedIndexedGetter i a d # lmap :: (a -> b) -> ReifiedIndexedGetter i b c -> ReifiedIndexedGetter i a c # rmap :: (b -> c) -> ReifiedIndexedGetter i a b -> ReifiedIndexedGetter i a c # (#.) :: Coercible c b => q b c -> ReifiedIndexedGetter i a b -> ReifiedIndexedGetter i a c # (.#) :: Coercible b a => ReifiedIndexedGetter i b c -> q a b -> ReifiedIndexedGetter i a c # | |
Profunctor (ReifiedIndexedFold i) | |
Defined in Control.Lens.Reified dimap :: (a -> b) -> (c -> d) -> ReifiedIndexedFold i b c -> ReifiedIndexedFold i a d # lmap :: (a -> b) -> ReifiedIndexedFold i b c -> ReifiedIndexedFold i a c # rmap :: (b -> c) -> ReifiedIndexedFold i a b -> ReifiedIndexedFold i a c # (#.) :: Coercible c b => q b c -> ReifiedIndexedFold i a b -> ReifiedIndexedFold i a c # (.#) :: Coercible b a => ReifiedIndexedFold i b c -> q a b -> ReifiedIndexedFold i a c # | |
Profunctor (Indexed i) | |
Defined in Control.Lens.Internal.Indexed dimap :: (a -> b) -> (c -> d) -> Indexed i b c -> Indexed i a d # lmap :: (a -> b) -> Indexed i b c -> Indexed i a c # rmap :: (b -> c) -> Indexed i a b -> Indexed i a c # (#.) :: Coercible c b => q b c -> Indexed i a b -> Indexed i a c # (.#) :: Coercible b a => Indexed i b c -> q a b -> Indexed i a c # | |
Profunctor p => Profunctor (CofreeMapping p) | |
Defined in Data.Profunctor.Mapping dimap :: (a -> b) -> (c -> d) -> CofreeMapping p b c -> CofreeMapping p a d # lmap :: (a -> b) -> CofreeMapping p b c -> CofreeMapping p a c # rmap :: (b -> c) -> CofreeMapping p a b -> CofreeMapping p a c # (#.) :: Coercible c b => q b c -> CofreeMapping p a b -> CofreeMapping p a c # (.#) :: Coercible b a => CofreeMapping p b c -> q a b -> CofreeMapping p a c # | |
Profunctor (FreeMapping p) | |
Defined in Data.Profunctor.Mapping dimap :: (a -> b) -> (c -> d) -> FreeMapping p b c -> FreeMapping p a d # lmap :: (a -> b) -> FreeMapping p b c -> FreeMapping p a c # rmap :: (b -> c) -> FreeMapping p a b -> FreeMapping p a c # (#.) :: Coercible c b => q b c -> FreeMapping p a b -> FreeMapping p a c # (.#) :: Coercible b a => FreeMapping p b c -> q a b -> FreeMapping p a c # | |
Profunctor p => Profunctor (TambaraSum p) | |
Defined in Data.Profunctor.Choice dimap :: (a -> b) -> (c -> d) -> TambaraSum p b c -> TambaraSum p a d # lmap :: (a -> b) -> TambaraSum p b c -> TambaraSum p a c # rmap :: (b -> c) -> TambaraSum p a b -> TambaraSum p a c # (#.) :: Coercible c b => q b c -> TambaraSum p a b -> TambaraSum p a c # (.#) :: Coercible b a => TambaraSum p b c -> q a b -> TambaraSum p a c # | |
Profunctor (PastroSum p) | |
Defined in Data.Profunctor.Choice dimap :: (a -> b) -> (c -> d) -> PastroSum p b c -> PastroSum p a d # lmap :: (a -> b) -> PastroSum p b c -> PastroSum p a c # rmap :: (b -> c) -> PastroSum p a b -> PastroSum p a c # (#.) :: Coercible c b => q b c -> PastroSum p a b -> PastroSum p a c # (.#) :: Coercible b a => PastroSum p b c -> q a b -> PastroSum p a c # | |
Profunctor (CotambaraSum p) | |
Defined in Data.Profunctor.Choice dimap :: (a -> b) -> (c -> d) -> CotambaraSum p b c -> CotambaraSum p a d # lmap :: (a -> b) -> CotambaraSum p b c -> CotambaraSum p a c # rmap :: (b -> c) -> CotambaraSum p a b -> CotambaraSum p a c # (#.) :: Coercible c b => q b c -> CotambaraSum p a b -> CotambaraSum p a c # (.#) :: Coercible b a => CotambaraSum p b c -> q a b -> CotambaraSum p a c # | |
Profunctor (CopastroSum p) | |
Defined in Data.Profunctor.Choice dimap :: (a -> b) -> (c -> d) -> CopastroSum p b c -> CopastroSum p a d # lmap :: (a -> b) -> CopastroSum p b c -> CopastroSum p a c # rmap :: (b -> c) -> CopastroSum p a b -> CopastroSum p a c # (#.) :: Coercible c b => q b c -> CopastroSum p a b -> CopastroSum p a c # (.#) :: Coercible b a => CopastroSum p b c -> q a b -> CopastroSum p a c # | |
Profunctor p => Profunctor (Closure p) | |
Defined in Data.Profunctor.Closed dimap :: (a -> b) -> (c -> d) -> Closure p b c -> Closure p a d # lmap :: (a -> b) -> Closure p b c -> Closure p a c # rmap :: (b -> c) -> Closure p a b -> Closure p a c # (#.) :: Coercible c b => q b c -> Closure p a b -> Closure p a c # (.#) :: Coercible b a => Closure p b c -> q a b -> Closure p a c # | |
Profunctor (Environment p) | |
Defined in Data.Profunctor.Closed dimap :: (a -> b) -> (c -> d) -> Environment p b c -> Environment p a d # lmap :: (a -> b) -> Environment p b c -> Environment p a c # rmap :: (b -> c) -> Environment p a b -> Environment p a c # (#.) :: Coercible c b => q b c -> Environment p a b -> Environment p a c # (.#) :: Coercible b a => Environment p b c -> q a b -> Environment p a c # | |
Profunctor p => Profunctor (Tambara p) | |
Defined in Data.Profunctor.Strong dimap :: (a -> b) -> (c -> d) -> Tambara p b c -> Tambara p a d # lmap :: (a -> b) -> Tambara p b c -> Tambara p a c # rmap :: (b -> c) -> Tambara p a b -> Tambara p a c # (#.) :: Coercible c b => q b c -> Tambara p a b -> Tambara p a c # (.#) :: Coercible b a => Tambara p b c -> q a b -> Tambara p a c # | |
Profunctor (Pastro p) | |
Defined in Data.Profunctor.Strong | |
Profunctor (Cotambara p) | |
Defined in Data.Profunctor.Strong dimap :: (a -> b) -> (c -> d) -> Cotambara p b c -> Cotambara p a d # lmap :: (a -> b) -> Cotambara p b c -> Cotambara p a c # rmap :: (b -> c) -> Cotambara p a b -> Cotambara p a c # (#.) :: Coercible c b => q b c -> Cotambara p a b -> Cotambara p a c # (.#) :: Coercible b a => Cotambara p b c -> q a b -> Cotambara p a c # | |
Profunctor (Copastro p) | |
Defined in Data.Profunctor.Strong dimap :: (a -> b) -> (c -> d) -> Copastro p b c -> Copastro p a d # lmap :: (a -> b) -> Copastro p b c -> Copastro p a c # rmap :: (b -> c) -> Copastro p a b -> Copastro p a c # (#.) :: Coercible c b => q b c -> Copastro p a b -> Copastro p a c # (.#) :: Coercible b a => Copastro p b c -> q a b -> Copastro p a c # | |
Functor f => Profunctor (Star f) | |
Defined in Data.Profunctor.Types | |
Functor f => Profunctor (Costar f) | |
Defined in Data.Profunctor.Types | |
Arrow p => Profunctor (WrappedArrow p) | |
Defined in Data.Profunctor.Types dimap :: (a -> b) -> (c -> d) -> WrappedArrow p b c -> WrappedArrow p a d # lmap :: (a -> b) -> WrappedArrow p b c -> WrappedArrow p a c # rmap :: (b -> c) -> WrappedArrow p a b -> WrappedArrow p a c # (#.) :: Coercible c b => q b c -> WrappedArrow p a b -> WrappedArrow p a c # (.#) :: Coercible b a => WrappedArrow p b c -> q a b -> WrappedArrow p a c # | |
Profunctor (Forget r) | |
Defined in Data.Profunctor.Types | |
Profunctor (Tagged :: Type -> Type -> Type) | |
Defined in Data.Profunctor.Unsafe | |
Profunctor ((->) :: Type -> Type -> Type) | |
Functor w => Profunctor (Cokleisli w) | |
Defined in Data.Profunctor.Unsafe dimap :: (a -> b) -> (c -> d) -> Cokleisli w b c -> Cokleisli w a d # lmap :: (a -> b) -> Cokleisli w b c -> Cokleisli w a c # rmap :: (b -> c) -> Cokleisli w a b -> Cokleisli w a c # (#.) :: Coercible c b => q b c -> Cokleisli w a b -> Cokleisli w a c # (.#) :: Coercible b a => Cokleisli w b c -> q a b -> Cokleisli w a c # | |
Profunctor (Market a b) | |
Defined in Control.Lens.Internal.Prism dimap :: (a0 -> b0) -> (c -> d) -> Market a b b0 c -> Market a b a0 d # lmap :: (a0 -> b0) -> Market a b b0 c -> Market a b a0 c # rmap :: (b0 -> c) -> Market a b a0 b0 -> Market a b a0 c # (#.) :: Coercible c b0 => q b0 c -> Market a b a0 b0 -> Market a b a0 c # (.#) :: Coercible b0 a0 => Market a b b0 c -> q a0 b0 -> Market a b a0 c # | |
Profunctor (Exchange a b) | |
Defined in Control.Lens.Internal.Iso dimap :: (a0 -> b0) -> (c -> d) -> Exchange a b b0 c -> Exchange a b a0 d # lmap :: (a0 -> b0) -> Exchange a b b0 c -> Exchange a b a0 c # rmap :: (b0 -> c) -> Exchange a b a0 b0 -> Exchange a b a0 c # (#.) :: Coercible c b0 => q b0 c -> Exchange a b a0 b0 -> Exchange a b a0 c # (.#) :: Coercible b0 a0 => Exchange a b b0 c -> q a0 b0 -> Exchange a b a0 c # | |
(Profunctor p, Profunctor q) => Profunctor (Procompose p q) | |
Defined in Data.Profunctor.Composition dimap :: (a -> b) -> (c -> d) -> Procompose p q b c -> Procompose p q a d # lmap :: (a -> b) -> Procompose p q b c -> Procompose p q a c # rmap :: (b -> c) -> Procompose p q a b -> Procompose p q a c # (#.) :: Coercible c b => q0 b c -> Procompose p q a b -> Procompose p q a c # (.#) :: Coercible b a => Procompose p q b c -> q0 a b -> Procompose p q a c # | |
(Profunctor p, Profunctor q) => Profunctor (Rift p q) | |
Defined in Data.Profunctor.Composition | |
Functor f => Profunctor (Joker f :: Type -> Type -> Type) | |
Defined in Data.Profunctor.Unsafe | |
Contravariant f => Profunctor (Clown f :: Type -> Type -> Type) | |
Defined in Data.Profunctor.Unsafe | |
(Profunctor p, Profunctor q) => Profunctor (Sum p q) | |
Defined in Data.Profunctor.Unsafe | |
(Profunctor p, Profunctor q) => Profunctor (Product p q) | |
Defined in Data.Profunctor.Unsafe dimap :: (a -> b) -> (c -> d) -> Product p q b c -> Product p q a d # lmap :: (a -> b) -> Product p q b c -> Product p q a c # rmap :: (b -> c) -> Product p q a b -> Product p q a c # (#.) :: Coercible c b => q0 b c -> Product p q a b -> Product p q a c # (.#) :: Coercible b a => Product p q b c -> q0 a b -> Product p q a c # | |
(Functor f, Profunctor p) => Profunctor (Tannen f p) | |
Defined in Data.Profunctor.Unsafe dimap :: (a -> b) -> (c -> d) -> Tannen f p b c -> Tannen f p a d # lmap :: (a -> b) -> Tannen f p b c -> Tannen f p a c # rmap :: (b -> c) -> Tannen f p a b -> Tannen f p a c # (#.) :: Coercible c b => q b c -> Tannen f p a b -> Tannen f p a c # (.#) :: Coercible b a => Tannen f p b c -> q a b -> Tannen f p a c # | |
(Profunctor p, Functor f, Functor g) => Profunctor (Biff p f g) | |
Defined in Data.Profunctor.Unsafe dimap :: (a -> b) -> (c -> d) -> Biff p f g b c -> Biff p f g a d # lmap :: (a -> b) -> Biff p f g b c -> Biff p f g a c # rmap :: (b -> c) -> Biff p f g a b -> Biff p f g a c # (#.) :: Coercible c b => q b c -> Biff p f g a b -> Biff p f g a c # (.#) :: Coercible b a => Biff p f g b c -> q a b -> Biff p f g a c # |