mirror of
https://github.com/macocianradu/RosettaHaskellCompiler.git
synced 2026-03-18 21:10:07 +00:00
Working generation, need to add list functions
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
module Model.Enum where
|
||||
import Model.Type
|
||||
|
||||
-- |The representation of a Rosetta enum data type
|
||||
data EnumType = MakeEnum {
|
||||
@@ -12,4 +13,11 @@ data EnumValue = MakeEnumValue {
|
||||
enumValueName :: String,
|
||||
enumValueDescription :: Maybe String,
|
||||
enumValueDisplayName :: Maybe String
|
||||
} deriving (Show, Eq)
|
||||
} deriving (Show, Eq)
|
||||
|
||||
convertEnumToType :: EnumType -> Type
|
||||
convertEnumToType (MakeEnum name desc val) = MakeType name (BasicType "Object") desc (map (convertValueToAttribute typ) val) [MakeCondition Nothing (Keyword "one-of")]
|
||||
where typ = MakeType name (BasicType "Object") desc [] [MakeCondition Nothing (Keyword "one-of")]
|
||||
|
||||
convertValueToAttribute :: Type -> EnumValue -> TypeAttribute
|
||||
convertValueToAttribute typ (MakeEnumValue name desc _) = MakeTypeAttribute name typ (Bounds (0, 1)) Nothing
|
||||
Reference in New Issue
Block a user