Y-Combinator in FT EDSL

I am trying to figure out how to express Y-Combitor in this indifferent EDSL:

class Symantics exp where
    lam :: (exp a -> exp b) -> exp (exp a -> exp b)
    app :: exp (exp a -> exp b) -> exp a -> exp b

    fix :: ...
    fix f = .....

I'm not sure, but I think that the default implementation of Y-Combinator should be possible using "lam" and "app".

Does anyone know how? My first attempts fail because "it is impossible to build an infinite type."

Cheers, Gunther

+3
source share
2 answers

let, . lam , Haskell . -, .

+2

sclv, . , Haskell:

fix :: (a -> a) -> a
fix f = let x = f x in x

"let" . 1 2 Barendregt, , , ( - ?). http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.46.9283

+2

Source: https://habr.com/ru/post/1751422/


All Articles