Skip to content

We might want to have functions polymorphic over sensitivities #227

Description

@MxmUrw

The following example cannot be checked because the function f is not polymorphic over the constant value of the argument y.

julia> typecheck_hs_from_string("module mod
       function create_query(b,query)
              m -> query(m, b) - query(m, b+1)
             end
             function foo(bb)
                function f(x,y)
                  a = internal_expect_const(y)
                  3 + a
                end
                create_query(internal_expect_const(bb),f)
             end
             end
             ")
======================== Errors =====================
Error:
Could not unify 's_15' with '1 + s_15'.
  The constraint constr_49 : IsEqual (s_15,1 + s_15)
  could not be solved:
  ---------------------------------------------------------
  Inherited from the constraint:
     IsLessEqual (s_15 ©,1 + s_15 ©)
  Inherited from the constraint:
     IsLessEqual (τ_44[s_15 ©],τ_30[1 + s_15 ©])
  Inherited from the constraint:
     IsLessEqual (Num(τ_44[s_15 ©]),Num(τ_30[1 + s_15 ©]))
  Inherited from the constraint:
     IsSupremum (NoFun(Num(τ_44[s_15 ©])),NoFun(Num(τ_44[1 + s_15 ©]))) :=: NoFun(Num(τ_30[1 + s_15 ©]))
  Inherited from the constraint:
     IsChoice (fromList [([Any,Any],(([τ_21 @ ∑∅,NoFun(Num(τ_30[1 + s_15 ©])) @ ∑∅] -> NoFun(Num(τ_30[4.0 + s_15 ©]))),[]))],[([τ_8 @ ∑∅,NoFun(Num(τ_44[1 + s_15 ©])) @ ∑∅] -> NoFun(Num(τ_30[4.0 + s_15 ©]))),([τ_4 @ ∑∅,NoFun(Num(τ_44[s_15 ©])) @ ∑∅] -> NoFun(Num(τ_30[4.0 + s_15 ©])))])
  Inherited from the constraint:
     IsFunctionArgument (Fun([([τ_21 @ ∑∅,NoFun(Num(τ_30[1 + s_15 ©])) @ ∑∅] -> NoFun(Num(τ_30[4.0 + s_15 ©]))) @ Just [Any,Any]]),Fun([([τ_8 @ ∑∅,NoFun(Num(τ_44[1 + s_15 ©])) @ ∑∅] -> NoFun(Num(τ_30[4.0 + s_15 ©]))) @ Nothing,([τ_4 @ ∑∅,NoFun(Num(τ_44[s_15 ©])) @ ∑∅] -> NoFun(Num(τ_30[4.0 + s_15 ©]))) @ Nothing]))
  Inherited from the constraint:
     IsChoice (fromList [([Any,Any],(([NoFun(Num(τ_44[s_15 ©])) @ ∑∅,Fun([([τ_8 @ ∑∅,NoFun(Num(τ_44[1 + s_15 ©])) @ ∑∅] -> NoFun(Num(τ_30[4.0 + s_15 ©]))) @ Nothing,([τ_4 @ ∑∅,NoFun(Num(τ_44[s_15 ©])) @ ∑∅] -> NoFun(Num(τ_30[4.0 + s_15 ©]))) @ Nothing]) @ ∑∅] -> Fun([([(τ_8∧τ_4) @ ∑∅] -> NoFun(Num(τ_31[(4.0 + s_15 - 4.0 + s_15) ©]))) @ Just [Any]])),[]))],[([NoFun(Num(τ_44[s_15 ©])) @ ∑∅,Fun([([τ_21 @ ∑∅,NoFun(Num(τ_30[1 + s_15 ©])) @ ∑∅] -> NoFun(Num(τ_30[4.0 + s_15 ©]))) @ Just [Any,Any]]) @ ∑∅] -> τ_22)])
  Inherited from the constraint:
     IsFunctionArgument (Fun([([NoFun(Num(τ_44[s_15 ©])) @ ∑∅,Fun([([τ_8 @ ∑∅,NoFun(Num(τ_44[1 + s_15 ©])) @ ∑∅] -> NoFun(Num(τ_30[4.0 + s_15 ©]))) @ Nothing,([τ_4 @ ∑∅,NoFun(Num(τ_44[s_15 ©])) @ ∑∅] -> NoFun(Num(τ_30[4.0 + s_15 ©]))) @ Nothing]) @ ∑∅] -> Fun([([(τ_8∧τ_4) @ ∑∅] -> NoFun(Num(τ_31[(4.0 + s_15 - 4.0 + s_15) ©]))) @ Just [Any]])) @ Just [Any,Any]]),Fun([([NoFun(Num(τ_44[s_15 ©])) @ ∑∅,Fun([([τ_21 @ ∑∅,NoFun(Num(τ_30[1 + s_15 ©])) @ ∑∅] -> NoFun(Num(τ_30[4.0 + s_15 ©]))) @ Just [Any,Any]]) @ ∑∅] -> τ_22) @ Nothing]))
  In none: line 10
  The function  create_query is applied to [InternalExpectConst gen_bb_uls_3, f]
  ---------------------------------------------------------

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions