[Haskell] Classes with no data type

Cale Gibbard cgibbard at gmail.com
Mon Oct 9 21:33:57 EDT 2006


Use case to pattern match against the constructors of the datatype?
This is assuming that you've made them explicit. If not, you'll at
least want to extend your datatype with some information that allows
you to determine what should be done with the values later.

On 09/10/06, Thomas Davie <tatd2 at kent.ac.uk> wrote:
> Hi,
>    I've met an interesting problem in terms of how to type a data
> structure and the functions that operate upon it.
>
> The problem centres around a single data type.  This data type can be
> constructed in multiple ways using different functions, depending on
> the options the user specifies.  That's all simple enough.  The
> problem really comes later on.  Depending on the function used
> generate the data structure I want to use different functions later
> on for example, to display the data.
>
> Thus I have a typical classes problem, in that I have several
> implementations of essentially the same function for different
> circumstances.  The problem is, they must all operate on the same
> data type, so I cannot define them as seperate instances.
>
> Anyone got any ideas how to type this?
>
> Bob
> _______________________________________________
> Haskell mailing list
> Haskell at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell
>


More information about the Haskell mailing list