Haskell 有没有更好的方法来编写自指let表达式
i、 我们能更简洁地写出以下内容吗Haskell 有没有更好的方法来编写自指let表达式,haskell,Haskell,i、 我们能更简洁地写出以下内容吗 bar in_env a=let out_env=foo in_env(R a out env)in out env 我想写一些类似的东西 bar in_env a=foo in_env(R a??) 但也许这是不可能的?首先,像这样重写它,以便您能够在下一步中轻松地将eta减少到out\u env: bar in_env a = let out_env = foo in_env . R a $ out_env in out_env 然后,使用递归的le
bar in_env a=let out_env=foo in_env(R a out env)in out env
我想写一些类似的东西
bar in_env a=foo in_env(R a??)
但也许这是不可能的?首先,像这样重写它,以便您能够在下一步中轻松地将eta减少到
out\u env
:
bar in_env a = let out_env = foo in_env . R a $ out_env in out_env
然后,使用递归的let
等价于fix
:
import Data.Function (fix)
bar in_env a = fix $ foo in_env . R a
这正是我想要的东西,谢谢!