(sorry for the slow reply on this topic...)
Robert Atkey and Oleg presented some very interesting code in response
to your query. But some of you might (and should!) be asking why on
earth did Jacques use unsafePerformIO?, especially when neither Robert
nor Oleg did.
Simply put: I answered
Hi Jacques,
thank you again for your post, better late than never :)!
Let me first apologize to you, I did not immediately recognize you as one
of the authors of the Finally Tagless paper.
After 2 years now of using haskell at a mere layman's level and
nevertheless writing better and more
On Mon, 2009-10-05 at 19:22 -0400, David Menendez wrote:
The two obvious options are
call-by-name and call-by-value.
I wonder how easily one can provide both, like in Algol.
Fairly easy, you can either do a language that has an explicit monad (a
bit like Haskell with only the IO monad), or
On Mon, 2009-10-05 at 22:42 +0100, Robert Atkey wrote:
There is a difference in the syntax between CBN and CBV that is not
always obvious from the usual paper presentations. There is a split
between pieces of syntax that are values and those that are
computations. Values do not have
Hi all,
I'm playing around with finally tagless.
Here is the class for my Syntax:
class HOAS repr where
lam :: (repr a - repr b) - repr (a - b)
app :: repr (a - b) - repr a - repr b
fix :: (repr a - repr a) - repr a
let_ :: repr a - (repr a - repr b) - repr b
int :: Int -
It's possible, but it's not nice. You need to be able to get out of
the monad to make the types match, i.e.
lam f = I (return $ \x - let y = I (return x) in
unsafePerformIO $ unI (f y))
The use of IO 'forces' lam to transform its effectful input into an even
Hello Jacques,
thanks, that is disappointing in some way, guess I still have a lot to
learn.
Günther
Am 05.10.2009, 18:06 Uhr, schrieb Jacques Carette care...@mcmaster.ca:
It's possible, but it's not nice. You need to be able to get out of
the monad to make the types match, i.e.
BTW, here is a more symmetric version of the same code:
lam f = I . return $ unsafePerformIO . unI . f . I . return
which has a very clear pattern of
lam f = embed $ extract . f. embed
where 'embed' is often called return. Implementations of lam in
tagless final style tend to follow the
Hi Günther,
The underlying problem with the implementation of 'lam' is that
you have to pick an evaluation order for the side effects you want in
the semantics of your embedded language. The two obvious options are
call-by-name and call-by-value.
The tricky point is that the types of the
2009/10/5 Robert Atkey bob.at...@ed.ac.uk:
Hi Günther,
The underlying problem with the implementation of 'lam' is that
you have to pick an evaluation order for the side effects you want in
the semantics of your embedded language. The two obvious options are
call-by-name and call-by-value.
I
10 matches
Mail list logo