``Orphan instances'' should be avoided anyway.

Malcolm Wallace malcolm.wallace at cs.york.ac.uk
Wed Aug 13 04:29:03 EDT 2008


>  We already have named instances:
>
> data ShowDict alpha = ShowDict alpha {
>    namedShows :: alpha -> String -> String
>    }

This is not valid Haskell.  Either all components of the data  
structure are named fields, or none.  It is not possible to have a  
mixture of the two, as here.

In addition, there are many classes it is not currently possible to  
simulate using this technique, because the types go significantly  
beyond Haskell'98.  I believe you need both Rank-2 Types and  
Polymorphic Components to achieve comparable expressivity.  Fuller  
details on the Haskell-Prime site:
     http://hackage.haskell.org/trac/haskell-prime/wiki/PolymorphicComponents

Regards,
     Malcolm



More information about the Libraries mailing list