smaoin-0.3.0.0: Utilities for the Smaoin semantic information model.

Safe HaskellNone
LanguageHaskell2010

Data.Smaoin

Synopsis

Documentation

newtype Resource Source

A Smaoin resource identifier, also known as a Uid.

A resource in Smaoin is some idea or object in the broad sense, which can be described using statements, and be related to other resources.

Constructors

Resource ByteString 

res :: String -> Resource Source

Shortcut for creating a Resource from a String. The string is simply converted into a byte sequence.

data RealNum Source

Arbitrary precision real number.

While RealNum is an instance of Num, the implementation isn't intended for general math use, and is probably much simpler than what the scientific Haskell packages provide. However, it is certainly suitable for basic manipulations.

sig :: RealNum -> Integer Source

Get the significand of a RealNum, i.e. the s in s * 10^e

expo :: RealNum -> Integer Source

Get the exponent of a RealNum, i.e. the e in s * 10^e

realnum :: Integer -> Integer -> RealNum Source

Create a RealNum. The first argument is the significand, and the second is an exponent. realnum s e represents the number s * 10^e. This representation allows to precisely encode any real number expressed in Idan (excluding rational numbers expressed as ratios).

type Rational = Ratio Integer

Arbitrary-precision rational numbers, represented as a ratio of two Integer values. A rational number may be constructed using the % operator.

data Number Source

A Smaoin number can be represented as a real number or as a ratio.

Instances

data Value Source

A Smaoin value, i.e. an entity with predefined meaning and traits. The type can be specified statically through a dedicated data constructor, or generically as a resource.

Instances

data Entity Source

A Smaoin entity. It is the atomic concept in Smaoin: Everything is an entity. An entity can be described (resource) or predefined (value).

Instances

data Statement Source

Statements can be grouped in lists and containers to form simple in-memory datastores, query results and so on.

Parameters are: Identifier, subject, predicate, object.

data PredicateSection Source

A predicate section is meant to be attached to a subject. It describes it through one or more statements. It expresses predicate-object-identifier triples. But instead of repeating predicates, it gives each predicate its own set of object-identifier pairs.

Parameters: Predicate; Objects and identifiers.

data StatementBlock Source

A statement block describes a single subject, by expressing one or more statements which share that subject. The predicate sections contain the predicates, objects and identifiers. With the subject attached, they form statements. Statement blocks can be grouped in lists and countainers to form simple in-memory datastores, query results and so on.

Parameters: 1) Subject; 2) Predicates, objects, identifiers.

Instances

generateUid :: IO Resource Source

Create a fresh new Uid. It is randomly generated, using the global random generator. Resource is a Random instance, so you can use any other random generator.