[Haskell-cafe] MultiParamClasses question

Eugeny N Dzhurinsky bofh at redwerk.com
Tue May 25 16:59:29 EDT 2010


On Tue, May 25, 2010 at 07:59:24PM +0100, Stephen Tetley wrote:
> Hi Eugeny
> 
> Its not that GHC thinks you're doing something weird, but that there
> is no relation between the type parameters in the Storage class. You
> could use either functional dependencies or type families to introduce
> a relation / relations, but personally I would look at doing something
> simpler - for instance why do you need a map type that is polymorphic
> on shape?

Currently I am creating set of objects from name-value pairs, and I decided to
use Map for keeping relations between an object id and record with the id. So
I will be able to parse the parameter like

param_1_propname=value

then take the object with ID=1 from Map, and update it's property 'propname'
with value, and put it back into the Map.

But I faced several cases when a set of name-value pairs describes  2 or even
more kinds of objects. And I want to be able to parse them all at one pass, so
I would need 2 or more maps. And I simply tried to generalize the solution.

Probably I should think in different way. May be a chain of Writer monads or
something similar.

-- 
Eugene Dzhurinsky
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20100525/22a1b7ef/attachment.bin


More information about the Haskell-Cafe mailing list