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 where
- Identifier :: Text -> Identifier
- IdentifierWithInfo :: (Typeable a, Ord a, Lift a, NFData a, Show a, Hashable a) => Identifier -> a -> Identifier
- identifier :: Text -> Identifier
- withInfo :: (Typeable a, Ord a, Lift a, NFData a, Show a, Hashable a) => Identifier -> a -> Identifier
- withLoc :: Identifier -> SpliceQ Identifier
- data Symbol where
- SimpleSymbol :: Identifier -> Symbol
- IndexedSymbol :: Identifier -> Int -> Symbol
- simple :: Identifier -> Symbol
- indexed :: Identifier -> Int -> Symbol
Documentation
data Identifier where 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 information
Identifiers created with different name or different additional information will not be the same.
>>>
withInfo "a" (1 :: Int)
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.
>>>
$$(withLoc "a") -- a sample result could be "a:<interactive>:18:4-18"
a:<interactive>:...
Identifier :: Text -> Identifier | |
IdentifierWithInfo :: (Typeable a, Ord a, Lift a, NFData a, Show a, Hashable a) => Identifier -> a -> 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.
withInfo :: (Typeable a, Ord a, Lift a, NFData a, Show a, Hashable a) => Identifier -> a -> Identifier Source #
Identifier with extra information.
The same identifier with the same information refers to the same symbolic variable in the whole program.
The user may need to use unique identifiers or additional information to avoid unintentional identifier collision.
withLoc :: Identifier -> SpliceQ Identifier Source #
Identifier with the current location as extra information.
>>>
$$(withLoc "a") -- a sample result could be "a:<interactive>:18:4-18"
a:<interactive>:...
The uniqueness is ensured for the call to identifier
at different location.
Symbol types for a symbolic variable.
The symbols can be indexed with an integer.
SimpleSymbol :: Identifier -> Symbol | |
IndexedSymbol :: Identifier -> Int -> Symbol |
Instances
IsString Symbol Source # | |
Defined in Grisette.Internal.Core.Data.Symbol fromString :: String -> Symbol # | |
Generic Symbol Source # | |
Show Symbol Source # | |
NFData Symbol Source # | |
Defined in Grisette.Internal.Core.Data.Symbol | |
Eq Symbol Source # | |
Ord 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.5.0.1-IKpKourvCOdG0l1QW5fLHa" '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.