input-output-hk/cuddle

Can't apply control operators to values that the rfc considers valid

Opened this issue · 1 comments

Because of this code:

    (CtlOp.Lt, CTree.Literal (VUInt n)) -> case tt of
      CTree.Postlude PTUInt -> S . TInteger <$> genUniformRM (0, fromIntegral n - 1)
      _ -> error "Cannot apply lt operator to target"

We can only apply rules like uint .lt 2. It forbids the following cases:

rule1 = nint .lt 2
rule2 = int .lt 2
rule3 = 1..5 .lt 2
rule4 = 1 .lt 2
rule5 = ((1..3) / (1..5)) .lt 2

All these cases are accepted by the cddl tool. The same seems to happen with most of the other control operators.

nc6 commented

Yeah, control operators have been added on an "as needed" basis