Skip to content

operacion "-" unaria real y integer probadorHaskellOCL

contexto Real1 y Integer1

en el real

<details key="invariantD7resta1" value="2.0-3.0 = -1.0"/>

genera esto

 invariant4 = context _Real1 [invariantD7resta1]
 invariantD7resta1 self = ((oclDouble 2.0) |-| (oclDouble 3.0)) |==| ((- (oclDouble 1.0)))

da error tipo de error

ACCELEO.hs:241:30: error:
    • No instance for (GHC.Num.Num (OCL Model (Val Double)))
        arising from a use of ‘invariantD7resta1’
    • In the expression: invariantD7resta1
      In the second argument of ‘context’, namely ‘[invariantD7resta1]’
      In the expression: context _Real1 [invariantD7resta1]

tiene que generar

 invariant4 = context _Real1 [invariantD7resta1]
 invariantD7resta1 self = ((oclDouble 2.0) |-| (oclDouble 3.0)) |==| ( (oclDouble (-1.0)))

en el Integer

       <details key="invariantD7resta1" value="2-3 = -1"/>

genera

       invariant14 = context _Integer1 [invariantD7resta1']
       invariantD7resta1' self = ((oclInt 2) |-| (oclInt 3)) |==| ((- (oclInt 1)))

da el error

ACCELEO.hs:272:34: error:
    • No instance for (GHC.Num.Num (OCL Model (Val Int)))
        arising from a use of ‘invariantD7resta1'’
    • In the expression: invariantD7resta1'
      In the second argument of ‘context’, namely ‘[invariantD7resta1']’
      In the expression: context _Integer1 [invariantD7resta1']

tiene que generar

 invariant14 = context _Integer1 [invariantD7resta1']
 invariantD7resta1' self = ((oclInt 2) |-| (oclInt 3)) |==| ( (oclInt (-1)))
Edited by Jose Sebastian Sanchez Costa