RE: [Haskell] Object-Orientation and Haskell
24 Sep
2005
24 Sep
'05
8:29 a.m.
Define a type A such that for any type B you can define
up :: B -> A down :: A -> Maybe B
such that
down . up = Just
You can do this quite easily in Java or C++, mutatis mutandis. You can't do this in Haskell, I don't think. You can't actually do this in O'Haskell either, it seems the O' essentially amounts to syntactic sugar.
You can't even do this in OCaml. However, in OOHaskell you can.
From the TOC of the OOHaskell paper http://homepages.cwi.nl/~ralf/OOHaskell/
5.4 Casts based on dynamics 50 5.5 Casts based on unions 51 The second technique may add something to this discussion here. We use a sort of intersection-type encoding (also reminiscent of TICs). Thanks, Ralf
7642
Age (days ago)
7642
Last active (days ago)
0 comments
1 participants
participants (1)
-
Ralf Lammel