Lysxia / first-class-families

First-class type families
https://hackage.haskell.org/package/first-class-families
MIT License
85 stars 12 forks source link

Anonymous functions #8

Open Lysxia opened 5 years ago

Lysxia commented 5 years ago

At the moment constructing functions with the existing combinators is still quite a puzzle. There should be an easier way to implement arbitrary anonymous functions.

One idea is to add an "environment" argument to Eval that can be referenced/updated by some special fcfs. (That would look very much like apply-style defun.)

masaeedu commented 3 years ago

One possibility is to implement S/K/I or B/C/K/W combinators, which can be to eliminate abstraction and express any term from a lambda calculus.

Lysxia commented 3 years ago

That's true, and the library already has sufficiently expressive combinators. My worry was that encoding arbitrary lambda terms into combinators by hand does not seem the most pleasant experience. Another possibility is to always defunctionalize (i.e., name all functions).