mirror of
https://github.com/macocianradu/RosettaHaskellCompiler.git
synced 2026-03-18 13:00:08 +00:00
fixed functions without input
This commit is contained in:
@@ -63,3 +63,45 @@ type Contract_Get:
|
|||||||
contract Contract (1..1)
|
contract Contract (1..1)
|
||||||
type Contract_Anytime:
|
type Contract_Anytime:
|
||||||
contract Contract (1..1)
|
contract Contract (1..1)
|
||||||
|
|
||||||
|
func MkZero:
|
||||||
|
output:
|
||||||
|
contract Contract (1..1)
|
||||||
|
assign-output contract -> zero -> unit:
|
||||||
|
1 // create the zero contract dummy value
|
||||||
|
|
||||||
|
func MkExpired:
|
||||||
|
output:
|
||||||
|
contract Contract (1..1)
|
||||||
|
assign-output contract -> expired -> unit:
|
||||||
|
1 // create the expired contract dummy value
|
||||||
|
|
||||||
|
func MkOne:
|
||||||
|
inputs:
|
||||||
|
currency UnitType (1..1)
|
||||||
|
output:
|
||||||
|
contract Contract (1..1)
|
||||||
|
assign-output contract -> one -> currency:
|
||||||
|
currency
|
||||||
|
|
||||||
|
func MkOr:
|
||||||
|
inputs:
|
||||||
|
left Contract (1..1)
|
||||||
|
right Contract (1..1)
|
||||||
|
output:
|
||||||
|
contract Contract (1..1)
|
||||||
|
assign-output contract -> orContract -> left:
|
||||||
|
left
|
||||||
|
assign-output contract -> orContract -> right:
|
||||||
|
right
|
||||||
|
|
||||||
|
func MkBoth:
|
||||||
|
inputs:
|
||||||
|
left Contract (1..1)
|
||||||
|
right Contract (1..1)
|
||||||
|
output:
|
||||||
|
contract Contract (1..1)
|
||||||
|
assign-output contract -> both -> left:
|
||||||
|
left
|
||||||
|
assign-output contract -> both -> right:
|
||||||
|
right
|
||||||
@@ -37,8 +37,10 @@ assignmentParser =
|
|||||||
inputAttributesParser :: Parser [TypeAttribute]
|
inputAttributesParser :: Parser [TypeAttribute]
|
||||||
inputAttributesParser =
|
inputAttributesParser =
|
||||||
do
|
do
|
||||||
_ <- lexeme $ string "inputs:"
|
inp <- observing $ lexeme $ string "inputs:"
|
||||||
many $ try attributeParser
|
case inp of
|
||||||
|
Left _ -> return []
|
||||||
|
Right _ -> many $ try attributeParser
|
||||||
|
|
||||||
-- |Parses the output attribute of a function statement in Rosetta into a TypeAttribute
|
-- |Parses the output attribute of a function statement in Rosetta into a TypeAttribute
|
||||||
outputAttributeParser :: Parser TypeAttribute
|
outputAttributeParser :: Parser TypeAttribute
|
||||||
|
|||||||
Reference in New Issue
Block a user