Copyright | (c) Sirui Lu 2024 |
---|---|
License | BSD-3-Clause (see the LICENSE file) |
Maintainer | siruilu@cs.washington.edu |
Stability | Experimental |
Portability | GHC only |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Synopsis
- data Identifier = Identifier {}
- identifier :: Text -> Identifier
- withMetadata :: Text -> SExpr -> Identifier
- withLocation :: Text -> SpliceQ Identifier
- mapMetadata :: (SExpr -> SExpr) -> Identifier -> Identifier
- uniqueIdentifier :: Text -> IO Identifier
- data Symbol where
- SimpleSymbol :: Identifier -> Symbol
- IndexedSymbol :: Identifier -> Int -> Symbol
- simple :: Identifier -> Symbol
- indexed :: Identifier -> Int -> Symbol
- symbolIdentifier :: Symbol -> Identifier
- mapIdentifier :: (Identifier -> Identifier) -> Symbol -> Symbol
Documentation
data Identifier Source #
Identifier type used for GenSym
The constructor is hidden intentionally. You can construct an identifier by:
- a raw identifier
The following two expressions will refer to the same identifier (the solver won't distinguish them and would assign the same value to them). The user may need to use unique names to avoid unintentional identifier collision.
>>>
identifier "a"
a
>>>
"a" :: Identifier -- available when OverloadedStrings is enabled
a
- bundle the identifier with some user provided metadata
Identifiers created with different name or different additional information will not be the same.
>>>
withMetadata "a" (NumberAtom 1)
a:1
- bundle the calling file location with the identifier to ensure global uniqueness
Identifiers created at different locations will not be the same. The identifiers created at the same location will be the same.
>>>
$$(withLocation "a") -- a sample result could be "a:[grisette-file-location <interactive> 18 (4 18)]"
a:[grisette-file-location <interactive>...]
Instances
identifier :: Text -> Identifier Source #
Simple identifier. The same identifier refers to the same symbolic variable in the whole program.
The user may need to use unique identifiers to avoid unintentional identifier collision.
withMetadata :: Text -> SExpr -> Identifier Source #
Identifier with extra metadata.
The same identifier with the same metadata refers to the same symbolic variable in the whole program.
The user may need to use unique identifiers or additional metadata to avoid unintentional identifier collision.
withLocation :: Text -> SpliceQ Identifier Source #
Identifier with the file location.
mapMetadata :: (SExpr -> SExpr) -> Identifier -> Identifier Source #
Modify the metadata of an identifier.
uniqueIdentifier :: Text -> IO Identifier Source #
Get a globally unique identifier within the IO
monad.
Symbol types for a symbolic variable.
The symbols can be indexed with an integer.
SimpleSymbol :: Identifier -> Symbol | |
IndexedSymbol :: Identifier -> Int -> Symbol |
Instances
simple :: Identifier -> Symbol Source #
Create a simple symbol.
symbolIdentifier :: Symbol -> Identifier Source #
Get the identifier of a symbol.
mapIdentifier :: (Identifier -> Identifier) -> Symbol -> Symbol Source #
Modify the identifier of a symbol.