Copyright | (c) Sirui Lu 2021-2023 |
---|---|
License | BSD-3-Clause (see the LICENSE file) |
Maintainer | siruilu@cs.washington.edu |
Stability | Experimental |
Portability | GHC only |
Safe Haskell | Trustworthy |
Language | Haskell2010 |
Symbolic constant generation with location
data FileLocation Source #
Instances
nameWithLoc :: String -> SpliceQ FreshIdent Source #
Identifier with the current location as extra information.
>>>
$$(nameWithLoc "a") -- a sample result could be "a:<interactive>:18:4-18"
a:<interactive>:...
The uniqueness is ensured for the call to nameWithLoc
at different location.
slocsym :: Solvable c s => String -> SpliceQ s Source #
Generate simply-named symbolic variables. The file location will be attached to the identifier.
>>>
$$(slocsym "a") :: SymBool
a:<interactive>:...
Calling slocsymb
with the same name at different location will always
generate different symbolic constants. Calling slocsymb
at the same
location for multiple times will generate the same symbolic constants.
>>>
($$(slocsym "a") :: SymBool) == $$(slocsym "a")
False>>>
let f _ = $$(slocsym "a") :: SymBool
>>>
f () == f ()
True
ilocsym :: Solvable c s => String -> Int -> SpliceQ s Source #
Generate indexed symbolic variables. The file location will be attached to identifier.
>>>
$$(ilocsym "a" 1) :: SymBool
a@1:<interactive>:...
Calling ilocsymb
with the same name and index at different location will
always generate different symbolic constants. Calling slocsymb
at the same
location for multiple times will generate the same symbolic constants.