Safe Haskell | None |
---|---|
Language | Haskell2010 |
Type and field annotations for Lorentz types.
Synopsis
- data AnnOptions = AnnOptions {
- fieldAnnModifier :: Text -> Text
- defaultAnnOptions :: AnnOptions
- dropPrefixThen :: (Text -> Text) -> Text -> Text
- appendTo :: Text -> [Text] -> Text -> Text
- toCamel :: Text -> Text
- toPascal :: Text -> Text
- toSnake :: Text -> Text
- ctorNameToAnnWithOptions :: forall ctor. (KnownSymbol ctor, HasCallStack) => AnnOptions -> FieldAnn
- data FollowEntrypointFlag
- data GenerateFieldAnnFlag
- class HasAnnotation a where
- getAnnotation :: FollowEntrypointFlag -> Notes (ToT a)
- annOptions :: AnnOptions
- class GHasAnnotation a where
- gGetAnnotation :: AnnOptions -> FollowEntrypointFlag -> GenerateFieldAnnFlag -> (Notes (GValueType a), FieldAnn)
- gGetAnnotationNoField :: forall a. (GHasAnnotation (Rep a), GValueType (Rep a) ~ ToT a) => FollowEntrypointFlag -> Notes (ToT a)
- insertTypeAnn :: forall (b :: T). TypeAnn -> Notes b -> Notes b
Documentation
data AnnOptions Source #
Allow customization of field annotation generated for a type
when declaring its HasAnnotation
instance.
AnnOptions | |
|
dropPrefixThen :: (Text -> Text) -> Text -> Text Source #
Drops the field name prefix from a field. We assume a convention of the prefix always being lower case, and the first letter of the actual field name being uppercase. It also accepts another function which will be applied directly after dropping the prefix.
appendTo :: Text -> [Text] -> Text -> Text Source #
appendTo suffix fields field
appends the given suffix to field
if the field exists in the fields
list.
ctorNameToAnnWithOptions :: forall ctor. (KnownSymbol ctor, HasCallStack) => AnnOptions -> FieldAnn Source #
data FollowEntrypointFlag Source #
Used in GHasAnnotation
and HasAnnotation
as a flag to track
whether or not it directly follows an entrypoint to avoid introducing
extra entrypoints.
data GenerateFieldAnnFlag Source #
Used in GHasAnnotation
as a flag to track whether or not field/constructor
annotations should be generated.
class HasAnnotation a where Source #
This class defines the type and field annotations for a given type. Right now the type annotations come from names in a named field, and field annotations are generated from the record fields.
Nothing
getAnnotation :: FollowEntrypointFlag -> Notes (ToT a) Source #
default getAnnotation :: (GHasAnnotation (Rep a), GValueType (Rep a) ~ ToT a) => FollowEntrypointFlag -> Notes (ToT a) Source #
annOptions :: AnnOptions Source #
default annOptions :: AnnOptions Source #
Instances
class GHasAnnotation a where Source #
A Generic HasAnnotation
implementation
gGetAnnotation :: AnnOptions -> FollowEntrypointFlag -> GenerateFieldAnnFlag -> (Notes (GValueType a), FieldAnn) Source #
Instances
gGetAnnotationNoField :: forall a. (GHasAnnotation (Rep a), GValueType (Rep a) ~ ToT a) => FollowEntrypointFlag -> Notes (ToT a) Source #
Use this in the instance of HasAnnotation
when field annotations
should not be generated.
insertTypeAnn :: forall (b :: T). TypeAnn -> Notes b -> Notes b #