stefan:
> Al,
>
> >Has there been any work on extending Haskell's type system with
> >structural subtyping?
>
> Koji Kagawaga. Polymorphic variants in Haskell. In Andres Loeh,
> editor, Proceedings of the 2006 ACM SIGPLAN Workshop on Haskell,
> Portland, Oregon, USA, September 17, 2006, pages 37--47. ACM Press,
> 2006. [1]
>
> >What is the canonical solution to the expression problem in Haskell?
>
> Not canonical but Loeh and Hinze have proposed open data types:
>
For a short term solution, we used Typeable + type classes to provide a
open Message data type. Similar techniques are used in Simon Marlow's
extensible exceptions paper.
-- An open Message type
class Typeable a => Message a
--
-- A wrapped value of some type in the Message class.
--
data SomeMessage = forall a. Message a => SomeMessage a
--
-- And now, unwrap a given, unknown Message type, performing a (dynamic)
-- type check on the result.
--
fromMessage :: Message m => SomeMessage -> Maybe m
fromMessage (SomeMessage m) = cast m
-- Don
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe