Copyright | © Thor Michael Støre, 2015 |
---|---|
License | GPL v2 without "any later version" clause |
Maintainer | thormichael át gmail døt com |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
Relation variable definition, along with IO level support functions.
- data Relvar a = Relvar {}
- relvarType :: Relvar a -> Relation a
- readRel :: forall b. (Ord (HList b), Read (HList (RecordValuesR b)), RecordValues b, HMapAux HList TaggedFn (RecordValuesR b) b) => String -> Relation b
- readRelvar :: (Ord (HList b), Read (HList (RecordValuesR b)), RecordValues b, HMapAux HList TaggedFn (RecordValuesR b) b) => Relvar b -> IO (Relation b)
- hListsToRel :: (Ord (HList b), RecordValues b, HMapAux HList TaggedFn (RecordValuesR b) b) => [HList (RecordValuesR b)] -> Relation b
- writeRelvarBody :: Show r => FilePath -> r -> IO ()
- writeRelvarBody' :: Show r => Relvar rv -> r -> IO ()
- showRelStr :: (Show (HList (RecordValuesR r)), RecordValues r) => Relation r -> String
Relation variable definitions
Relation variable reference. This type has a phantom type variable, which generally calls for the type to be explicity specified:
s = Relvar "SuppliersPartsDB/S.rv" :: Relvar '[SNO, SName, Status, City]
Typeable [*] a => Show (Relvar a) Source | |
(Ord (HList b), Read (HList (RecordValuesR b)), Typeable [*] b, RecordValues b, HMapAux HList TaggedFn (RecordValuesR b) b, HFoldr (Mapcar HPresentTypedRecAttr) [[String]] (RecordValuesR b) [[String]], HFoldr (Mapcar HPresentRecAttr) [[String]] (RecordValuesR b) [[String]]) => HFWPresent (Relvar b) Source | |
(Ord (HList b), Read (HList (RecordValuesR b)), RecordValues b, HMapAux HList TaggedFn (RecordValuesR b) b) => RelAssign (Relvar b) Source | |
(Ord (HList b), Read (HList (RecordValuesR b)), RecordValues b, HMapAux HList TaggedFn (RecordValuesR b) b) => MonOp (Relvar b) Source | |
(Ord (HList b), Read (HList (RecordValuesR b)), RecordValues b, HMapAux HList TaggedFn (RecordValuesR b) b) => DyaOp (IO (Relation a)) (Relvar b) Source | |
(Ord (HList b), Read (HList (RecordValuesR b)), RecordValues b, HMapAux HList TaggedFn (RecordValuesR b) b) => DyaOp (Relation a) (Relvar b) Source | |
(Ord (HList a), Ord (HList b), Read (HList (RecordValuesR a)), Read (HList (RecordValuesR b)), RecordValues a, RecordValues b, HMapAux HList TaggedFn (RecordValuesR a) a, HMapAux HList TaggedFn (RecordValuesR b) b) => DyaOp (Relvar a) (Relvar b) Source | |
(Ord (HList a), Read (HList (RecordValuesR a)), RecordValues a, HMapAux HList TaggedFn (RecordValuesR a) a) => DyaOp (Relvar a) (IO (Relation b)) Source | |
(Ord (HList a), Read (HList (RecordValuesR a)), RecordValues a, HMapAux HList TaggedFn (RecordValuesR a) a) => DyaOp (Relvar a) (Relation b) Source | |
type RelAssignArg (Relvar b) = Relation b Source | |
type DyaOpLeft (Relvar a) = Relation a Source | |
type DyaOpLeft (Relvar a) = Relation a Source | |
type DyaOpLeft (Relvar a) = Relation a Source | |
type DyaOpRight (Relvar b) = Relation b Source | |
type DyaOpRight (Relvar b) = Relation b Source | |
type DyaOpRight (Relvar b) = Relation b Source | |
type MonOpArg (Relvar b) = Relation b Source | |
type MonOpRes (Relvar b) res = IO res | |
type DyaOpRes (IO (Relation a)) (Relvar b) res = IO res | |
type DyaOpRes (Relation a) (Relvar b) res = IO res | |
type DyaOpRes (Relvar a) (Relvar b) res = IO res | |
type DyaOpRes (Relvar a) (IO (Relation b)) res = IO res | |
type DyaOpRes (Relvar a) (Relation b) res = IO res |
relvarType :: Relvar a -> Relation a Source
Gives the type a relvar results in. Note that the value this results in
will always be undefined
.
Relational input
readRel :: forall b. (Ord (HList b), Read (HList (RecordValuesR b)), RecordValues b, HMapAux HList TaggedFn (RecordValuesR b) b) => String -> Relation b Source
Reads a relation value from a string containing HLists of unpacked attribues.
>>>
pt$ ( readRel "H[\"S1\",10],H[\"S2\",50]" :: Relation '[SNO,Status])
┌───────────────┬───────────────────┐ │ sno :: String │ status :: Integer │ ╞═══════════════╪═══════════════════╡ │ S1 │ 10 │ │ S2 │ 50 │ └───────────────┴───────────────────┘
readRelvar :: (Ord (HList b), Read (HList (RecordValuesR b)), RecordValues b, HMapAux HList TaggedFn (RecordValuesR b) b) => Relvar b -> IO (Relation b) Source
Read a relation variable from the file referenced by the first argument
hListsToRel :: (Ord (HList b), RecordValues b, HMapAux HList TaggedFn (RecordValuesR b) b) => [HList (RecordValuesR b)] -> Relation b Source
Converts a list of HLists into a relation value.
Relational output
writeRelvarBody :: Show r => FilePath -> r -> IO () Source
Writes a body of a relvar to a given file
writeRelvarBody' :: Show r => Relvar rv -> r -> IO () Source
Writes a body of a relvar to a given relvar file reference
showRelStr :: (Show (HList (RecordValuesR r)), RecordValues r) => Relation r -> String Source
Prints a relation as a list without the outer brackets.