Hoogle Search
Within Stackage Nightly 2026-06-22 (ghc-9.12.4)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
setAddr :: (Prim a, PrimMonad m) => Addr -> Int -> a -> m ()primitive-addr Data.Primitive.Addr Fill a memory block of with the given value. The length is in elements of type a rather than in bytes.
setPVar# :: (MonadPrim s m, Prim a) => PVar a s -> Int# -> m ()pvar Data.Primitive.PVar.Unsafe Fill the contents of mutable variable with byte c
setCarrier :: (b -> Either String c) -> SExprParser a b -> SExprParser a cs-cargot Data.SCargot Modify the carrier type for a SExprParser. This is used internally to convert between various SExpr representations, but could also be used externally to add an extra conversion layer onto a SExprParser.
>>> import Text.Parsec (alphaNum, many1) >>> import Data.SCargot.Repr (toRich) >>> let parser = setCarrier (return . toRich) (mkParser (many1 alphaNum)) >>> decode parser "(ele phant)" Right [RSlist [RSAtom "ele",RSAtom "phant"]]
setComment :: Comment -> SExprParser a c -> SExprParser a cs-cargot Data.SCargot Add the ability to ignore some kind of comment. This gets factored into whitespace parsing, and it's very important that the parser supplied be able to fail (as otherwise it will cause an infinite loop), and also that it not consume any input (which may require it to be wrapped in try.)
>>> import Text.Parsec (alphaNum, anyChar, manyTill, many1, string) >>> let comment = string "//" *> manyTill anyChar newline *> pure () >>> let parser = setComment comment (mkParser (many1 alphaNum)) >>> decode parser "(ele //a comment\n phant)" Right [SCons (SAtom "ele") (SCons (SAtom "phant") SNil)]
setFromCarrier :: (c -> b) -> SExprPrinter a b -> SExprPrinter a cs-cargot Data.SCargot Modify the carrier type of a SExprPrinter by describing how to convert the new type back to the previous type. For example, to pretty-print a well-formed s-expression, we can modify the SExprPrinter value as follows:
>>> let printer = setFromCarrier fromWellFormed (basicPrint id) >>> encodeOne printer (WFSList [WFSAtom "ele", WFSAtom "phant"]) "(ele phant)"
setIndentAmount :: Int -> SExprPrinter atom carrier -> SExprPrinter atom carriers-cargot Data.SCargot Set the number of spaces that a subsequent line will be indented after a swing indentation.
>>> let printer = setMaxWidth 12 (basicPrint id) >>> encodeOne printer (L [A "elephant", A "pachyderm"]) "(elephant \n pachyderm)" >>> encodeOne (setIndentAmount 4) (L [A "elephant", A "pachyderm"]) "(elephant \n pachyderm)"
-
s-cargot Data.SCargot Dictate how to indent subsequent lines based on the leading subexpression in an s-expression. For details on how this works, consult the documentation of the Indent type.
>>> let indent (A "def") = SwingAfter 1; indent _ = Swing >>> let printer = setIndentStrategy indent (setMaxWidth 8 (basicPrint id)) >>> encodeOne printer (L [ A "def", L [ A "func", A "arg" ], A "body" ]) "(def (func arg)\n body)" >>> encodeOne printer (L [ A "elephant", A "among", A "pachyderms" ]) "(elephant \n among\n pachyderms)"
setMaxWidth :: Int -> SExprPrinter atom carrier -> SExprPrinter atom carriers-cargot Data.SCargot Dictate a maximum width for pretty-printed s-expressions.
>>> let printer = setMaxWidth 8 (basicPrint id) >>> encodeOne printer (L [A "one", A "two", A "three"]) "(one \n two\n three)"
setCarrier :: (b -> Either String c) -> SExprParser a b -> SExprParser a cs-cargot Data.SCargot.Parse Modify the carrier type for a SExprParser. This is used internally to convert between various SExpr representations, but could also be used externally to add an extra conversion layer onto a SExprParser.
>>> import Text.Parsec (alphaNum, many1) >>> import Data.SCargot.Repr (toRich) >>> let parser = setCarrier (return . toRich) (mkParser (many1 alphaNum)) >>> decode parser "(ele phant)" Right [RSlist [RSAtom "ele",RSAtom "phant"]]
setComment :: Comment -> SExprParser a c -> SExprParser a cs-cargot Data.SCargot.Parse Add the ability to ignore some kind of comment. This gets factored into whitespace parsing, and it's very important that the parser supplied be able to fail (as otherwise it will cause an infinite loop), and also that it not consume any input (which may require it to be wrapped in try.)
>>> import Text.Parsec (alphaNum, anyChar, manyTill, many1, string) >>> let comment = string "//" *> manyTill anyChar newline *> pure () >>> let parser = setComment comment (mkParser (many1 alphaNum)) >>> decode parser "(ele //a comment\n phant)" Right [SCons (SAtom "ele") (SCons (SAtom "phant") SNil)]