Monomorphism, monomorphism...
Ashley Yakeley
ashley@semantic.org
Wed, 10 Oct 2001 15:20:23 -0700
At 2001-10-10 03:59, Marcin 'Qrczak' Kowalczyk wrote:
>We need some type T such that it's possible to define a family of
>functions for arbitrary choices of A:
> upA :: A -> T
> downA :: T -> Maybe A
>satisfying downA (upA a) = Just a. We want to choose the type for T
>before deciding the exact set of types for A.
I'm convinced extensible datatypes are the cleanest and most in-spirit
extenstion to Haskell to solve this.
data T = _;
...
data T |= MkAT A;
upA = MkAT;
downA (MkAT a) = Just a;
downA _ = Nothing;
--
Ashley Yakeley, Seattle WA