[Haskell-cafe] ANNOUNCE: Generic Haskell 1.80 (Emerald)

Thomas van Noort thomas at cs.ru.nl
Sat Apr 12 13:33:32 EDT 2008


> On 12/04/2008, Thomas van Noort <thomas at cs.ru.nl> wrote:
>
>> That's a good question. Unfortunately, only Haskell98 types are
>> currently
>>  supported by the Generic Haskell compiler.
>
> I thought constrained types were Haskell 98, but now I'm in doubt...

I'm not 100% sure either, but according to the Haskell98 language report,
constrained types are not part of Haskell98,

http://haskell.org/onlinereport/basic.html ,

but are described as GHC language features,

http://www.haskell.org/ghc/docs/latest/html/users_guide/data-type-extensions.html

>
>>  But at first sight, implementing support for parametric types with
>> class
>>  constraints is not too hard. Class constraints of a parametric type
>> need
>>  to be propagated to its generated structure type.
>
> Certainly, but there are a few difficulties for higher-kinded types.
> An arguable solution: http://portal.acm.org/citation.cfm?id=1159868
>
> The reason I mention this is because Scrap your Boilerplate supports
> them whereas GH does not, and I'm not aware this has been taken into
> account when comparing these two approaches in the work cited by Bulat
> on this thread.
>

This has certainly been taken into account when comparing approaches to
generic programming. I quote from page 18/19 from the work you and Bulat
cited:

==
Full reflexivity. A generic programming language is fully reflexive if a
generic function can be used on any type that is definable in the
language. Generic Haskell is fully reflexive with respect to the types
that are definable in Haskell 98, except for constraints in data-type
definitions. So a data type of the form

data Eq a => Set a = NilSet | ConsSet a (Set a)

is not dealt with correctly. However, constrained data types are a corner
case in Haskell and can easily be simulated using other means.
Furthermore, Nogueira [69] shows how to make Generic Haskell work for data
types with constraints.
==

Thus, full reflexivity of an approach is taken into account. This suggests
constrained types are part of Haskell98. So, I'm a bit confused at the
moment as well.

Regards,
Thomas



More information about the Haskell-Cafe mailing list