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 | None |
Language | Haskell2010 |
Grisette.Internal.Core.Data.Symbol
Description
Synopsis
- data Identifier = Identifier {}
- identifier :: Text -> Identifier
- withMetadata :: AsMetadata a => Text -> a -> Identifier
- withLocation :: Text -> SpliceQ Identifier
- mapMetadata :: AsMetadata a => (SExpr -> a) -> 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
- class AsMetadata a where
- asMetadata :: a -> SExpr
- fromMetadata :: SExpr -> Maybe a
- pattern Metadata :: AsMetadata a => a -> SExpr
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>...]
Constructors
Identifier | |
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 :: AsMetadata a => Text -> a -> 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 :: AsMetadata a => (SExpr -> a) -> 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.
Constructors
SimpleSymbol :: Identifier -> Symbol | |
IndexedSymbol :: Identifier -> Int -> Symbol |
Instances
Binary Symbol Source # | |||||
Serial Symbol Source # | |||||
Defined in Grisette.Internal.Core.Data.Symbol | |||||
Serialize Symbol Source # | |||||
NFData Symbol Source # | |||||
Defined in Grisette.Internal.Core.Data.Symbol | |||||
IsString Symbol Source # | |||||
Defined in Grisette.Internal.Core.Data.Symbol Methods fromString :: String -> Symbol # | |||||
Generic Symbol Source # | |||||
Defined in Grisette.Internal.Core.Data.Symbol Associated Types
| |||||
Show Symbol Source # | |||||
Eq Symbol Source # | |||||
Ord Symbol Source # | |||||
PPrint Symbol Source # | |||||
Hashable Symbol Source # | |||||
Defined in Grisette.Internal.Core.Data.Symbol | |||||
Lift Symbol Source # | |||||
type Rep Symbol Source # | |||||
Defined in Grisette.Internal.Core.Data.Symbol type Rep Symbol = D1 ('MetaData "Symbol" "Grisette.Internal.Core.Data.Symbol" "grisette-0.11.0.0-HndeEPlDvvDHSETLw6O8c" 'False) (C1 ('MetaCons "SimpleSymbol" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Identifier)) :+: C1 ('MetaCons "IndexedSymbol" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Identifier) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int))) |
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.
class AsMetadata a where Source #
A type class for embedding a type into a metadata represented as an S-expression.
Instances
AsMetadata SExpr Source # | |
Defined in Grisette.Internal.Core.Data.Symbol |
pattern Metadata :: AsMetadata a => a -> SExpr Source #
A pattern for extracting a value from a metadata represented as an S-expression.