[Haskell-cafe] Re: data structures question

Chris Kuklewicz haskell at list.mightyreason.com
Wed Aug 30 15:49:05 EDT 2006


Benjamin Franksen wrote:
> Matthias Fischmann wrote:
>> The trick is that Int is not the only index data type, but tuples of
>> index data types are, too.  Do this:
>>
>> | type Point = (State, State, Int)
>> | type TypeV = Array State Double
>> | 
>> | matrix :: TypeV
>> | matrix = array bounds values
>> |    where
>> |    ...
> 
> Surely you meant to say
> 
> | type TypeV = Array Point Double
> 
> Cheers,
> Ben

And

type Value = Double
newtype PointNat = PointNat Int deriving (...Ix)
type Point = (State,State,PointNat)

Or even

type TypeVof a = Array PointNat a
type TypeV = TypeVof Value

I did not even run the code I wrote through ghci, I was just showing what it 
could look like.

And stop calling me Shirley.


More information about the Haskell-Cafe mailing list