Safe Haskell | None |
---|---|
Language | Haskell2010 |
Clingo.Symbol
Contents
Description
Functions for handling symbols and signatures with clingo.
- data Clingo s a
- data ClingoWarning
- warningString :: MonadIO m => ClingoWarning -> m Text
- data Symbol s
- data Location
- class Signed a where
- newtype SymbolType = SymbolType SymbolType
- symbolType :: Symbol s -> SymbolType
- pattern SymInfimum :: SymbolType
- pattern SymNumber :: SymbolType
- pattern SymString :: SymbolType
- pattern SymFunction :: SymbolType
- pattern SymSupremum :: SymbolType
- data FunctionSymbol s
- functionSymbol :: Symbol s -> Maybe (FunctionSymbol s)
- data Signature s
- parseTerm :: Text -> Maybe (ClingoWarning -> Text -> IO ()) -> Natural -> Clingo s (Symbol s)
- signatureArity :: Signature s -> Natural
- signatureHash :: Signature s -> Integer
- signatureName :: Signature s -> Text
- class MonadSymbol m where
- createId :: MonadSymbol m => Text -> Bool -> m s (Symbol s)
- symbolArguments :: Symbol s -> [Symbol s]
- symbolGetArg :: Symbol s -> Int -> Maybe (Symbol s)
- symbolHash :: Symbol s -> Integer
- symbolName :: Symbol s -> Maybe Text
- symbolNumber :: Symbol s -> Maybe Integer
- symbolString :: Symbol s -> Maybe Text
- prettySymbol :: Symbol s -> Text
- data PureSymbol
- unpureSymbol :: (Monad (m s), MonadSymbol m) => PureSymbol -> m s (Symbol s)
- toPureSymbol :: Symbol s -> PureSymbol
- data PureSignature = PureSignature Text Natural Bool
- unpureSignature :: MonadSymbol m => PureSignature -> m s (Signature s)
- toPureSignature :: Signature s -> PureSignature
Documentation
The Clingo
monad provides a base monad for computations utilizing the
clingo answer set solver. It uses an additional type parameter to ensure that
values that are managed by the solver can not leave scope.
Instances
MonadSymbol Clingo Source # | |
MonadModel Clingo Source # | |
MonadSolve Clingo Source # | |
Monad (Clingo s) Source # | |
Functor (Clingo s) Source # | |
MonadFix (Clingo s) Source # | |
Applicative (Clingo s) Source # | |
MonadIO (Clingo s) Source # | |
Alternative (Clingo s) Source # | |
MonadPlus (Clingo s) Source # | |
MonadThrow (Clingo s) Source # | |
MonadCatch (Clingo s) Source # | |
MonadMask (Clingo s) Source # | |
data ClingoWarning Source #
Instances
warningString :: MonadIO m => ClingoWarning -> m Text Source #
Symbol types
symbolType :: Symbol s -> SymbolType Source #
Get the type of a symbol
pattern SymInfimum :: SymbolType Source #
pattern SymNumber :: SymbolType Source #
pattern SymString :: SymbolType Source #
pattern SymFunction :: SymbolType Source #
pattern SymSupremum :: SymbolType Source #
Function symbols
data FunctionSymbol s Source #
Instances
Eq (FunctionSymbol s) Source # | |
Ord (FunctionSymbol s) Source # | |
Signed (FunctionSymbol s) Source # | |
functionSymbol :: Symbol s -> Maybe (FunctionSymbol s) Source #
Obtain a FunctionSymbol
if possible.
Signature parsing/inspection
Arguments
:: Text | Term as |
-> Maybe (ClingoWarning -> Text -> IO ()) | Logger callback |
-> Natural | Callback limit |
-> Clingo s (Symbol s) |
Parse a term in string form. This does not return an AST Term!
signatureArity :: Signature s -> Natural Source #
Get the arity of a signature.
signatureHash :: Signature s -> Integer Source #
Hash a signature.
signatureName :: Signature s -> Text Source #
Get the name of a signature.
Symbol and signature creation
class MonadSymbol m where Source #
Minimal complete definition
createSignature, createNumber, createSupremum, createInfimum, createString, createFunction
Methods
createSignature :: Text -> Natural -> Bool -> m s (Signature s) Source #
Create a new signature with the solver, taking a name, an arity and a bool determining the sign.
createNumber :: Integral a => a -> m s (Symbol s) Source #
Create a number symbol.
createSupremum :: m s (Symbol s) Source #
Create a supremum symbol, #sup
.
createInfimum :: m s (Symbol s) Source #
Create a infimum symbol, #inf
.
createString :: Text -> m s (Symbol s) Source #
Construct a symbol representing a string.
createFunction :: Text -> [Symbol s] -> Bool -> m s (Symbol s) Source #
Construct a symbol representing a function or tuple from a name, arguments, and whether the sign is positive.
Instances
MonadSymbol Clingo Source # | |
MonadSymbol IOSym Source # | |
MonadSymbol (Propagation phase) Source # | |
createId :: MonadSymbol m => Text -> Bool -> m s (Symbol s) Source #
Construct a symbol representing an id.
Symbol inspection
symbolArguments :: Symbol s -> [Symbol s] Source #
Obtain the arguments of a symbol. May be empty.
symbolHash :: Symbol s -> Integer Source #
Hash a symbol
symbolNumber :: Symbol s -> Maybe Integer Source #
Obtain number from symbol. Will fail for invalid symbol types.
Pure types
data PureSymbol Source #
PureSymbol
represents a completely pure Haskell alternative to the
handled Symbol
type of the clingo library.
Constructors
PureInfimum | |
PureSupremum | |
PureNumber Integer | |
PureFunction Text [PureSymbol] Bool | |
PureString Text |
Instances
unpureSymbol :: (Monad (m s), MonadSymbol m) => PureSymbol -> m s (Symbol s) Source #
Create a Symbol
in the solver from a PureSymbol
toPureSymbol :: Symbol s -> PureSymbol Source #
data PureSignature Source #
PureSignature
represents a completely pure Haskell alternative to the
handled Signature
type of the clingo library.
Constructors
PureSignature Text Natural Bool |
Instances
unpureSignature :: MonadSymbol m => PureSignature -> m s (Signature s) Source #
Create a Signature
in the solver from a PureSignature
toPureSignature :: Signature s -> PureSignature Source #