HORIZON HASKELLDocslts/ghc-9.14.xd82dee82026-10-12Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · d82dee8 · 2026-10-12

Modulecuddle-1.8.1.0GHC2021

Codec.CBOR.Cuddle.Comments

  • 2 types
  • 2 classes
  • 10 values
  • Packagecuddle-1.8.1.0
  • Exports14
  • LanguageGHC2021
  • LicenceApache-2.0
  • SourceComments.hs
classclass HasComment a where
#

Methods

Instances20HasComment, …
classclass CollectComments a where
#

Methods

Instances35CollectComments, …
value(//-) :: HasComment a => a -> Comment -> a
#

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" ```

valueappendComment :: HasComment a => a -> Comment -> a
#

Raw comment append without adding space or newline. Used by parser combinators where the comment text is already formatted.

value(<*!) :: (HasComment a, Applicative m) => m a -> m Comment -> m a
#

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.

value(!*>) :: (HasComment a, Applicative m) => m Comment -> m a -> m a
#

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.

datadata WithComment a
#
Instances5Monad, Functor, Applicative, CollectComments, HasComment
value(!$>) :: (HasComment b, Functor f) => (a -> b) -> f (WithComment a) -> f b
#

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" ```

newtypenewtype Comment
#
Instances13Eq, Ord, Show, IsString, Generic, Semigroup, …
valuecommentLine :: Text -> Comment
#

Wrap a single line of text (possibly empty) as a one-line comment. Unlike toComment, this does not split on newlines and preserves an empty input as a single empty comment line.