on ca59541 help sign in
25 lines 1.0 kB history raw
1module ProjectM36.DataTypes.Primitive where
2import ProjectM36.Base
4primitiveTypeConstructorMapping :: TypeConstructorMapping
5primitiveTypeConstructorMapping = map (\(name, aType) ->
6 (PrimitiveTypeConstructorDef name aType, [])) prims
7 where
8 prims = [("Int", IntAtomType),
9 ("Text", TextAtomType),
10 ("Double", DoubleAtomType),
11 ("Bool", BoolAtomType),
12 ("ByteString", ByteStringAtomType)
13 ]
15-- | Return the type of an 'Atom'.
16atomTypeForAtom :: Atom -> AtomType
17atomTypeForAtom (IntAtom _) = IntAtomType
18atomTypeForAtom (DoubleAtom _) = DoubleAtomType
19atomTypeForAtom (TextAtom _) = TextAtomType
20atomTypeForAtom (DayAtom _) = DayAtomType
21atomTypeForAtom (DateTimeAtom _) = DateTimeAtomType
22atomTypeForAtom (ByteStringAtom _) = ByteStringAtomType
23atomTypeForAtom (BoolAtom _) = BoolAtomType
24atomTypeForAtom (RelationAtom (Relation attrs _)) = RelationAtomType attrs
25atomTypeForAtom (ConstructedAtom _ aType _) = aType