Skip to main content
Log in

Graphical and incremental type inference. A graph transformation approach

  • Published:
Higher-Order and Symbolic Computation

Abstract

We present a graph grammar based type inference system for a totally graphic development language. NiMo (Nets in Motion) can be seen as a graphic equivalent to Haskell that acts as an on-line tracer and debugger. Programs are process networks that evolve giving total visibility of the execution state, and can be interactively completed, changed or stored at any step. In such a context, type inference must be incremental. During the net construction or modification only type safe connections are allowed. The user visualizes the type information evolution and, in case of conflict, can easily identify the causes. Though based on the same ideas, the type inference system has significant differences with its analogues in functional languages. Process types are a non-trivial generalization of functional types to handle multiple outputs and deferred arguments even in higher order parameters, partial application in any order and curried-uncurried coercion. Here we present the elements to model graphical inference, the notion of structural and non-structural equivalence of type graphs, and a graph unification and composition calculus for typing nets in an incremental way.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8
Fig. 9
Fig. 10
Fig. 11
Fig. 12
Fig. 13
Fig. 14
Fig. 15
Fig. 16
Fig. 17
Fig. 18
Fig. 19
Fig. 20
Fig. 21
Fig. 22
Fig. 23
Fig. 24
Fig. 25
Fig. 26

Similar content being viewed by others

Notes

  1. The symbol ? is also used in gradually-typed \(\lambda \)-calculus standing for dynamic types [16].

  2. Being both out-ports they cannot be connected but their TDs would be unified e.g. if they were connected as values of two list-items in a same list.

  3. It can be seen as the equivalent to the Damas-Milner instantiation rule.

  4. The right side cannot be obtained by overlapping as in Fig. 14. The screen-shot was obtained by first connecting the F-out ports of f and g to a pair of connected list-items (then deleted).

  5. Because all them have at least one output connected.

  6. Ordering is significant for ports of higher order parameters, which are clockwise applied, but not for a non-parameterised net. If it finally becomes a net-process (see Sect. 2.4) the user selects the open ports to be the parameters and results, and sets both orderings.

  7. This rule applies also when connecting a vertical green-arrow; it is not a special case.

  8. Since none of the connections closes the other ports.

References

  1. AGG Home page: http://user.cs.tu-berlin.de/~gragra/agg/ (2009)

  2. Clerici, S., Zoltan, C.: A graphic functional-dataflow language. In: Loidl, H.W. (ed.) Trends in Functional Programming, vol. 5, pp. 129–144. Intellect, Bristol (2004)

    Google Scholar 

  3. Clerici, S., Zoltan, C.: Graphical type inference. A graph grammar definition. Technical Report LSI-07-24-R, Department Llenguatges i Sistemes Informàtics, Universitat Politècnica de Catalunya. http://www.lsi.upc.edu/dept/techreps/llistat_detallat.php?id=970 (2007)

  4. Clerici, S., Duch, A., Zoltan, C.: Implementing static synchronus sensor fields using NiMo. Technical Report LSI-09-13-R, Department Llenguatges i Sistemes Informàtics, Universitat Politècnica de Catalunya. http://www.lsi.upc.edu/dept/techreps/llistat_detallat.php?id=1052 (2009)

  5. Clerici, S., Zoltan, C.: A dynamically customizable process-centered evaluation model. In: PPDP ’09: proceedings of the 11th ACM SIGPLAN conference on principles and practice of declarative programming, pp. 37–48. ACM, New York (2009)

  6. Clerici, S., Zoltan, C.: Prestigiacomo G Nimotoons: a totally graphic workbench for program tuning and experimentation. Electr. Note Theor. Comput. Sci. 258(1), 93–107 (2009)

    Article  Google Scholar 

  7. Erwig, M.: Visual type inference. J. Vis. Lang. Comput. 17(2), 161–186 (2006)

    Article  Google Scholar 

  8. König, B.A.: general framework for types in graph rewriting. Acta Inform. 42(4), 349–388 (2005)

    Article  MathSciNet  MATH  Google Scholar 

  9. LabView Home page: http://www.ni.com/gettingstarted/labviewbasics/dataflow.htm (2012)

  10. Lanaspre, B., Glaser, H.: Type inference in prograph. Technical Report DSSE-TR-95-3, Department of Electronics and Computer Science, University of Southampton (1995)

  11. Lua Home Page: http://www.lua.org/ (2013)

  12. Mcadam, B.J.: Generalising techniques for type debugging. In: Trinder, P., Michaelson, G., Loidl, H.W. (eds.) Trends in Functional Programming, pp. 49–57. Intellect, Bristol (2000)

    Google Scholar 

  13. NiMo Home Page: http://www.lsi.upc.edu/~nimo/Project (2012)

  14. Resources: http://resources.businessobjects.com/labs/cal/gemcutter-techpaper (2009)

  15. Rozenberg, G. (ed.): Handbook of Graph Grammars and Computing by Graph Transformations, vol. 1: Foundations. World Scientific, Singapore (1997)

  16. Siek, J.G., Taha, W.: Gradual typing for functional languages. In: Scheme and Functional Programming, Workshop pp. 81–92 (2006)

  17. Simões, H., Florido, M.: TypeTool—a type inference visualization tool. In: Proceedings of the 13th International Workshop on Functional and (Constraint) Logic Programming (2004)

  18. System-I: http://types.bu.edu/modular/compositional/system-i/ (2012)

  19. Turner, D.A.: Miranda: a non-strict functional language with polymorphic types. In: Proceeding of a Conference on Functional Programming Languages and Computer Architecture, pp. 1–16. Springer-Verlag New York Inc, New York (1985)

  20. V-Rep Home Page: http://coppeliarobotics.com/ (2013)

  21. Yang, J., Michaelson, G.: A visualisation of polymorphic type checking. J. Funct. Program. 10, 57–75 (2000)

    Article  Google Scholar 

  22. Yang, J., Michaelson, G., Trinder, P., Wells, J.B.: Improved type error reporting. In: Proceedings of 12th International Workshop on Implementation of Functional Languages, pp. 71–86 (2000)

Download references

Acknowledgments

The authors would like to thank the anonymous reviewers for the detailed and helpful comments to improve the final version. Partially supported by “Generalitat de Catalunya” Project 2009SGR 1137(ALBCOM).

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Silvia Clerici.

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Clerici, S., Zoltan, C. & Prestigiacomo, G. Graphical and incremental type inference. A graph transformation approach. Higher-Order Symb Comput 26, 29–62 (2013). https://doi.org/10.1007/s10990-014-9104-8

Download citation

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s10990-014-9104-8

Keywords

Navigation