Safe Haskell | None |
---|---|
Language | GHC2021 |
Codec.CBOR.Cuddle.Comments
Synopsis
- class HasComment a where
- class CollectComments a where
- collectComments :: a -> [Comment]
- hasComment :: HasComment a => a -> Bool
- (//-) :: HasComment a => a -> Comment -> a
- (<*!) :: (HasComment a, Applicative m) => m a -> m Comment -> m a
- (!*>) :: (HasComment a, Applicative m) => m Comment -> m a -> m a
- data WithComment a = WithComment {
- unWithComment :: Comment
- stripComment :: a
- (!$>) :: (HasComment b, Functor f) => (a -> b) -> f (WithComment a) -> f b
- newtype Comment = Comment Text
- unComment :: Comment -> [Text]
- withComment :: a -> WithComment a
Documentation
class HasComment a where Source #
Instances
HasComment Group Source # | |
HasComment GroupEntry Source # | |
Defined in Codec.CBOR.Cuddle.CDDL | |
HasComment GrpChoice Source # | |
HasComment Name Source # | |
HasComment Rule Source # | |
HasComment Type0 Source # | |
HasComment Type1 Source # | |
HasComment Comment Source # | |
HasComment Literal Source # | |
HasComment a => HasComment (NonEmpty a) Source # | |
HasComment (WithComment a) Source # | |
Defined in Codec.CBOR.Cuddle.Comments |
class CollectComments a where Source #
Minimal complete definition
Nothing
Methods
collectComments :: a -> [Comment] Source #
Instances
hasComment :: HasComment a => a -> Bool Source #
(//-) :: HasComment a => a -> Comment -> a infixr 0 Source #
This operator is used to attach comments to terms. It will not overwrite any comments that are already present, but will add the new comments on a new line ``` arr [0, 1] //- "This is an array with two values" ```
(<*!) :: (HasComment a, Applicative m) => m a -> m Comment -> m a Source #
This operator will parse the values from left to right and then append the parsed comment on the right to the parsed value on the left.
(!*>) :: (HasComment a, Applicative m) => m Comment -> m a -> m a Source #
This operator will parse the values from left to right and then append the parsed comment on the left to the parsed value on the right.
data WithComment a Source #
Constructors
WithComment | |
Fields
|
Instances
Applicative WithComment Source # | |
Defined in Codec.CBOR.Cuddle.Comments Methods pure :: a -> WithComment a # (<*>) :: WithComment (a -> b) -> WithComment a -> WithComment b # liftA2 :: (a -> b -> c) -> WithComment a -> WithComment b -> WithComment c # (*>) :: WithComment a -> WithComment b -> WithComment b # (<*) :: WithComment a -> WithComment b -> WithComment a # | |
Functor WithComment Source # | |
Defined in Codec.CBOR.Cuddle.Comments Methods fmap :: (a -> b) -> WithComment a -> WithComment b # (<$) :: a -> WithComment b -> WithComment a # | |
Monad WithComment Source # | |
Defined in Codec.CBOR.Cuddle.Comments Methods (>>=) :: WithComment a -> (a -> WithComment b) -> WithComment b # (>>) :: WithComment a -> WithComment b -> WithComment b # return :: a -> WithComment a # | |
CollectComments a => CollectComments (WithComment a) Source # | |
Defined in Codec.CBOR.Cuddle.Comments Methods collectComments :: WithComment a -> [Comment] Source # | |
HasComment (WithComment a) Source # | |
Defined in Codec.CBOR.Cuddle.Comments |
(!$>) :: (HasComment b, Functor f) => (a -> b) -> f (WithComment a) -> f b Source #
This operator maps a function over a functor containing a WithComment
and
applies the comment within to the output of the applied function.
```
(x -> LInt x "a") !$> WithComment "b" (1 :: Integer) == Literal (LInt 1) "anb"
```
Instances
IsString Comment Source # | |||||
Defined in Codec.CBOR.Cuddle.Comments Methods fromString :: String -> Comment # | |||||
Monoid Comment Source # | |||||
Semigroup Comment Source # | |||||
Generic Comment Source # | |||||
Defined in Codec.CBOR.Cuddle.Comments Associated Types
| |||||
Show Comment Source # | |||||
CollectComments Comment Source # | |||||
Defined in Codec.CBOR.Cuddle.Comments Methods collectComments :: Comment -> [Comment] Source # | |||||
HasComment Comment Source # | |||||
Default Comment Source # | |||||
Defined in Codec.CBOR.Cuddle.Comments | |||||
Eq Comment Source # | |||||
Ord Comment Source # | |||||
Defined in Codec.CBOR.Cuddle.Comments | |||||
Hashable Comment Source # | |||||
Defined in Codec.CBOR.Cuddle.Comments | |||||
Pretty Comment Source # | |||||
Defined in Codec.CBOR.Cuddle.Pretty | |||||
ToExpr Comment Source # | |||||
Defined in Codec.CBOR.Cuddle.Comments | |||||
type Rep Comment Source # | |||||
Defined in Codec.CBOR.Cuddle.Comments |
withComment :: a -> WithComment a Source #